Improve the speed of the --dwarf-start option by skipping processing of any comp...
authorNick Clifton <nickc@redhat.com>
Tue, 10 Oct 2017 12:37:58 +0000 (13:37 +0100)
committerNick Clifton <nickc@redhat.com>
Tue, 10 Oct 2017 12:37:58 +0000 (13:37 +0100)
PR 22249
* dwarf.c (process_debug_info): Skip any comp unit that ends
before dwarf_start_die.

binutils/ChangeLog
binutils/dwarf.c

index ca4990ea077840ae797ba45b0b48e8fc3bb0eb7e..9f2e5f0a61c4d2295019874795de49c0acf5fba6 100644 (file)
@@ -1,3 +1,9 @@
+2017-10-10  Tom Tromey  <tromey@sourceware.org>
+
+       PR 22249
+       * dwarf.c (process_debug_info): Skip any comp unit that ends
+       before dwarf_start_die.
+
 2017-10-06  Alan Modra  <amodra@gmail.com>
 
        * dwarf.c (process_debug_info): Consolidate header length checks.
index 91f95ff06824a975da4f645bd482081bf35e47d6..2506d533b690ebfc001df24238a8fae695dbbfa2 100644 (file)
@@ -2667,6 +2667,14 @@ process_debug_info (struct dwarf_section *section,
          SAFE_BYTE_GET_AND_INC (type_offset, hdrptr, offset_size, end);
        }
 
+      if (dwarf_start_die > (cu_offset + compunit.cu_length
+                            + initial_length_size))
+       {
+         start = section_begin + cu_offset + compunit.cu_length
+           + initial_length_size;
+         continue;
+       }
+
       if ((do_loc || do_debug_loc || do_debug_ranges)
          && num_debug_info_entries == 0
          && ! do_types)