This is the mail archive of the 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]

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?

2007-10-02  Jim Blandy  <>

	* 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);

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