From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17566 invoked by alias); 3 Mar 2009 02:39:08 -0000 Received: (qmail 17556 invoked by uid 22791); 3 Mar 2009 02:39:07 -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 02:39:02 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 325642BAAEB; Mon, 2 Mar 2009 21:39:04 -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 kcfaxW8+iU+3; Mon, 2 Mar 2009 21:39:04 -0500 (EST) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id ECFCD2BAAEA; Mon, 2 Mar 2009 21:39:03 -0500 (EST) Received: by joel.gnat.com (Postfix, from userid 1000) id 8B481E7ACD; Mon, 2 Mar 2009 18:38:58 -0800 (PST) Date: Tue, 03 Mar 2009 02:39:00 -0000 From: Joel Brobecker To: Brendan Miller Cc: gdb@sourceware.org Subject: Re: Fwd: how to determine location of source? Message-ID: <20090303023858.GQ3632@adacore.com> References: <20090303010451.GM3632@adacore.com> <20090303015239.GO3632@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/msg00016.txt.bz2 > 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 This is of course not standardized, so any combination of comp_dir/name can happen, but this is what GCC does as far as I know. The DWARF dumper will give you that info. -- Joel