From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4097 invoked by alias); 30 Apr 2009 22:12:56 -0000 Received: (qmail 4088 invoked by uid 22791); 30 Apr 2009 22:12:55 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (216.239.45.13) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 30 Apr 2009 22:12:50 +0000 Received: from spaceape13.eur.corp.google.com (spaceape13.eur.corp.google.com [172.28.16.147]) by smtp-out.google.com with ESMTP id n3UMCkGv001418 for ; Thu, 30 Apr 2009 15:12:47 -0700 Received: from yw-out-2324.google.com (ywj3.prod.google.com [10.192.10.3]) by spaceape13.eur.corp.google.com with ESMTP id n3UMCixj023557 for ; Thu, 30 Apr 2009 15:12:45 -0700 Received: by yw-out-2324.google.com with SMTP id 3so1258950ywj.41 for ; Thu, 30 Apr 2009 15:12:44 -0700 (PDT) MIME-Version: 1.0 Received: by 10.101.70.6 with SMTP id x6mr4292859ank.56.1241129564367; Thu, 30 Apr 2009 15:12:44 -0700 (PDT) In-Reply-To: <8ac60eac0904301211x245c8b7cp546042d832eb1fe@mail.gmail.com> References: <8ac60eac0904201019g7ba8056bx5e84e6bfdf5935d8@mail.gmail.com> <20090422172517.GA17235@caradoc.them.org> <8ac60eac0904221810x24763ecaj4a888927b766e7f7@mail.gmail.com> <8ac60eac0904230001w1afd9179wcb76e1cfd7f3f386@mail.gmail.com> <8ac60eac0904291330m78b43c47p1cc9b8379e31e923@mail.gmail.com> <20090430185551.GB10734@adacore.com> <8ac60eac0904301211x245c8b7cp546042d832eb1fe@mail.gmail.com> Date: Thu, 30 Apr 2009 22:12:00 -0000 Message-ID: Subject: Re: [patch][rfc] Allow GDB to search for the right libthread_db.so.1 From: Doug Evans To: Paul Pluzhnikov Cc: Joel Brobecker , Hui Zhu , 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-System-Of-Record: true 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/msg00827.txt.bz2 On Thu, Apr 30, 2009 at 12:11 PM, Paul Pluzhnikov wrote: > On Thu, Apr 30, 2009 at 11:55 AM, Joel Brobecker = wrote: > >>> 1. If libthread_db_search_path is set, use it *before* trying to load >>> =A0 =A0libthread_db from the same directory where libpthread was loaded= in the >>> =A0 =A0inferior. >> >> From my naive perspective (never really had a need for this feature), >> it seems better to check the path before checking the path that was >> used by the inferior. =A0Otherwise, if the local host has a library >> at the same location but that's different from the library used >> by the inferior, we wouldn't be able to force the debugger to use >> a different library, would we? > > Assume inferior is using remote:/a/b/c/libpthread.so.0. > > If host has local:/a/b/c/libthread_db.so.0 which is incompatible with > remote:/a/b/c/libpthread.so.0, then > try_thread_db_load("/a/b/c/libthread_db.so.0") > will fail, and GDB will proceed to try other paths in > libthread_db_search_path. > > But I see your point: if local:/a/b/c/libthread_db.so.0 "agrees" > to work with the inferior (td_ta_new returns TD_OK), yet is the wrong one > to use for some reason, there is no way for the user to force GDB to use > an alternate libthread_db. > > I'll invert the order of search, get rid of symbol lookup, and send an > updated patch shortly. One could recognize a special path that means the path used by the inferior. That would also collapse the algorithm from "check A, then check B" (where A and B are libthread-db-path, inferior-path in some order) to just "check libthread-db-path". It's kinda similar to "dir" where "dir" by itself resets the path to $cdir:= $cwd, though in this case one would always set the entire libthread-db-path whereas the "dir" command prepends to the current path. Just a thought.