From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25827 invoked by alias); 3 Aug 2005 18:14:05 -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 25793 invoked by uid 22791); 3 Aug 2005 18:13:55 -0000 Received: from qnxmail.qnx.com (HELO nimbus.ott.qnx.com) (209.226.137.76) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Wed, 03 Aug 2005 18:13:55 +0000 Received: from [10.42.102.103] (STIMPY [10.42.102.103]) by nimbus.ott.qnx.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2653.13) id PJ4CT3FD; Wed, 3 Aug 2005 14:13:53 -0400 Message-ID: <42F10A0F.2040909@qnx.com> Date: Wed, 03 Aug 2005 18:14:00 -0000 From: Kris Warkentin User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) MIME-Version: 1.0 To: Daniel Jacobowitz CC: Paul Koning , gdb@sources.redhat.com Subject: Re: solib search algorithm for cross-gdb References: <20050803170618.GA12169@nevyn.them.org> In-Reply-To: <20050803170618.GA12169@nevyn.them.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2005-08/txt/msg00018.txt.bz2 Daniel Jacobowitz wrote: >On Wed, Aug 03, 2005 at 09:38:18AM -0400, Paul Koning wrote: > > >>Currently, the shared library search in solib.c first tries to use the >>shared lib filename as given (if solib-absolute-prefix isn't set). >> >>That's exactly right for a native gdb, but it is in general the wrong >>answer for a cross-gdb. If I'm debugging a mips box, or analyzing a >>mips corefile, resolving shared lib symbols from intel shared libs in >>my /usr/lib is the wrong thing. >> >>.gdbinit helps, but not everyone remembers to do this right every >>time. >> >>I was thinking about having the case of "use the filename exactly as >>supplied" in solib.c be used only in native gdb. That seems to >>require adding stuff in configure and config.in to tell a native from >>a cross build. >> >>I could submit this patch if it sounds like a good feature (otherwise >>I'll probably keep it as a private change). Comments? Better ways to >>do this? >> >> > >There's an argument that this should be based primarily on the target. >Using the native files is generally right for target "child"; generally >wrong (though not necessarily) for target "remote"; and generally right >for target "core" iff this is a native GDB. > >I don't know if that's worth implementing. I'm inclined to say that >your suggestion is progress, at least. > There's also the argument that it's almost never correct to be cross debugging _without_ solib-absolute-prefix set. I had put in the TARGET_SO_FIND_AND_OPEN_SOLIB hook to give targets custom ways of finding their own stuff but I put it after the check for the literal path so it would play nicely with native debugging. A really clever fix would be to check the architecture of found solibs and discard them and keep searching if it doesn't match (printing a warning perhaps). Of course, that could still get the wrong library... Almost impossible to guarantee that you never get the wrong lib I think. Fools are too ingenious. ;-) cheers, Kris -- Stay up-to-date on all the QNX news! Register at http://www.qnx.com/news/forms/newsletter.html to receive our newsletter.