diff mbox

[15/21] struct symtab split part 2: maint.c testsuite/gdb.base/maint.exp

Message ID 5464aa3d.64aa440a.13e2.ffff8369@mx.google.com
State New
Headers show

Commit Message

Doug Evans Nov. 13, 2014, 12:54 p.m. UTC
This patch contains the changes to maint.c, testsuite/gdb.base/maint.exp.

Full ChangeLog: https://sourceware.org/ml/gdb-patches/2014-11/msg00233.html

2014-11-12  Doug Evans  <xdje42@gmail.com>

	* maint.c (struct cmd_stats) <nr_compunit_symtabs>: Renamed from
	nr_primary_symtabs.  All uses updated.
	(count_symtabs_and_blocks): Update to handle compunits.
	(report_command_stats): Update output, "primary symtabs" renamed to
	"compunits".

	testsuite/
	* gdb.base/maint.exp: Update expected output.
diff mbox

Patch

diff --git a/gdb/maint.c b/gdb/maint.c
index a621f55..586e813 100644
--- a/gdb/maint.c
+++ b/gdb/maint.c
@@ -794,8 +794,8 @@  struct cmd_stats
   long start_space;
   /* Total number of symtabs (over all objfiles).  */
   int start_nr_symtabs;
-  /* Of those, a count of just the primary ones.  */
-  int start_nr_primary_symtabs;
+  /* A count of the compunits.  */
+  int start_nr_compunit_symtabs;
   /* Total number of blocks.  */
   int start_nr_blocks;
 };
@@ -821,13 +821,14 @@  set_per_command_space (int new_value)
 /* Count the number of symtabs and blocks.  */
 
 static void
-count_symtabs_and_blocks (int *nr_symtabs_ptr, int *nr_primary_symtabs_ptr,
+count_symtabs_and_blocks (int *nr_symtabs_ptr, int *nr_compunit_symtabs_ptr,
 			  int *nr_blocks_ptr)
 {
   struct objfile *o;
+  struct compunit_symtab *cu;
   struct symtab *s;
   int nr_symtabs = 0;
-  int nr_primary_symtabs = 0;
+  int nr_compunit_symtabs = 0;
   int nr_blocks = 0;
 
   /* When collecting statistics during startup, this is called before
@@ -835,19 +836,17 @@  count_symtabs_and_blocks (int *nr_symtabs_ptr, int *nr_primary_symtabs_ptr,
      current_program_space may be NULL.  */
   if (current_program_space != NULL)
     {
-      ALL_SYMTABS (o, s)
+      ALL_COMPUNITS (o, cu)
 	{
-	  ++nr_symtabs;
-	  if (s->primary)
-	    {
-	      ++nr_primary_symtabs;
-	      nr_blocks += BLOCKVECTOR_NBLOCKS (SYMTAB_BLOCKVECTOR (s));
-	    }
+	  ++nr_compunit_symtabs;
+	  nr_blocks += BLOCKVECTOR_NBLOCKS (COMPUNIT_BLOCKVECTOR (cu));
+	  ALL_COMPUNIT_FILETABS (cu, s)
+	    ++nr_symtabs;
 	}
     }
 
   *nr_symtabs_ptr = nr_symtabs;
-  *nr_primary_symtabs_ptr = nr_primary_symtabs;
+  *nr_compunit_symtabs_ptr = nr_compunit_symtabs;
   *nr_blocks_ptr = nr_blocks;
 }
 
@@ -902,16 +901,17 @@  report_command_stats (void *arg)
 
   if (start_stats->symtab_enabled && per_command_symtab)
     {
-      int nr_symtabs, nr_primary_symtabs, nr_blocks;
+      int nr_symtabs, nr_compunit_symtabs, nr_blocks;
 
-      count_symtabs_and_blocks (&nr_symtabs, &nr_primary_symtabs, &nr_blocks);
+      count_symtabs_and_blocks (&nr_symtabs, &nr_compunit_symtabs, &nr_blocks);
       printf_unfiltered (_("#symtabs: %d (+%d),"
-			   " #primary symtabs: %d (+%d),"
+			   " #compunits: %d (+%d),"
 			   " #blocks: %d (+%d)\n"),
 			 nr_symtabs,
 			 nr_symtabs - start_stats->start_nr_symtabs,
-			 nr_primary_symtabs,
-			 nr_primary_symtabs - start_stats->start_nr_primary_symtabs,
+			 nr_compunit_symtabs,
+			 (nr_compunit_symtabs
+			  - start_stats->start_nr_compunit_symtabs),
 			 nr_blocks,
 			 nr_blocks - start_stats->start_nr_blocks);
     }
@@ -960,11 +960,11 @@  make_command_stats_cleanup (int msg_type)
 
   if (msg_type == 0 || per_command_symtab)
     {
-      int nr_symtabs, nr_primary_symtabs, nr_blocks;
+      int nr_symtabs, nr_compunit_symtabs, nr_blocks;
 
-      count_symtabs_and_blocks (&nr_symtabs, &nr_primary_symtabs, &nr_blocks);
+      count_symtabs_and_blocks (&nr_symtabs, &nr_compunit_symtabs, &nr_blocks);
       new_stat->start_nr_symtabs = nr_symtabs;
-      new_stat->start_nr_primary_symtabs = nr_primary_symtabs;
+      new_stat->start_nr_compunit_symtabs = nr_compunit_symtabs;
       new_stat->start_nr_blocks = nr_blocks;
       new_stat->symtab_enabled = 1;
     }
diff --git a/gdb/testsuite/gdb.base/maint.exp b/gdb/testsuite/gdb.base/maint.exp
index 21d0a31..edf7ff3 100644
--- a/gdb/testsuite/gdb.base/maint.exp
+++ b/gdb/testsuite/gdb.base/maint.exp
@@ -72,7 +72,7 @@  gdb_test "maint print registers" "Name.*Nr.*Rel.*Offset.*Size.*Type.*"
 gdb_test_no_output "mt set per on" "mt set per on for expand-symtabs"
 gdb_test_multiple "mt expand-symtabs $subdir/break\[.\]c$" \
     "mt expand-symtabs" {
-	-re "#primary symtabs: (1|2) \\(\[+\](0|1|2)\\),.*$gdb_prompt $" {
+	-re "#compunits: (1|2) \\(\[+\](0|1|2)\\),.*$gdb_prompt $" {
 	    # This should expand at most two primary symtabs.
 	    # "Normally" it will not expand any, because the symtab
 	    # holding "main" will already have been expanded, but if the
@@ -133,7 +133,7 @@  gdb_test_no_output "maint check-symtabs"
 # Test per-command stats.
 gdb_test_no_output "maint set per-command on"
 gdb_test "pwd" \
-    "Command execution time: \[0-9.\]+ \\(cpu\\), \[0-9.\]+ \\(wall\\)\[\r\n\]+Space used: $decimal \\(\\+$decimal for this command\\)\[\r\n\]+#symtabs: $decimal \\(\\+$decimal\\), #primary symtabs: $decimal \\(\\+$decimal\\), #blocks: $decimal \\(\\+$decimal\\)"
+    "Command execution time: \[0-9.\]+ \\(cpu\\), \[0-9.\]+ \\(wall\\)\[\r\n\]+Space used: $decimal \\(\\+$decimal for this command\\)\[\r\n\]+#symtabs: $decimal \\(\\+$decimal\\), #compunits: $decimal \\(\\+$decimal\\), #blocks: $decimal \\(\\+$decimal\\)"
 gdb_test_no_output "maint set per-command off"
 
 gdb_test "maint demangle" \