Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 12 Sep 2016 13:55:58 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-ports-bugs@FreeBSD.org
Subject:   [Bug 212607] devel/gdb: debugging threaded process broken
Message-ID:  <bug-212607-13@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D212607

            Bug ID: 212607
           Summary: devel/gdb: debugging threaded process broken
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: Individual Port(s)
          Assignee: freebsd-ports-bugs@FreeBSD.org
          Reporter: tijl@FreeBSD.org
                CC: luca.pizzamiglio@gmail.com
             Flags: maintainer-feedback?(luca.pizzamiglio@gmail.com)
                CC: luca.pizzamiglio@gmail.com

I'm running into a problem debugging threaded programs on FreeBSD head amd64
r304294 and i386 r305230.

The following program reproduces it, but not always:

% cat test.c
#include <pthread.h>

void *
thr( void *arg ) {
        return( arg );
}

int
main( void ) {
        pthread_t pthr[ 4 ];

        pthread_create( &pthr[ 0 ], NULL, thr, NULL );
        pthread_create( &pthr[ 1 ], NULL, thr, NULL );
        pthread_create( &pthr[ 2 ], NULL, thr, NULL );
        pthread_create( &pthr[ 3 ], NULL, thr, NULL );
        pthread_join( pthr[ 0 ], NULL );
        pthread_join( pthr[ 1 ], NULL );
        pthread_join( pthr[ 2 ], NULL );
        pthread_join( pthr[ 3 ], NULL );
        return( 0 );
}
% cc -ggdb -o test test.c -lpthread
% gdb ./test
Reading symbols from ./test...done.
(gdb) b thr
Breakpoint 1 at 0x4007d8: file test.c, line 5.
(gdb) r
Starting program: /usr/home/tijl/test=20
[New LWP 100221 of process 974]
[New LWP 100222 of process 974]
[Switching to LWP 100221 of process 974]

Thread 2 hit Breakpoint 1, thr (arg=3D0x0) at test.c:5
5               return( arg );
(gdb) c
Continuing.
[Switching to LWP 100222 of process 974]

Thread 3 hit Breakpoint 1, thr (arg=3D0x0) at test.c:5
5               return( arg );
(gdb) c
Continuing.
[LWP 100221 of process 974 exited]
[LWP 100222 of process 974 exited]
[New LWP 100223 of process 974]
[Switching to LWP 100223 of process 974]
0x0000000800828990 in ?? () from /lib/libthr.so.3
ptrace: No such process.

At this point gdb seems to be in an inconsistent state.

(gdb) bt
#0  0x0000000800828990 in ?? () from /lib/libthr.so.3
#1  0x0000000000000000 in ?? ()
Backtrace stopped: Cannot access memory at address 0x7fffdfbfc000
(gdb) q
A debugging session is active.

        Inferior 1 [process 974] will be killed.

Quit anyway? (y or n) y

Here gdb locks up and has to be killed with SIGKILL.

ports r411099 is the first commit that gives this behaviour.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-212607-13>