remote/2199: Problem in gdb-6.5 (remote) while stepping over pthread_create() on x86 and powerpc

midoegal@web.de midoegal@web.de
Wed Nov 15 15:08:00 GMT 2006


>Number:         2199
>Category:       remote
>Synopsis:       Problem in gdb-6.5 (remote) while stepping over pthread_create() on x86 and powerpc
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Nov 15 15:08:01 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     Markus Deuling
>Release:        gdb-6.5
>Organization:
>Environment:
Linux on x86 AND powerpc

powerpc:
<uname -a>
Linux localhost.localdomain 2.6.18 #1 SMP Mon Nov 13 17:50:13 CET 2006 ppc64 ppc64 ppc64 GNU/Linux
<gcc -v>
Using built-in specs.
Target: ppc64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-libgcj-multifile --enable-languages=c,c++,objc,obj-c++,java,fortran --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --enable-secureplt --with-long-double-128 --host=ppc64-redhat-linux --build=ppc64-redhat-linux --target=ppc64-redhat-linux --with-cpu=default32
Thread model: posix
gcc version 4.1.0 20060304 (Red Hat 4.1.0-3)

<gdb configure>
This GDB was configured as "ppc64-redhat-linux-gnu"

>Description:
I found a bug when stepping over pthread_create(). The 'next' over pthread_create() looses its breakpoint after returning. This only seems to occur if the new Thread uses a shared library using dlopen()/dlsym().

This appears both on x86 and powerpc while remote debugging. I added a testcases which shows this result.

Here is a dump of the gdb session on powerpc. I used gdb-6.5 vanilla:

(gdb) target remote :1111
Remote debugging using :1111
0x0ffd60f0 in ?? ()
(gdb) br main
Breakpoint 1 at 0x10000684: file main.c, line 16.
(gdb) c
Continuing.
[New thread 6635]
[Switching to thread 6635]

Breakpoint 1, main () at main.c:16
16        for (cnt = 0; cnt < max_nr; cnt++)
(gdb) n
18            val = pthread_create (&thread_id[cnt], NULL, &test, NULL);
(gdb)
[New thread 6636]
[New thread 6638]
[New thread 6639]

Program exited normally.
(gdb)

Here you can see that gdb doesn't stop after next'ing over the first pthread_create() as it should.

Regards,
Markus Deuling
>How-To-Repeat:
I attached the testcase. Compile it on either x86 or powerpc, then debug it remotely.

gdbserver :1111 ./main
gdb + target remote :1111 
for example
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/x-csrc; name="main.c"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="main.c"

LyogcHBlIGFwcCBpbmNsdWRpbmcgcHRocmVhZHMKICovCiNpbmNsdWRlIDxwdGhyZWFkLmg+CiNp
bmNsdWRlIDxzdGRpby5oPgojaW5jbHVkZSA8ZGxmY24uaD4KI2luY2x1ZGUgPHRpbWUuaD4KCnZv
aWQqIHRlc3QoKTsKI2RlZmluZSBtYXhfbnIgNAoKaW50IG1haW4oKQp7CiAgcHRocmVhZF90IHRo
cmVhZF9pZFttYXhfbnJdOwogIGludCB2YWwsIGNudDsKCiAgZm9yIChjbnQgPSAwOyBjbnQgPCBt
YXhfbnI7IGNudCsrKQogICAgewogICAgICB2YWwgPSBwdGhyZWFkX2NyZWF0ZSAoJnRocmVhZF9p
ZFtjbnRdLCBOVUxMLCAmdGVzdCwgTlVMTCk7CiAgICAgIHByaW50ZigicHRocmVhZF9jcmVhdGVb
JWRdOiAlZFxuIiwgY250LCB2YWwpOwogICAgfQoKICAvKiB3YWl0IGZvciB0aHJlYWRzICovCiAg
Zm9yIChjbnQgPSAwOyBjbnQgPCBtYXhfbnI7IGNudCsrKQogICAgewogICAgICB2YWwgPSBwdGhy
ZWFkX2pvaW4gKHRocmVhZF9pZFtjbnRdLCBOVUxMKTsKICAgICAgcHJpbnRmKCJwdGhyZWFkX2pv
aW5bJWRdID0gJWRcbiIsIGNudCwgdmFsKTs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