From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7432 invoked by alias); 30 Apr 2009 05:38:06 -0000 Received: (qmail 7420 invoked by uid 22791); 30 Apr 2009 05:38:06 -0000 X-SWARE-Spam-Status: No, hits=-1.6 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS X-Spam-Check-By: sourceware.org Received: from ti-out-0910.google.com (HELO ti-out-0910.google.com) (209.85.142.187) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 30 Apr 2009 05:38:01 +0000 Received: by ti-out-0910.google.com with SMTP id a1so168921tib.12 for ; Wed, 29 Apr 2009 22:37:57 -0700 (PDT) MIME-Version: 1.0 Received: by 10.110.15.19 with SMTP id 19mr84526tio.51.1241069877915; Wed, 29 Apr 2009 22:37:57 -0700 (PDT) In-Reply-To: <8ac60eac0904291330m78b43c47p1cc9b8379e31e923@mail.gmail.com> References: <1239225742.8871.145.camel@localhost.localdomain> <20090420180352.GA14206@caradoc.them.org> <8ac60eac0904201208m95d4585k2b09f6b6fe5edb40@mail.gmail.com> <20090422172517.GA17235@caradoc.them.org> <8ac60eac0904221810x24763ecaj4a888927b766e7f7@mail.gmail.com> <8ac60eac0904230001w1afd9179wcb76e1cfd7f3f386@mail.gmail.com> <8ac60eac0904291330m78b43c47p1cc9b8379e31e923@mail.gmail.com> Date: Thu, 30 Apr 2009 05:38:00 -0000 Message-ID: Subject: Re: [patch][rfc] Allow GDB to search for the right libthread_db.so.1 From: Hui Zhu To: Paul Pluzhnikov Cc: tromey@redhat.com, Thiago Jung Bauermann , gdb-patches ml , Eli Zaretskii Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2009-04/txt/msg00802.txt.bz2 Hi Paul, On Thu, Apr 30, 2009 at 04:30, Paul Pluzhnikov wro= te: > On Thu, Apr 23, 2009 at 4:32 AM, Hui Zhu wrote: >> In function thread_db_load, I suggest try_thread_db_load with >> libthread_db_search_path first. >> Cause I think if user set a directory, he must want it be loaded. > > Hui made two suggestions: > > 1. If libthread_db_search_path is set, use it *before* trying to load > =A0 libthread_db from the same directory where libpthread was loaded in t= he > =A0 inferior. > > 2. Allow libthread_db_search_path contain files as well as directories. 3. And in thread_db_load: + msym =3D lookup_minimal_symbol ("nptl_version", NULL, NULL); + if (!msym) + msym =3D lookup_minimal_symbol ("__linuxthreads_version", NULL, NULL); + + /* Some really old libpthread versions do not have either of the above. = */ + if (!msym) + msym =3D lookup_minimal_symbol ("__pthread_threads_events", NULL, NULL= ); + + if (!msym) + /* No threads yet */ + return 0; You really don't want gdb try it with libthread_db? If in the future, this code doesn't cover everything. And I think let gdb try will not affect anything. :) > > Both are (IMHO) reasonable, though I don't particularly like either. > > Implementing 1) will cause a bit of searching, because most of the time > the libthread_db which "parallels" libpthread is the right one (at least > for us), and the search is really there mostly for static executables > (which are somewhat rare here). If user set the directory, I think he must want gdb use it directly. > > Implementing 2) "clouds" the meaning of libthread_db_search_path somewhat, > and it is quite unlikely (though certainlyh possible) that libthread_db > will be called anything other than libthread_db.so.1 on Linux. Why not let user can set a file to be libthread_db? Maybe this directory doesn't have soft link, just a "libthread_db-1.0.so". Thanks, Hui