When displaying ranges, ignore duplicate offsets.
authorAndrew Burgess <andrew.burgess@embecosm.com>
Wed, 29 Apr 2020 16:21:10 +0000 (17:21 +0100)
committerNick Clifton <nickc@redhat.com>
Wed, 29 Apr 2020 16:21:10 +0000 (17:21 +0100)
* dwarf.c (display_debug_ranges): Ignore duplicate entries in
range_entries for the same offset.

binutils/ChangeLog
binutils/dwarf.c

index 048a9721a2583fe930946f555c58d8e6c16d882c..64fdaea649265798c8a4fd0dcd045c565f437516 100644 (file)
@@ -1,3 +1,8 @@
+2020-04-29  Andrew Burgess  <andrew.burgess@embecosm.com>
+
+       * dwarf.c (display_debug_ranges): Ignore duplicate entries in
+       range_entries for the same offset.
+
 2020-04-29  Nick Clifton  <nickc@redhat.com>
 
        * readelf.c (warn): New function - like elfcomm.c version but only
index 675b4d016fd0777af4dc8a05424f8190d9d32a74..eb053ce1f15676d73647bab8879c0e49524da72e 100644 (file)
@@ -6923,6 +6923,7 @@ display_debug_ranges (struct dwarf_section *section,
   int is_rnglists = strstr (section->name, "debug_rnglists") != NULL;
   /* Initialize it due to a false compiler warning.  */
   unsigned char address_size = 0;
+  dwarf_vma last_offset = 0;
 
   if (bytes == 0)
     {
@@ -7078,6 +7079,15 @@ display_debug_ranges (struct dwarf_section *section,
          continue;
        }
 
+      /* If multiple DWARF entities reference the same range then we will
+         have multiple entries in the `range_entries' list for the same
+         offset.  Thanks to the sort above these will all be consecutive in
+         the `range_entries' list, so we can easily ignore duplicates
+         here.  */
+      if (i > 0 && last_offset == offset)
+        continue;
+      last_offset = offset;
+
       if (dwarf_check != 0 && i > 0)
        {
          if (start < next)
This page took 0.027415 seconds and 4 git commands to generate.