From owner-freebsd-threads@FreeBSD.ORG Thu Apr 27 16:36:46 2006 Return-Path: X-Original-To: freebsd-threads@freebsd.org Delivered-To: freebsd-threads@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2FD0316A401 for ; Thu, 27 Apr 2006 16:36:46 +0000 (UTC) (envelope-from bmah@freebsd.org) Received: from a.mail.sonic.net (a.mail.sonic.net [64.142.16.245]) by mx1.FreeBSD.org (Postfix) with ESMTP id DE06F43D45 for ; Thu, 27 Apr 2006 16:36:45 +0000 (GMT) (envelope-from bmah@freebsd.org) Received: from [192.168.40.183] (64-84-9-2-sf-gw.ncircle.com [64.84.9.2]) (authenticated bits=0) by a.mail.sonic.net (8.13.6/8.13.3) with ESMTP id k3RGajcp002632 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 27 Apr 2006 09:36:45 -0700 Message-ID: <4450F31D.8060607@freebsd.org> Date: Thu, 27 Apr 2006 09:36:45 -0700 From: "Bruce A. Mah" User-Agent: Thunderbird 1.5.0.2 (X11/20060424) MIME-Version: 1.0 To: freebsd-threads@freebsd.org X-Enigmail-Version: 0.94.0.0 OpenPGP: id=5ba052c3 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig4CB4658F20E4BFD68349EEEF" Subject: GDB and libc_r-using programs X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Apr 2006 16:36:46 -0000 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 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--