ELF phdrs in .debug files

Nick Clifton nickc@redhat.com
Tue May 22 10:21:00 GMT 2007


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.

   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 ?

   (By the way, does GDB work with a stripped executable which has had 
its section headers removed, but its program headers left in tact ?  Can 
GDB use a debug-info file connected with such an executable ?)

   So we have a issue about the purpose of program headers - are they 
meaningful in a file which is not an executable ?  We also have an issue 
with the bfd library and how it goes about creating a debug-only file. 
(There is also a third issue that including the program headers in a 
debug-info file can substantially increase its size.  We may just have 
to grin and bear this however).

   As far as the program headers in debug-info files debate goes I think 
that there are three arguments for including them:

   1. They are needed by the elfutils.

   2. The elfutils were the first tools to create debug-info files and 
so they have the right to define their format, including the presence of 
program headers.

   3. The debug-info file is theoretically part of an executable, it has 
just been separated out into a separate file for performance reasons. 
Hence it should still have a program header.

On the other side we have:

   1. The debug-info file is not a program, so it should not have a 
program header.

   2. There is no formal specification for the structure of debug-info 
files, so including the program headers is not a requirement.  No-one 
owns the format, so it is allowed to grow by consensual debate.

There is also the practical problem that the binutils may not be able to 
always generate accurate program headers in debug-info files even if it 
wanted to.  This is a programming issue, not an excuse, but it may well 
be the most serious stumbling block.

Is this a fair assessment of the debate so far ?

Cheers
   Nick



More information about the Binutils mailing list