Consolidate psymtab "Reading" messages
authorTom Tromey <tom@tromey.com>
Wed, 23 Oct 2019 03:13:10 +0000 (21:13 -0600)
committerTom Tromey <tom@tromey.com>
Sun, 26 Jan 2020 23:40:21 +0000 (16:40 -0700)
Each symbol reader implemented its own "Reading..." messages, and most
of them double-checked that a previously-expanded psymtab could not be
re-read.

This patch consolidates the message-printing, and changes these checks
into asserts.

gdb/ChangeLog
2020-01-26  Tom Tromey  <tom@tromey.com>

* xcoffread.c (xcoff_read_symtab): Remove prints.  Add assert.
* psymtab.c (psymtab_to_symtab): Print verbose "Reading"
messages.
* mdebugread.c (mdebug_read_symtab): Remove prints.
* dwarf2read.c (dwarf2_psymtab::read_symtab): Remove prints.  Add
assert.
* dbxread.c (dbx_read_symtab): Remove prints.  Add assert.

Change-Id: I795be9710d42708299bb7b44972cffd27aec9413

gdb/ChangeLog
gdb/dbxread.c
gdb/dwarf2read.c
gdb/mdebugread.c
gdb/psymtab.c
gdb/xcoffread.c

index 8fcb24ec5cd1055261135693dc0f8f8939f3bbf5..ed3b97bfa104e0de004e60d7cc6ffd24abcbcf3e 100644 (file)
@@ -1,3 +1,13 @@
+2020-01-26  Tom Tromey  <tom@tromey.com>
+
+       * xcoffread.c (xcoff_read_symtab): Remove prints.  Add assert.
+       * psymtab.c (psymtab_to_symtab): Print verbose "Reading"
+       messages.
+       * mdebugread.c (mdebug_read_symtab): Remove prints.
+       * dwarf2read.c (dwarf2_psymtab::read_symtab): Remove prints.  Add
+       assert.
+       * dbxread.c (dbx_read_symtab): Remove prints.  Add assert.
+
 2020-01-26  Tom Tromey  <tom@tromey.com>
 
        * xcoffread.c (this_symtab_psymtab, read_xcoff_symtab)
index 64387c62c17909687c73b4b36ef2259fdba6d2a9..9d8d938ba533e6b519258c7e0daf100a64f5da75 100644 (file)
@@ -2117,24 +2117,10 @@ dbx_psymtab_to_symtab_1 (struct objfile *objfile, legacy_psymtab *pst)
 static void
 dbx_read_symtab (legacy_psymtab *self, struct objfile *objfile)
 {
-  if (self->readin)
-    {
-      fprintf_unfiltered (gdb_stderr, "Psymtab for %s already read in.  "
-                         "Shouldn't happen.\n",
-                         self->filename);
-      return;
-    }
+  gdb_assert (!self->readin);
 
   if (LDSYMLEN (self) || self->number_of_dependencies)
     {
-      /* Print the message now, before reading the string table,
-         to avoid disconcerting pauses.  */
-      if (info_verbose)
-       {
-         printf_filtered ("Reading in symbols for %s...", self->filename);
-         gdb_flush (gdb_stdout);
-       }
-
       next_symbol_text_func = dbx_next_symbol_text;
 
       {
@@ -2155,10 +2141,6 @@ dbx_read_symtab (legacy_psymtab *self, struct objfile *objfile)
       /* Match with global symbols.  This only needs to be done once,
          after all of the symtabs and dependencies have been read in.   */
       scan_file_globals (objfile);
-
-      /* Finish up the debug error message.  */
-      if (info_verbose)
-       printf_filtered ("done.\n");
     }
 }
 
index 8bde26534e300c52c8f5ccd97b7f5667b49c9ffa..9942270622de1d641fe8daa322210ea4d9b7166a 100644 (file)
@@ -9494,41 +9494,23 @@ dwarf2_psymtab::read_symtab (struct objfile *objfile)
   struct dwarf2_per_objfile *dwarf2_per_objfile
     = get_dwarf2_per_objfile (objfile);
 
-  if (readin)
-    {
-      warning (_("bug: psymtab for %s is already read in."),
-              filename);
-    }
-  else
+  gdb_assert (!readin);
+  /* If this psymtab is constructed from a debug-only objfile, the
+     has_section_at_zero flag will not necessarily be correct.  We
+     can get the correct value for this flag by looking at the data
+     associated with the (presumably stripped) associated objfile.  */
+  if (objfile->separate_debug_objfile_backlink)
     {
-      if (info_verbose)
-       {
-         printf_filtered (_("Reading in symbols for %s..."),
-                          filename);
-         gdb_flush (gdb_stdout);
-       }
+      struct dwarf2_per_objfile *dpo_backlink
+       = get_dwarf2_per_objfile (objfile->separate_debug_objfile_backlink);
 
-      /* If this psymtab is constructed from a debug-only objfile, the
-        has_section_at_zero flag will not necessarily be correct.  We
-        can get the correct value for this flag by looking at the data
-        associated with the (presumably stripped) associated objfile.  */
-      if (objfile->separate_debug_objfile_backlink)
-       {
-         struct dwarf2_per_objfile *dpo_backlink
-           = get_dwarf2_per_objfile (objfile->separate_debug_objfile_backlink);
-
-         dwarf2_per_objfile->has_section_at_zero
-           = dpo_backlink->has_section_at_zero;
-       }
-
-      dwarf2_per_objfile->reading_partial_symbols = 0;
+      dwarf2_per_objfile->has_section_at_zero
+       = dpo_backlink->has_section_at_zero;
+    }
 
-      psymtab_to_symtab_1 (this);
+  dwarf2_per_objfile->reading_partial_symbols = 0;
 
-      /* Finish up the debug error message.  */
-      if (info_verbose)
-       printf_filtered (_("done.\n"));
-    }
+  psymtab_to_symtab_1 (this);
 
   process_cu_includes (dwarf2_per_objfile);
 }
