This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB 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]

[patch] dwarf2read.c: Don't read pc/line-number mapping for type units


Hi.

fyi, I'm checking this in.
Type units don't need the pc/line-number mapping,
and this can save a lot of space.
[There's still a fair bit of wasted space, but that's for another day.
This brings the amount down to a tolerable level.]

Joel: I'd also like to check this into the 7.4 branch.
IMO it's safe enough.

[btw, the cleanup handling of the line header here feels clumsy.
It's accomplished as a side-effect of handle_DW_AT_stmt_list.
It feels cleaner to let the caller decide how it wants to clean things up.
That is also left for another day.]

2012-01-09  Doug Evans  <dje@google.com>

	* dwarf2read.c (handle_DW_AT_stmt_list): Add function comment.
	New arg "want_line_info".  All callers updated.
	(read_file_scope,read_type_unit_scope): Move comment from
	handle_DW_AT_stmt_list to here.

Index: dwarf2read.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2read.c,v
retrieving revision 1.605
diff -u -p -r1.605 dwarf2read.c
--- dwarf2read.c	9 Jan 2012 17:40:05 -0000	1.605
+++ dwarf2read.c	10 Jan 2012 01:30:13 -0000
@@ -5521,19 +5521,19 @@ find_file_and_directory (struct die_info
     *name = "<unknown>";
 }
 
-/* Handle DW_AT_stmt_list for a compilation unit.  */
+/* Handle DW_AT_stmt_list for a compilation unit or type unit.
+   DIE is the DW_TAG_compile_unit or DW_TAG_type_unit die for CU.
+   COMP_DIR is the compilation directory.
+   WANT_LINE_INFO is non-zero if the pc/line-number mapping is needed.  */
 
 static void
 handle_DW_AT_stmt_list (struct die_info *die, struct dwarf2_cu *cu,
-			const char *comp_dir)
+			const char *comp_dir, int want_line_info)
 {
   struct attribute *attr;
   struct objfile *objfile = cu->objfile;
   bfd *abfd = objfile->obfd;
 
-  /* Decode line number information if present.  We do this before
-     processing child DIEs, so that the line header table is available
-     for DW_AT_decl_file.  */
   attr = dwarf2_attr (die, DW_AT_stmt_list, cu);
   if (attr)
     {
@@ -5545,7 +5545,8 @@ handle_DW_AT_stmt_list (struct die_info 
         {
           cu->line_header = line_header;
           make_cleanup (free_cu_line_header, cu);
-          dwarf_decode_lines (line_header, comp_dir, abfd, cu, NULL);
+	  if (want_line_info)
+	    dwarf_decode_lines (line_header, comp_dir, abfd, cu, NULL);
         }
     }
 }
@@ -5604,7 +5605,10 @@ read_file_scope (struct die_info *die, s
   record_debugformat ("DWARF 2");
   record_producer (cu->producer);
 
-  handle_DW_AT_stmt_list (die, cu, comp_dir);
+  /* Decode line number information if present.  We do this before
+     processing child DIEs, so that the line header table is available
+     for DW_AT_decl_file.  */
+  handle_DW_AT_stmt_list (die, cu, comp_dir, 1);
 
   /* Process all dies in compilation unit.  */
   if (die->child != NULL)
@@ -5707,7 +5711,11 @@ read_type_unit_scope (struct die_info *d
   record_debugformat ("DWARF 2");
   record_producer (cu->producer);
 
-  handle_DW_AT_stmt_list (die, cu, comp_dir);
+  /* Decode line number information if present.  We do this before
+     processing child DIEs, so that the line header table is available
+     for DW_AT_decl_file.
+     We don't need the pc/line-number mapping for type units.  */
+  handle_DW_AT_stmt_list (die, cu, comp_dir, 0);
 
   /* Process the dies in the type unit.  */
   if (die->child == NULL)


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