GDB and libc_r-using programs

Bruce A. Mah bmah at freebsd.org
Thu Apr 27 16:36:46 UTC 2006


Hi folks--

I ran into a problem yesterday at ${ORKPLACE} using GDB to debug a
multi-threaded program linked with libc_r.  The environment is FreeBSD
6.0-RELEASE/i386, although I see the same results on recent RELENG_6/i386.

If the program is linked against libpthread or libthr, GDB properly
detects the threading library in use (presumably there's some
autodetection logic around libthread_db?).  When I say "properly", I
mean that, for example, "info threads" gives reasonable and expected
information.

If I link the same program with libc_r, however, GDB seems to have some
problems, like this example with a silly little test program (ignore the
output):

localhost:threads% gdb thread-test-user
GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-marcel-freebsd"...
(gdb) run
Starting program: /home/bmah/nCircle/threads/thread-test-user
warning: Unable to get location for thread creation breakpoint: generic
error
[New LWP 100169]
begin main: gCounter=1

        <thread=0x804d400, gCounter=1>
didiCannot find thread, Thread ID=1, generic error
(gdb) info threads
Cannot find thread, Thread ID=5, generic error

My questions are:  Should I expect this to work?  Do I need to tell GDB
(somehow?) explicitly that I'm using libc_r, as opposed to the other two
libraries?

A combination of Googling, UTSL, and browsing this year's postings to
the threads@ list didn't yield an answer to this.

Thanks for any insights!

Bruce.

PS.  Yes, I know that libc_r will be going away, and the real solution
to this is to link against libpthread or libthr.  That is indeed the
direction we want to take, but for the extremely short term, being able
to have GDB do something useful with this program would be very nice.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 250 bytes
Desc: OpenPGP digital signature
Url : http://lists.freebsd.org/pipermail/freebsd-threads/attachments/20060427/8e586c31/signature.pgp


More information about the freebsd-threads mailing list