diff options
author | Mark Wielaard <mark@klomp.org> | 2018-06-05 23:21:05 +0200 |
---|---|---|
committer | Mark Wielaard <mark@klomp.org> | 2018-06-08 12:03:14 +0200 |
commit | a3b15251cdb68e225dc4e0433984784b7a6592d5 (patch) | |
tree | de20a801089153cf8f855b1de6c820c5b0d3ba27 /src | |
parent | 090ef3e03c884d4d936129c4cffaa73cd57d4c7f (diff) | |
download | elfutils-a3b15251cdb68e225dc4e0433984784b7a6592d5.tar.gz |
readelf: Always initialize .debug_addr unit_length, even without a header.
We would print a "fake" .debug_addr header, but didn't always setup the
unit_length (in case there was a mix of GNU DebugFission and DWARF5 tables).
Make sure to always set the unit_length (we do always calculate the next
unit offset already).
Signed-off-by: Mark Wielaard <mark@klomp.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/ChangeLog | 5 | ||||
-rw-r--r-- | src/readelf.c | 7 |
2 files changed, 7 insertions, 5 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index c0ac4181..cdc47205 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,10 @@ 2018-06-05 Mark Wielaard <mark@klomp.org> + * readelf.c (print_debug_addr_section): Set unit_length always to + (next_unitp - readp) in case we don't have a real header. + +2018-06-05 Mark Wielaard <mark@klomp.org> + * readelf.c (print_debug_loc_section): Set begin to idx when failing to read the start address if DW_LLE_GNU_start_end_entry. diff --git a/src/readelf.c b/src/readelf.c index 68a664d5..eac5eac4 100644 --- a/src/readelf.c +++ b/src/readelf.c @@ -5178,10 +5178,7 @@ print_debug_addr_section (Dwfl_Module *dwflmod __attribute__ ((unused)), /* The addresses start here, but where do they end? */ listptr = get_listptr (&known_addrbases, idx); if (listptr == NULL) - { - next_unitp = readendp; - unit_length = (uint64_t) (next_unitp - readp); - } + next_unitp = readendp; else if (listptr->cu->version < 5) { next_unitp = start + listptr->offset; @@ -5192,7 +5189,6 @@ print_debug_addr_section (Dwfl_Module *dwflmod __attribute__ ((unused)), PRIx64, off); next_unitp = readendp; } - unit_length = (uint64_t) (next_unitp - readp); } else { @@ -5215,6 +5211,7 @@ print_debug_addr_section (Dwfl_Module *dwflmod __attribute__ ((unused)), next_unitp = readendp; } } + unit_length = (uint64_t) (next_unitp - readp); /* Pretend we have a header. */ printf ("\n"); |