From: Joel Brobecker <brobecker@adacore.com>
To: Brendan Miller <catphive@catphive.net>
Cc: gdb@sourceware.org
Subject: Re: Fwd: how to determine location of source?
Date: Tue, 03 Mar 2009 02:39:00 -0000 [thread overview]
Message-ID: <20090303023858.GQ3632@adacore.com> (raw)
In-Reply-To: <ef38762f0903021821u4b354726l602dad30e5ff3206@mail.gmail.com>
> 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
next prev parent reply other threads:[~2009-03-03 2:39 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-03 0:57 Brendan Miller
2009-03-03 1:05 ` Joel Brobecker
[not found] ` <ef38762f0903021735v54143dd4ga38ed350616357a2@mail.gmail.com>
2009-03-03 1:39 ` Fwd: " Brendan Miller
2009-03-03 1:52 ` Joel Brobecker
2009-03-03 2:22 ` Brendan Miller
2009-03-03 2:39 ` Joel Brobecker [this message]
[not found] ` <ef38762f0903021927oe1429aakef0d6971ef9be5@mail.gmail.com>
2009-03-03 3:27 ` Fwd: " Brendan Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090303023858.GQ3632@adacore.com \
--to=brobecker@adacore.com \
--cc=catphive@catphive.net \
--cc=gdb@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox