From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1247 invoked by alias); 30 Jan 2003 18:13:33 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 1227 invoked from network); 30 Jan 2003 18:13:32 -0000 Received: from unknown (HELO mx1.redhat.com) (172.16.49.200) by 172.16.49.205 with SMTP; 30 Jan 2003 18:13:32 -0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.11.6/8.11.6) with ESMTP id h0UIDWf25592 for ; Thu, 30 Jan 2003 13:13:32 -0500 Received: from pobox.corp.redhat.com (pobox.corp.redhat.com [172.16.52.156]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id h0UIDWa07730; Thu, 30 Jan 2003 13:13:32 -0500 Received: from localhost.localdomain (vpn50-31.rdu.redhat.com [172.16.50.31]) by pobox.corp.redhat.com (8.11.6/8.11.6) with ESMTP id h0UIDVB27083; Thu, 30 Jan 2003 13:13:31 -0500 Received: (from kev@localhost) by localhost.localdomain (8.11.6/8.11.6) id h0UIDQ325462; Thu, 30 Jan 2003 11:13:26 -0700 Date: Thu, 30 Jan 2003 18:13:00 -0000 From: Kevin Buettner Message-Id: <1030130181325.ZM25461@localhost.localdomain> In-Reply-To: Dan Mosedale "Re: linux, threads and auto-solib-add" (Jan 30, 2:14am) References: <1043886256.1217.64.camel@Dragon> <1030130005010.ZM22518@localhost.localdomain> <3E38FB11.4020401@mozilla.org> To: Dan Mosedale Subject: Re: linux, threads and auto-solib-add Cc: "Martin M. Hunt" , gdb@sources.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2003-01/txt/msg00523.txt.bz2 On Jan 30, 2:14am, Dan Mosedale wrote: > Kevin Buettner wrote: > > >On Jan 29, 4:24pm, Martin M. Hunt wrote: > > > >>I am trying to answer a question about debugging threaded applications > >>when auto-solib-add is off. You cannot debug pthreads programs without > >>first loading the symbols for libpthread. > >> > >>Given that, does it make sense to modify solid_add to always read the > >>symbols for libpthread, if it is in the library list? > > > >I'm not in favor of this. > > > >>Or is expected the user knows enough to always immediately do "shar > >>libpthread" after starting debugging a threaded program? > > > >IMO, when the user disables auto-solib-add, then the user is > >responsible for "hand" loading the shared libraries needed for > >debugging the program. > > Can you elaborate a bit on what it is about this you don't like? This > doesn't strike me as terribly intuitive behavior, since (unlike most > other shared libraries), not having the symbols loaded effects the > operation of things other than just the stack trace commands (at least > "info threads"). It's worth keeping in mind that with larger software > projects (eg Mozilla), developers may be turning auto-solib-add off > because, given performance constraints, there's no practical alternative > if you don't have a suitably beefy machine. IMO, it adds needless complexity to gdb's shared library machinery and to the documentation. On the gdb side, we have to check for a particular thread library, the name of which is platform dependent. On the documentation side, we now have an exception to the rule that no shared libraries are automatically loaded when auto-solib-add is disabled. Also, there may be occasions when the user truly doesn't want _any_ shared libraries to be automatically loaded. I used the word "needless" above because I think there's a perfectly reasonable way that the user can achieve the same effect without modifying gdb. Simply place the following commands in a suitable .gdbinit file: set auto-solib-add off define hook-stop sharedlibrary libpthread end The ``hook-stop'' definition above will attempt to load the libpthread shared library every time gdb stops. Of course, once a shared library has been loaded, future attempts to load the shared library are effectively no-ops since gdb knows that the library is already loaded. Kevin