readelf: Fix output of rnglists section
authorBernd Edlinger <bernd.edlinger@hotmail.de>
Wed, 11 Nov 2020 14:31:46 +0000 (14:31 +0000)
committerNick Clifton <nickc@redhat.com>
Wed, 11 Nov 2020 14:31:46 +0000 (14:31 +0000)
* dwarf.c (display_debug_rnglists_list): Only bias the
DW_RLS_offset_pair with the base address.

binutils/ChangeLog
binutils/dwarf.c

index 09b7dafb5bc5a7a0aa687adb17c611af008511f9..44192460cb6f5dd5bf3a344642a0e7704113e218 100644 (file)
@@ -1,3 +1,8 @@
+2020-11-11  Bernd Edlinger  <bernd.edlinger@hotmail.de>
+
+       * dwarf.c (display_debug_rnglists_list): Only bias the
+       DW_RLS_offset_pair with the base address.
+
 2020-11-10  Nick Clifton  <nickc@redhat.com>
 
        * dwarf.c (skip_attr_bytes): Correctly handle DW_FORM_ref8.
index cf68ebaff7d289d61ce2a2864162b8a58a34af6f..c454d058b22a190930caeab892c5b0d0e32e9b43 100644 (file)
@@ -7532,8 +7532,15 @@ display_debug_rnglists_list (unsigned char *start, unsigned char *finish,
       if (rlet == DW_RLE_base_address)
        continue;
 
-      print_dwarf_vma (begin + base_address, pointer_size);
-      print_dwarf_vma (end + base_address, pointer_size);
+      /* Only a DW_RLE_offset_pair needs the base address added.  */
+      if (rlet == DW_RLE_offset_pair)
+       {
+         begin += base_address;
+         end += base_address;
+       }
+
+      print_dwarf_vma (begin, pointer_size);
+      print_dwarf_vma (end, pointer_size);
 
       if (begin == end)
        fputs (_("(start == end)"), stdout);