This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
RFA: readelf: Print offset of each DWARF line number program header
- From: Jim Blandy <jimb at codesourcery dot com>
- To: binutils at sourceware dot org
- Date: Tue, 02 Oct 2007 13:49:40 -0700
- Subject: RFA: readelf: Print offset of each DWARF line number program header
This allows you to find a compilation unit's line number information
by searching the output of 'readelf -wl' for the value of the
DW_AT_stmt_list attribute.
Okay to commit?
binutils/ChangeLog:
2007-10-02 Jim Blandy <jimb@codesourcery.com>
* dwarf.c (display_debug_lines): Print the offset of each line
number program header.
Index: binutils/dwarf.c
===================================================================
RCS file: /cvs/src/src/binutils/dwarf.c,v
retrieving revision 1.15
diff -u -r1.15 dwarf.c
--- binutils/dwarf.c 5 Jul 2007 16:54:45 -0000 1.15
+++ binutils/dwarf.c 2 Oct 2007 20:46:14 -0000
@@ -1821,11 +1821,13 @@
unsigned char *standard_opcodes;
unsigned char *end_of_sequence;
unsigned char *hdrptr;
+ unsigned long hdroff;
int initial_length_size;
int offset_size;
int i;
hdrptr = data;
+ hdroff = hdrptr - start;
/* Check the length of the block. */
info.li_length = byte_get (hdrptr, 4);
@@ -1878,6 +1880,7 @@
info.li_line_base <<= 24;
info.li_line_base >>= 24;
+ printf (_(" Offset: 0x%lx\n"), hdroff);
printf (_(" Length: %ld\n"), info.li_length);
printf (_(" DWARF Version: %d\n"), info.li_version);
printf (_(" Prologue Length: %d\n"), info.li_prologue_length);