[binutils-gdb] readelf: Fix output of rnglists section

Nick Clifton nickc@sourceware.org
Wed Nov 11 14:32:10 GMT 2020


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=4d93271533473d65165022ee9f82c368511ce82a

commit 4d93271533473d65165022ee9f82c368511ce82a
Author: Bernd Edlinger <bernd.edlinger@hotmail.de>
Date:   Wed Nov 11 14:31:46 2020 +0000

    readelf: Fix output of rnglists section
    
            * dwarf.c (display_debug_rnglists_list): Only bias the
            DW_RLS_offset_pair with the base address.

Diff:
---
 binutils/ChangeLog |  5 +++++
 binutils/dwarf.c   | 11 +++++++++--
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 09b7dafb5bc..44192460cb6 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -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.
diff --git a/binutils/dwarf.c b/binutils/dwarf.c
index cf68ebaff7d..c454d058b22 100644
--- a/binutils/dwarf.c
+++ b/binutils/dwarf.c
@@ -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);


More information about the Binutils-cvs mailing list