From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20315 invoked by alias); 3 Mar 2009 03:27:59 -0000 Received: (qmail 20303 invoked by uid 22791); 3 Mar 2009 03:27:59 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40 X-Spam-Check-By: sourceware.org Received: from mail-ew0-f179.google.com (HELO mail-ew0-f179.google.com) (209.85.219.179) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 03 Mar 2009 03:27:53 +0000 Received: by ewy27 with SMTP id 27so2086090ewy.24 for ; Mon, 02 Mar 2009 19:27:50 -0800 (PST) MIME-Version: 1.0 Received: by 10.210.36.8 with SMTP id j8mr5301071ebj.83.1236050870574; Mon, 02 Mar 2009 19:27:50 -0800 (PST) In-Reply-To: References: <20090303010451.GM3632@adacore.com> <20090303015239.GO3632@adacore.com> <20090303023858.GQ3632@adacore.com> Date: Tue, 03 Mar 2009 03:27:00 -0000 Message-ID: Subject: Fwd: Fwd: how to determine location of source? From: Brendan Miller To: gdb@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes 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/msg00018.txt.bz2 Er, sorry, I keep forgetting to hit reply to all. ---------- Forwarded message ---------- From: Brendan Miller Date: Mon, Mar 2, 2009 at 7:27 PM Subject: Re: Fwd: how to determine location of source? To: Joel Brobecker On Mon, Mar 2, 2009 at 6:38 PM, Joel Brobecker wrote: >> Hmm... info sources and maintenance print psymbols PSYMS gives me >> relative, not absolute paths. Maybe that's all that's encoded into my >> binaries > > Yes and no. I will assume that you are building on a target that > runs ELF binaries and that your debugging info is DWARF, but the > principles are the same regardless. > > Usually, what the compiler provides a debugging information is > one attribute that tells you the name of the directory from which > the compilation was done. Check out the DW_AT_comp_dir attribute, > and then one attribute that gives you the name of the source file > as it was given to GCC. > > /my/sources% gcc -c -g subdir/foo.c > > Will result in: > DW_AT_comp_dir = /my/sources > DW_AT_name = subdir/foo.c Ah, excellent, I was able to get at that information with readelf -w Brendan