public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] readelf: base address entry can be first
@ 2020-09-01 21:48 Mark Wielaard
  2020-09-07  8:29 ` Mark Wielaard
  0 siblings, 1 reply; 2+ messages in thread
From: Mark Wielaard @ 2020-09-01 21:48 UTC (permalink / raw)
  To: elfutils-devel; +Cc: Mark Wielaard

In both debug_ranges and debug_loc a base address entry can be the
first in the range or loc list. If so print the offset and set first
to false. Otherwise don't print the entry list offset, but do set
first to false.

Signed-off-by: Mark Wielaard <mark@klomp.org>
---
 src/ChangeLog |  6 ++++++
 src/readelf.c | 16 ++++++++++++++--
 2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/src/ChangeLog b/src/ChangeLog
index 8eb2103d..01386af2 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,9 @@
+2020-09-01  Mark Wielaard  <mark@klomp.org>
+
+	* readelf.c (print_debug_ranges_section): Base address entry can
+	be first.
+	(print_debug_loc_section): Likewise.
+
 2020-08-26  Mark Wielaard  <mark@klomp.org>
 
 	* readelf.c (print_debug_line_section): It is not an error if there
diff --git a/src/readelf.c b/src/readelf.c
index 41933d95..dd6e28af 100644
--- a/src/readelf.c
+++ b/src/readelf.c
@@ -6045,10 +6045,16 @@ print_debug_ranges_section (Dwfl_Module *dwflmod,
 
       if (begin == (Dwarf_Addr) -1l) /* Base address entry.  */
 	{
-	  printf (gettext (" [%6tx] base address\n          "), offset);
+	  if (first)
+	    printf (" [%6tx] ", offset);
+	  else
+	    printf ("          ");
+	  puts (gettext ("base address"));
+	  printf ("          ");
 	  print_dwarf_addr (dwflmod, address_size, end, end);
 	  printf ("\n");
 	  base = end;
+	  first = false;
 	}
       else if (begin == 0 && end == 0) /* End of list entry.  */
 	{
@@ -9615,10 +9621,16 @@ print_debug_loc_section (Dwfl_Module *dwflmod,
 
       if (begin == (Dwarf_Addr) -1l) /* Base address entry.  */
 	{
-	  printf (gettext (" [%6tx] base address\n          "), offset);
+	  if (first)
+	    printf (" [%6tx] ", offset);
+	  else
+	    printf ("          ");
+	  puts (gettext ("base address"));
+	  printf ("          ");
 	  print_dwarf_addr (dwflmod, address_size, end, end);
 	  printf ("\n");
 	  base = end;
+	  first = false;
 	}
       else if (begin == 0 && end == 0) /* End of list entry.  */
 	{
-- 
2.18.4


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] readelf: base address entry can be first
  2020-09-01 21:48 [PATCH] readelf: base address entry can be first Mark Wielaard
@ 2020-09-07  8:29 ` Mark Wielaard
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Wielaard @ 2020-09-07  8:29 UTC (permalink / raw)
  To: elfutils-devel

On Tue, 2020-09-01 at 23:48 +0200, Mark Wielaard wrote:
> In both debug_ranges and debug_loc a base address entry can be the
> first in the range or loc list. If so print the offset and set first
> to false. Otherwise don't print the entry list offset, but do set
> first to false.

Pushed.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-09-07  8:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-01 21:48 [PATCH] readelf: base address entry can be first Mark Wielaard
2020-09-07  8:29 ` 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).