index 621b314ff99404b80c4387678a09327060c3a20b..4b32a5a8b081cde3079ac4efad3d87e901133c38 100644 (file)
@@ -277,12 +277,6 @@ static const char *mdebug_next_symbol_text (struct objfile *);
 static void
 mdebug_read_symtab (legacy_psymtab *self, struct objfile *objfile)
 {
-  if (info_verbose)
-    {
-      printf_filtered (_("Reading in symbols for %s..."), self->filename);
-      gdb_flush (gdb_stdout);
-    }
-
   next_symbol_text_func = mdebug_next_symbol_text;
 
   psymtab_to_symtab_1 (objfile, self, self->filename);
@@ -290,9 +284,6 @@ mdebug_read_symtab (legacy_psymtab *self, struct objfile *objfile)
   /* Match with global symbols.  This only needs to be done once,
      after all of the symtabs and dependencies have been read in.  */
   scan_file_globals (objfile);
-
-  if (info_verbose)
-    printf_filtered (_("done.\n"));
 }
 \f
 /* File-level interface functions.  */
index 6a2f7f7202a07b2454e606f9fa6087c312f5f53f..6abc829e2ee0a41067efebc98306a24c7fdcfbc6 100644 (file)
@@ -758,7 +758,18 @@ psymtab_to_symtab (struct objfile *objfile, struct partial_symtab *pst)
     {
       scoped_restore decrementer = increment_reading_symtab ();
 
+      if (info_verbose)
+       {
+         printf_filtered (_("Reading in symbols for %s..."),
+                          pst->filename);
+         gdb_flush (gdb_stdout);
+       }
+
       pst->read_symtab (objfile);
+
+      /* Finish up the debug error message.  */
+      if (info_verbose)
+       printf_filtered (_("done.\n"));
     }
 
   return pst->compunit_symtab;
index 69731a47911f60ceece34c916b498c73e89a9078..66d6b9adf9d8dff2952851525b7aa645b9c7c40f 100644 (file)
@@ -1869,25 +1869,11 @@ xcoff_psymtab_to_symtab_1 (struct objfile *objfile, legacy_psymtab *pst)
 static void
 xcoff_read_symtab (legacy_psymtab *self, struct objfile *objfile)
 {
-  if (self->readin)
-    {
-      fprintf_unfiltered
-       (gdb_stderr, "Psymtab for %s already read in.  Shouldn't happen.\n",
-        self->filename);
-      return;
-    }
+  gdb_assert (!self->readin);
 
   if (((struct symloc *) self->read_symtab_private)->numsyms != 0
       || self->number_of_dependencies)
     {
-      /* Print the message now, before reading the string table,
-         to avoid disconcerting pauses.  */
-      if (info_verbose)
-       {
-         printf_filtered ("Reading in symbols for %s...", self->filename);
-         gdb_flush (gdb_stdout);
-       }
-
       next_symbol_text_func = xcoff_next_symbol_text;
 
       xcoff_psymtab_to_symtab_1 (objfile, self);
@@ -1895,10 +1881,6 @@ xcoff_read_symtab (legacy_psymtab *self, struct objfile *objfile)
       /* Match with global symbols.  This only needs to be done once,
          after all of the symtabs and dependencies have been read in.   */
       scan_file_globals (objfile);
-
-      /* Finish up the debug error message.  */
-      if (info_verbose)
-       printf_filtered ("done.\n");
     }
 }
 \f
This page took 0.072017 seconds and 4 git commands to generate.