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]

[commit] more dwarf2read.c cleanups


Hi.

More dwarf2read.c cleanups sitting in my tree.
Committed.

2013-03-28  Doug Evans  <dje@google.com>

	* dwarf2read.c (dw2_get_file_names): Delete arg "objfile".
	All callers updated.
	(dw2_print_stats): Print #read CUs too.
	(dump_die_shallow): Print signatured types better.

	testsuite/
	* gdb.base/maint.exp (maint print statistics): Update expected output.

Index: dwarf2read.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2read.c,v
retrieving revision 1.761
diff -u -p -r1.761 dwarf2read.c
--- dwarf2read.c	28 Mar 2013 22:59:47 -0000	1.761
+++ dwarf2read.c	29 Mar 2013 00:08:24 -0000
@@ -2937,8 +2937,7 @@ dw2_get_file_names_reader (const struct 
    table for THIS_CU.  */
 
 static struct quick_file_names *
-dw2_get_file_names (struct objfile *objfile,
-		    struct dwarf2_per_cu_data *this_cu)
+dw2_get_file_names (struct dwarf2_per_cu_data *this_cu)
 {
   /* For TUs this should only be called on the parent group.  */
   if (this_cu->is_debug_types)
@@ -3076,7 +3075,7 @@ dw2_map_symtabs_matching_filename (struc
       if (per_cu->v.quick->symtab)
 	continue;
 
-      file_data = dw2_get_file_names (objfile, per_cu);
+      file_data = dw2_get_file_names (per_cu);
       if (file_data == NULL)
 	continue;
 
@@ -3294,18 +3293,19 @@ dw2_lookup_symbol (struct objfile *objfi
 static void
 dw2_print_stats (struct objfile *objfile)
 {
-  int i, count;
+  int i, total, count;
 
   dw2_setup (objfile);
+  total = dwarf2_per_objfile->n_comp_units + dwarf2_per_objfile->n_type_units;
   count = 0;
-  for (i = 0; i < (dwarf2_per_objfile->n_comp_units
-		   + dwarf2_per_objfile->n_type_units); ++i)
+  for (i = 0; i < total; ++i)
     {
       struct dwarf2_per_cu_data *per_cu = dw2_get_cu (i);
 
       if (!per_cu->v.quick->symtab)
 	++count;
     }
+  printf_filtered (_("  Number of read CUs: %d\n"), total - count);
   printf_filtered (_("  Number of unread CUs: %d\n"), count);
 }
 
@@ -3386,7 +3386,7 @@ dw2_expand_symtabs_with_fullname (struct
       if (per_cu->v.quick->symtab)
 	continue;
 
-      file_data = dw2_get_file_names (objfile, per_cu);
+      file_data = dw2_get_file_names (per_cu);
       if (file_data == NULL)
 	continue;
 
@@ -3539,7 +3539,7 @@ dw2_expand_symtabs_matching
 	  if (per_cu->v.quick->symtab)
 	    continue;
 
-	  file_data = dw2_get_file_names (objfile, per_cu);
+	  file_data = dw2_get_file_names (per_cu);
 	  if (file_data == NULL)
 	    continue;
 
@@ -3743,7 +3743,7 @@ dw2_map_symbol_filenames (struct objfile
       if (per_cu->v.quick->symtab)
 	continue;
 
-      file_data = dw2_get_file_names (objfile, per_cu);
+      file_data = dw2_get_file_names (per_cu);
       if (file_data == NULL)
 	continue;
 
@@ -17256,10 +17256,16 @@ dump_die_shallow (struct ui_file *f, int
 	  break;
 	case DW_FORM_ref_sig8:
 	  if (DW_SIGNATURED_TYPE (&die->attrs[i]) != NULL)
-	    fprintf_unfiltered (f, "signatured type, offset: 0x%x",
-			 DW_SIGNATURED_TYPE (&die->attrs[i])->per_cu.offset.sect_off);
+	    {
+	      struct signatured_type *sig_type =
+		DW_SIGNATURED_TYPE (&die->attrs[i]);
+
+	      fprintf_unfiltered (f, "signatured type: 0x%s, offset 0x%x",
+				  hex_string (sig_type->signature),
+				  sig_type->per_cu.offset.sect_off);
+	    }
 	  else
-	    fprintf_unfiltered (f, "signatured type, offset: unknown");
+	    fprintf_unfiltered (f, "signatured type, unknown");
 	  break;
 	case DW_FORM_string:
 	case DW_FORM_strp:
Index: testsuite/gdb.base/maint.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/maint.exp,v
retrieving revision 1.62
diff -u -p -r1.62 maint.exp
--- testsuite/gdb.base/maint.exp	21 Mar 2013 17:37:29 -0000	1.62
+++ testsuite/gdb.base/maint.exp	29 Mar 2013 00:08:24 -0000
@@ -146,7 +146,7 @@ if [istarget "*-*-cygwin*"] {
 
 send_gdb "maint print statistics\n"
 gdb_expect  {
-    -re "Statistics for\[^\n\r\]*break\[^\n\r\]*:\r\n  Number of \"minimal\" symbols read: $decimal\r\n(  Number of \"partial\" symbols read: $decimal\r\n)?  Number of \"full\" symbols read: $decimal\r\n  Number of \"types\" defined: $decimal\r\n(  Number of psym tables \\(not yet expanded\\): $decimal\r\n)?(  Number of unread CUs: $decimal\r\n)?  Number of symbol tables: $decimal\r\n  Number of symbol tables with line tables: $decimal\r\n  Number of symbol tables with blockvectors: $decimal\r\n  Total memory used for objfile obstack: $decimal\r\n  Total memory used for BFD obstack: $decimal\r\n  Total memory used for psymbol cache: $decimal\r\n  Total memory used for macro cache: $decimal\r\n  Total memory used for file name cache: $decimal\r\n" {
+    -re "Statistics for\[^\n\r\]*break\[^\n\r\]*:\r\n  Number of \"minimal\" symbols read: $decimal\r\n(  Number of \"partial\" symbols read: $decimal\r\n)?  Number of \"full\" symbols read: $decimal\r\n  Number of \"types\" defined: $decimal\r\n(  Number of psym tables \\(not yet expanded\\): $decimal\r\n)?(  Number of read CUs: $decimal\r\n  Number of unread CUs: $decimal\r\n)?  Number of symbol tables: $decimal\r\n  Number of symbol tables with line tables: $decimal\r\n  Number of symbol tables with blockvectors: $decimal\r\n  Total memory used for objfile obstack: $decimal\r\n  Total memory used for BFD obstack: $decimal\r\n  Total memory used for psymbol cache: $decimal\r\n  Total memory used for macro cache: $decimal\r\n  Total memory used for file name cache: $decimal\r\n" {
 	gdb_expect {
 	    -re "$gdb_prompt $" {
 		pass "maint print statistics"


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