[patch] Add printing of .gdb_index section to readelf

Mark Wielaard mjw at redhat.com
Thu Apr 14 22:35:44 UTC 2011


Hi,

In Fedora 15 debuginfo files have a new section .gdb_index.
This patch adds support for printing it out with readelf.

2011-04-14  Mark Wielaard  <mjw at redhat.com>

    * readelf.c (options): Add gdb_index.
    (section_e): Define section_gdb_index.
    (parse_opt): Recognize gdb_index debug-dump argument.
    (print_gdb_index_section): New function.
    (print_debug): Add gdb_index to debug_sections.

Sample output looks like:

GDB section [34] '.gdb_index' at offset 0x722c contains 9235 bytes :
 Version:         4
 CU offset:       0x18
 TU offset:       0x58
 address offset:  0x58
 symbol offset:   0xbc
 constant offset: 0x20bc

 CU list at offset 0x18 contains 4 entries:
 [   0] start: 00000000, length:  5022
 [   1] start: 0x00139e, length:  3166
 [   2] start: 0x001ffc, length:  1320
 [   3] start: 0x002524, length:  1529

 TU list at offset 0x58 contains 0 entries:

 Address list at offset 0x58 contains 5 entries:
 [   0] 0x0000000008048ad0 <main>..0x0000000008048d94 <main+0x2c4>, CU index:     0
 [   1] 0x0000000008048e50 <create_regexp>..0x0000000008049ad8 <jargrep+0x998>, CU index:     0
 [   2] 0x0000000008049ae0 <report_str_error>..0x000000000804a9fa <inflate_string+0x25a>, CU index:     1
 [   3] 0x000000000804aa10 <pb_init>..0x000000000804ac29 <pb_read+0x149>, CU index:     2
 [   4] 0x000000000804ac30 <shift_up>..0x000000000804aff3 <shift_down+0x1f3>, CU index:     3

 Symbol table at offset 0x58 contains 1024 slots:
 [   2] symbol: free_func, CUs: 1
 [   5] symbol: size_t, CUs: 0
 [   9] symbol: option, CUs: 0
 [  12] symbol: compress_file, CUs: 1
 [  42] symbol: pb_read, CUs: 2
 [  52] symbol: short unsigned int, CUs: 0
 [  68] symbol: unsigned char, CUs: 0
 [  78] symbol: _IO_FILE, CUs: 0
[...]

Does this look OK to add?

Patch attached and on the mjw/gdb_index git branch.

Thanks,

Mark
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gdb_index.patch
Type: text/x-patch
Size: 7823 bytes
Desc: not available
Url : https://fedorahosted.org/pipermail/elfutils-devel/attachments/20110415/6c1f2d66/attachment.bin 


More information about the elfutils-devel mailing list