Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 27 Apr 2006 09:36:45 -0700
From:      "Bruce A. Mah" <bmah@freebsd.org>
To:        freebsd-threads@freebsd.org
Subject:   GDB and libc_r-using programs
Message-ID:  <4450F31D.8060607@freebsd.org>

next in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
--------------enig4CB4658F20E4BFD68349EEEF
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

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=
=2E

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 detail=
s.
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=3D1

        <thread=3D0x804d400, gCounter=3D1>
didiCannot find thread, Thread ID=3D1, generic error
(gdb) info threads
Cannot find thread, Thread ID=3D5, 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.


--------------enig4CB4658F20E4BFD68349EEEF
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (FreeBSD)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFEUPMd2MoxcVugUsMRApWIAKCNcOpXPBe6zwEi3J9mzGR8dsZ1qQCfVejV
Wo4UhoafHIQKk88nhnPUhvk=
=Yh8i
-----END PGP SIGNATURE-----

--------------enig4CB4658F20E4BFD68349EEEF--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4450F31D.8060607>