From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6655 invoked by alias); 3 Mar 2009 01:52:58 -0000 Received: (qmail 6637 invoked by uid 22791); 3 Mar 2009 01:52:56 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 03 Mar 2009 01:52:43 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 134E22BAAF0; Mon, 2 Mar 2009 20:52:45 -0500 (EST) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id ggrBjE9MKOyb; Mon, 2 Mar 2009 20:52:45 -0500 (EST) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id CFD6C2BAAED; Mon, 2 Mar 2009 20:52:44 -0500 (EST) Received: by joel.gnat.com (Postfix, from userid 1000) id 9E779E7ACD; Mon, 2 Mar 2009 17:52:39 -0800 (PST) Date: Tue, 03 Mar 2009 01:52:00 -0000 From: Joel Brobecker To: Brendan Miller Cc: gdb@sourceware.org Subject: Re: Fwd: how to determine location of source? Message-ID: <20090303015239.GO3632@adacore.com> References: <20090303010451.GM3632@adacore.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.2i Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2009-03/txt/msg00014.txt.bz2 > Right, but before I can use that I need to know what the original path > was so I can do the substitution. My binaries come from a daily build, > and I can't know what particular path the build machine made them on > without inspecting the binaries themselves. If the build was a different machine, the chances are GDB will not be able to find the sources by default, as the paths in the debugging info are invalid for your machine. In that case, if the sources on your host are inside one or two directories, the "dir" command might be sufficient and the easiest to use. Plus, it'll always work. Otherwise, you have several options. There are some tools out there that allow you to inspect the debugging information. The one I like the most is "readelf". The "set substitute-path" should work. > I did read the gdb documentation here, As I said to Brendan as a reply to his first (private) reply, I almost immediately regretted the way I said it. It was a genuine advice, and yet I made it sounds like a retort. > scroll down to the Specifying > Source Directories section: > http://sourceware.org/gdb/download/onlinedocs/gdb_8.html#SEC51 > > which is why I was posting on the list, because the documentation is > incomplete, or maybe I just missed something. Yes, perhaps a reference to some of the GDB commands that can be used to get that piece of info might be useful. The fee for the help you are getting here is a patch to the GDB documentation. Thank you! :) So, doesn't "info sources" give you the kind of info you're looking for. It's a little verbose, but I don't do see anything that's directly accessible. Otherwise, you have "maintenance print psymbols PSYMS" that also gives you something you can use, but it's printed on a separate file, and contains even more info. That's all I can think of for now. -- Joel