]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
readelf: base address entry can be first
authorMark Wielaard <mark@klomp.org>
Tue, 1 Sep 2020 21:32:09 +0000 (23:32 +0200)
committerMark Wielaard <mark@klomp.org>
Mon, 7 Sep 2020 08:07:45 +0000 (10:07 +0200)
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
src/readelf.c

index e37f3587144cb5688bacc0a14cbc3c87bdae69ef..8a64a15e3fd285a7146ffe21dd70ded3e93c13ce 100644 (file)
@@ -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-09-04  Mark Wielaard  <mark@klomp.org>
 
        * elflint.c (special_sections): Add .debug_line_str.
index 41933d9538d4e2f36faaa7fbbee19735e6c10f09..dd6e28af16783783becd5efa24b71a7a9cd12c1a 100644 (file)
@@ -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.  */
        {