This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFA 1/5] Skip entire CU if it comes before dwarf_start_die


Currently, when investigating a very large .debug_info using
objdump --dwarf-start, objdump will still read every DIE.  However, it
would be faster to skip entire CUs until the starting DIE appears.  That
is what this patch implements.  This is PR binutils/22249.

2017-10-06  Tom Tromey  <tom@tromey.com>

	PR binutils/22249:
	* dwarf.c (process_debug_info): Skip entire CU if it does not
	contain dwarf_start_die.
---
 binutils/ChangeLog |  6 ++++++
 binutils/dwarf.c   | 11 +++++++++++
 2 files changed, 17 insertions(+)

diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index ca4990e..4a470b2 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,9 @@
+2017-10-06  Tom Tromey  <tom@tromey.com>
+
+	PR binutils/22249:
+	* dwarf.c (process_debug_info): Skip entire CU if it does not
+	contain dwarf_start_die.
+
 2017-10-06  Alan Modra  <amodra@gmail.com>
 
 	* dwarf.c (process_debug_info): Consolidate header length checks.
diff --git a/binutils/dwarf.c b/binutils/dwarf.c
index 91f95ff..cb8a4c2 100644
--- a/binutils/dwarf.c
+++ b/binutils/dwarf.c
@@ -2667,6 +2667,17 @@ process_debug_info (struct dwarf_section *section,
 	  SAFE_BYTE_GET_AND_INC (type_offset, hdrptr, offset_size, end);
 	}
 
+      /* If --dwarf-start was given, and if this DIE does not appear
+	 in this CU, skip the entire CU.  This is important for
+	 inspecting very large files.  */
+      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)
-- 
2.9.5


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]