This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils 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]

Various eu-readelf --debug-dump improvements


While working on the DWARF5 support I found various cases where the
eu-readelf --debug-dump could be improved to provide a bit more information
that helped debug issues. The following changes are not DWARF5 specific,
but improve the --debug-dump output to make a more useful (IMHO).

[PATCH 1/5] readelf: Adjust print_ops formatting.

This simply makes the DWARF expressions a little more compact and the
indenting a bit more consistent. In particular it only uses two space
for the operand index (the max I found in the wild was 64, so reserving
4 spaces for possibly 9999 indexes seemed excessive.

[PATCH 2/5] readelf: Print abbrev code for DIE with --debug-dump=info.

This was really convenient when there seemed something wrong with
the DIE information. It is also helpful to see how many DIEs share
a particular abbrev. The output is now:

 [    29]    base_type            abbrev: 74
             byte_size            (data1) 8
             encoding             (data1) unsigned (7)
             name                 (strp) "long unsigned int"

So you can easily lookup the corresponding abbrev with --debug-dump=abbrev

 [   74] offset: 1019, children: no, tag: base_type
          attr: byte_size, form: data1, offset: 0x3fb
          attr: encoding, form: data1, offset: 0x3fd
          attr: name, form: strp, offset: 0x3ff

And note that almost all base_types share the same abbrev code.

[PATCH 3/5] readelf: Print actual file for decl_file and call_file.

This was very helpful to understand where something was really defined.
It simply resolves the file number from the stmt list, so you don't
have to do that by hand anymore. New output:

 [    4c]    typedef              abbrev: 26
             name                 (strp) "size_t"
             decl_file            (data1) stddef.h (13)
             decl_line            (data1) 216
             decl_column          (data1) 23
             type                 (ref4) [    29]

[PATCH 4/5] readelf: Print CU, base address and unresolved .debug_ranges.

We helpfully resolve the addresses to actual symbol+offsets whenever
possible, but this kind of obscured what the actual encoding was. And
it made the output a bit messy because addresses didn't line up. It now
also prints out the associated CU and the base address to the range list.

 CU [ 3582e] base: 0x000000000041de70 <ebl_machine_flag_name>
 [  c370] range 2a, 6a
          0x000000000041de9a <ebl_machine_flag_name+0x2a>..
          0x000000000041ded9 <ebl_machine_flag_name+0x69>
          range 80, e5
          0x000000000041def0 <ebl_machine_flag_name+0x80>..
          0x000000000041df54 <ebl_machine_flag_name+0xe4>
          range f8, 11a
          0x000000000041df68 <ebl_machine_flag_name+0xf8>..
          0x000000000041df89 <ebl_machine_flag_name+0x119>
 [  c3b0] range 91, 9f
          0x000000000041df01 <ebl_machine_flag_name+0x91>..
          0x000000000041df0e <ebl_machine_flag_name+0x9e>
          range a3, a6
          0x000000000041df13 <ebl_machine_flag_name+0xa3>..
          0x000000000041df15 <ebl_machine_flag_name+0xa5>

[PATCH 5/5] readelf: Print CU, base address and unresolved .debug_loc.

Like the .debug_ranges change, but including location list entries.
The new output is (IMHO) a big improvement:

CU [ 4a404] base: 0x000000000041f350 <__popcountdi2>
 [ 3c3e2] range 0, 24
          0x000000000041f350 <__popcountdi2>..
          0x000000000041f373 <__popcountdi2+0x23>
           [ 0] reg5
          range 24, 2b
          0x000000000041f374 <__popcountdi2+0x24>..
          0x000000000041f37a <__popcountdi2+0x2a>
           [ 0] reg5
          range 2b, 2e
          0x000000000041f37b <__popcountdi2+0x2b>..
          0x000000000041f37d <__popcountdi2+0x2d>
           [ 0] reg0
          range 2e, 3e
          0x000000000041f37e <__popcountdi2+0x2e>..
          0x000000000041f38d <__popcountdi2+0x3d>
           [ 0] GNU_entry_value:
                [ 0] reg5
           [ 3] GNU_entry_value:
                [ 0] reg5
           [ 6] lit1
           [ 7] shr
           [ 8] constu 6148914691236517205
           [18] and
           [19] minus
           [20] stack_value
          range 3e, 48
          0x000000000041f38e <__popcountdi2+0x3e>..
          0x000000000041f397 <__popcountdi2+0x47>
           [ 0] reg5
          range 48, 4b
          0x000000000041f398 <__popcountdi2+0x48>..
          0x000000000041f39a <__popcountdi2+0x4a>
           [ 0] breg0 0
           [ 2] constu 1085102592571150095
           [12] and
           [13] stack_value
          range 4b, 59
          0x000000000041f39b <__popcountdi2+0x4b>..
          0x000000000041f3a8 <__popcountdi2+0x58>
           [ 0] reg0
          range 59, 5e
          0x000000000041f3a9 <__popcountdi2+0x59>..
          0x000000000041f3ad <__popcountdi2+0x5d>
           [ 0] breg5 0
           [ 2] lit4
           [ 3] shr
           [ 4] breg5 0
           [ 6] plus
           [ 7] constu 1085102592571150095
           [17] and
           [18] stack_value


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