* [PATCH] readelf: Always initialize .debug_addr unit_length, even without a header.
@ 2018-06-05 21:23 Mark Wielaard
2018-06-08 10:09 ` Mark Wielaard
0 siblings, 1 reply; 2+ messages in thread
From: Mark Wielaard @ 2018-06-05 21:23 UTC (permalink / raw)
To: elfutils-devel; +Cc: Mark Wielaard
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>
---
src/ChangeLog | 5 +++++
src/readelf.c | 7 ++-----
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/src/ChangeLog b/src/ChangeLog
index ec07bb1..b213c91 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 eaeb70c..d2c65fd 100644
--- a/src/readelf.c
+++ b/src/readelf.c
@@ -5149,10 +5149,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;
@@ -5163,7 +5160,6 @@ print_debug_addr_section (Dwfl_Module *dwflmod __attribute__ ((unused)),
PRIx64, off);
next_unitp = readendp;
}
- unit_length = (uint64_t) (next_unitp - readp);
}
else
{
@@ -5186,6 +5182,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");
--
1.8.3.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] readelf: Always initialize .debug_addr unit_length, even without a header.
2018-06-05 21:23 [PATCH] readelf: Always initialize .debug_addr unit_length, even without a header Mark Wielaard
@ 2018-06-08 10:09 ` Mark Wielaard
0 siblings, 0 replies; 2+ messages in thread
From: Mark Wielaard @ 2018-06-08 10:09 UTC (permalink / raw)
To: elfutils-devel
On Tue, 2018-06-05 at 23:23 +0200, Mark Wielaard wrote:
> 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).
Pushed to master.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-06-08 10:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-05 21:23 [PATCH] readelf: Always initialize .debug_addr unit_length, even without a header Mark Wielaard
2018-06-08 10:09 ` Mark Wielaard
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).