This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: decl_file
Hi Vijay,
> Does the latest readelf display the source file information when
> dumping debug_info section ?
No.
> When I dump debug_line from a static executable using readelf, I see
> multiple File Name Table entries (one per CU) and how to map the
> "DW_AT_decl_file" attribute in the dwarf to a file in file name table ?
This is really a GDB question, but here goes.
Short answer: Use the DW_AT_stmt_list attribute to locate the associated
file table.
Long answer: From the DWARF 4 specification:
2.14 Declaration Coordinates
It is sometimes useful in a debugger to be able to associate
a declaration with its occurrence in the program source.
Any debugging information entry representing the declaration
of an object, module, subprogram or type may have DW_AT_decl_file,
DW_AT_decl_line and DW_AT_decl_column attributes each of whose
value is an unsigned integer constant.
The value of the DW_AT_decl_file attribute corresponds to a
file number from the line number information table for the
compilation unit containing the debugging information entry and
represents the source file in which the declaration appeared
(see Section 6.2).
Then:
6.2 Line Number Information
Line number information generated for a compilation unit is
represented in the .debug_line section of an object file and
is referenced by a corresponding compilation unit debugging
information entry (see Section 3.1.1) in the .debug_info section.
On to the next link:
3.1.1 Normal and Partial Compilation Unit Entries
A normal compilation unit is represented by a debugging
information entry with the tag DW_TAG_compile_unit. A partial
compilation unit is represented by a debugging information
entry with the tag DW_TAG_partial_unit.
Scroll down to:
4. A DW_AT_stmt_list attribute whose value is a section
offset to the line number information for this compilation
unit.
This information is placed in a separate object file
section from the debugging information entries themselves.
The value of the statement list attribute is the offset
in the .debug_line section of the first byte of the line
number information for this compilation unit (see Section 6.2).
There you go.
Cheers
Nick