This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: ELF phdrs in .debug files


On Tue, May 22, 2007 at 11:21:40AM +0100, Nick Clifton wrote:
> Hi Alan, Hi Roland,
> 
>   OK, lets see if I understand this correctly.  The underlying issue is how to 
> correlate addresses in a debug-info file with addresses in its corresponding 
> stripped executable.  GDB does this by using the ELF section headers, whereas 
> the elfutils uses the ELF program headers. There is a problem for binutils 
> however in that including accurate program headers in a debug-info file has 
> proved to be difficult.

I suspect that, had I thought of it, GDB would use the program headers
also.  GDB didn't used to need this reconcilliation between the two
debug files; it only needs it for elfutils.  It might need it for
prelinked support too, but I'm not sure how well that works today.

Elfutils's output files have an, in my opinion, somewhat bizarre
property.  The symbol table is left in the unstripped file and the
stripped file gets only NOBITS copy, so GDB ends up associating the
symbols from .symtab with one file and the symbols from .debug_info
with another.  Objcopy puts the symtab in the --only-keep-debug output
file.

>   Roland - I assume that it is unlikely that the elfutils could/would be 
> modified to use the section header information if the program header 
> information is unavailable.  Is this correct ?

If I'm following the discussion correctly the program headers allow
reconciliation between the two files to be done accurately.  There's
no reliable way to match sections from two files if they don't have
the same base address.  Right now GDB uses offset from the start
address to handle prelinked files, but I imagine this breaks for
prelinked shared libraries.

-- 
Daniel Jacobowitz
CodeSourcery


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]