From: Andrew Stubbs <ams@codesourcery.com>
To: gdb@sourceware.org
Subject: Re: debug problem with prelinked libraries
Date: Wed, 05 May 2010 14:59:00 -0000 [thread overview]
Message-ID: <4BE187D8.4050804@codesourcery.com> (raw)
In-Reply-To: <20100505143213.GA4735@caradoc.them.org>
On 05/05/10 15:32, Daniel Jacobowitz wrote:
> On Wed, May 05, 2010 at 01:48:21PM +0100, Andrew Stubbs wrote:
>> Hi all,
>>
>> I'm trying to get to the bottom of a problem debugging prelinked
>> libraries. I've fixed a few aspects of the problem, but the further I
>> get into it the more I think I must be missing something. I mean,
>> debugging prelinked libraries is supposed to Just Work, right? But I
>> can't see how it could ever have worked.
>
> It definitely works. GDB is even supposed to automatically handle
> libraries that are prelinked to a different location on disk than they
> were at runtime, although that's relatively recent, IIRC.
Yes, I see messages about it fixing these up (libc is different, but the
interesting libraries are not).
>> Upon closer inspection, I find that the psymtab has the textlow and
>> texthigh addresses as the original file-offsets, before relocation.
>> This appears to be because it calculates the section offset as the
>> difference between the actual address and the ELF VMA, but the file
>> is prelinked, so the offset is zero, and the debug info and symbols
>> are then not relocated.
>
> What do you mean by "before relocation"?
The textlow and texthigh values get set to small values, such as 0x6c0,
rather than the run-time relocated values, which are rather larger
numbers. The numbers can be corrected by adding the correct offset.
> Are the libraries used to create the core dump prelinked in exactly
> the same way as the libraries on the host during debug, or not? It
> should work either way, but they're different cases.
They are the exact same binaries. I copied them to the target myself.
> If both libraries are identically prelinked, then I would have
> expected the prelinked libraries to not require relocation. prelink
> includes code to manipulate the contents of the debug info.
Hmmm, well maybe that's it then. Maybe prelink has failed to relocate
the debug info in this case?
> I don't know if prelink follows things across to separate debug info
> files. It doesn't look like it. So if you have that, too, then the
> separate debug info file should be treated as a not-prelinked copy of
> the shared library.
The debug info is not separated, in this case.
Andrew
next prev parent reply other threads:[~2010-05-05 14:59 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-05 12:48 Andrew Stubbs
2010-05-05 14:35 ` Daniel Jacobowitz
2010-05-05 14:59 ` Andrew Stubbs [this message]
2010-05-07 13:23 ` Jan Kratochvil
2010-05-07 13:26 ` Andrew Stubbs
2010-07-01 15:43 ` Thomas Schwinge
2010-07-06 9:59 ` MIPS: 64-bit DWARF (was: debug problem with prelinked libraries) Thomas Schwinge
2010-07-14 8:50 ` MIPS: 64-bit DWARF Thomas Schwinge
2010-07-14 16:56 ` David Daney
2010-07-14 18:44 ` Maciej W. Rozycki
2010-07-15 15:48 ` Tom Tromey
2010-07-16 14:44 ` Maciej W. Rozycki
2010-07-21 22:54 ` Joseph S. Myers
2010-07-22 5:28 ` Tom Tromey
2010-07-16 11:22 ` Thomas Schwinge
2010-07-19 20:00 ` Richard Sandiford
2010-07-22 7:41 ` Thomas Schwinge
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=4BE187D8.4050804@codesourcery.com \
--to=ams@codesourcery.com \
--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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).