public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 1/2] gdb: remove some unused buildsym-legacy functions
@ 2022-03-28 22:17 Simon Marchi
  2022-03-28 22:17 ` [PATCH 2/2] gdb: rename start_symtab/end_symtab to start_compunit_symtab/end_compunit_symtab Simon Marchi
  2022-04-04 16:30 ` [PATCH 1/2] gdb: remove some unused buildsym-legacy functions Tom Tromey
  0 siblings, 2 replies; 5+ messages in thread
From: Simon Marchi @ 2022-03-28 22:17 UTC (permalink / raw)
  To: gdb-patches; +Cc: Simon Marchi

Pretty much self-explanatory.

Change-Id: I5b658d017cd891ecdd1df61075eacb0f44316935
---
 gdb/buildsym-legacy.c | 89 -------------------------------------------
 gdb/buildsym-legacy.h | 36 -----------------
 2 files changed, 125 deletions(-)

diff --git a/gdb/buildsym-legacy.c b/gdb/buildsym-legacy.c
index 7659f53cbe0..cfafcc38640 100644
--- a/gdb/buildsym-legacy.c
+++ b/gdb/buildsym-legacy.c
@@ -79,33 +79,6 @@ get_last_source_start_addr ()
 
 /* See buildsym.h.  */
 
-struct using_direct **
-get_local_using_directives ()
-{
-  gdb_assert (buildsym_compunit != nullptr);
-  return buildsym_compunit->get_local_using_directives ();
-}
-
-/* See buildsym.h.  */
-
-void
-set_local_using_directives (struct using_direct *new_local)
-{
-  gdb_assert (buildsym_compunit != nullptr);
-  buildsym_compunit->set_local_using_directives (new_local);
-}
-
-/* See buildsym.h.  */
-
-struct using_direct **
-get_global_using_directives ()
-{
-  gdb_assert (buildsym_compunit != nullptr);
-  return buildsym_compunit->get_global_using_directives ();
-}
-
-/* See buildsym.h.  */
-
 bool
 outermost_context_p ()
 {
@@ -115,15 +88,6 @@ outermost_context_p ()
 
 /* See buildsym.h.  */
 
-struct context_stack *
-get_current_context_stack ()
-{
-  gdb_assert (buildsym_compunit != nullptr);
-  return buildsym_compunit->get_current_context_stack ();
-}
-
-/* See buildsym.h.  */
-
 int
 get_context_stack_depth ()
 {
@@ -240,14 +204,6 @@ finish_block (struct symbol *symbol, struct pending_block *old_blocks,
 					  start, end);
 }
 
-void
-record_block_range (struct block *block, CORE_ADDR start,
-		    CORE_ADDR end_inclusive)
-{
-  gdb_assert (buildsym_compunit != nullptr);
-  buildsym_compunit->record_block_range (block, start, end_inclusive);
-}
-
 void
 record_line (struct subfile *subfile, int line, CORE_ADDR pc)
 {
@@ -283,51 +239,6 @@ start_symtab (struct objfile *objfile, const char *name, const char *comp_dir,
   return buildsym_compunit->get_compunit_symtab ();
 }
 
-/* Restart compilation for a symtab.
-   CUST is the result of end_expandable_symtab.
-   NAME, START_ADDR are the source file we are resuming with.
-
-   This is used when a symtab is built from multiple sources.
-   The symtab is first built with start_symtab/end_expandable_symtab
-   and then for each additional piece call restart_symtab/augment_*_symtab.
-   Note: At the moment there is only augment_type_symtab.  */
-
-void
-restart_symtab (struct compunit_symtab *cust,
-		const char *name, CORE_ADDR start_addr)
-{
-  /* These should have been reset either by successful completion of building
-     a symtab, or by the scoped_free_pendings destructor.  */
-  gdb_assert (buildsym_compunit == nullptr);
-
-  buildsym_compunit
-    = new struct buildsym_compunit (cust->objfile (),
-				    name,
-				    cust->dirname (),
-				    compunit_language (cust),
-				    start_addr,
-				    cust);
-}
-
-/* See buildsym.h.  */
-
-struct compunit_symtab *
-buildsym_compunit_symtab (void)
-{
-  gdb_assert (buildsym_compunit != NULL);
-
-  return buildsym_compunit->get_compunit_symtab ();
-}
-
-/* See buildsym.h.  */
-
-struct macro_table *
-get_macro_table (void)
-{
-  gdb_assert (buildsym_compunit != NULL);
-  return buildsym_compunit->get_macro_table ();
-}
-
 /* At end of reading syms, or in case of quit, ensure everything
    associated with building symtabs is freed.
 
diff --git a/gdb/buildsym-legacy.h b/gdb/buildsym-legacy.h
index 9393aff4cee..b8b5caf0763 100644
--- a/gdb/buildsym-legacy.h
+++ b/gdb/buildsym-legacy.h
@@ -62,9 +62,6 @@ extern struct block *finish_block (struct symbol *symbol,
 				   CORE_ADDR start,
 				   CORE_ADDR end);
 
-extern void record_block_range (struct block *,
-				CORE_ADDR start, CORE_ADDR end_inclusive);
-
 extern void start_subfile (const char *name);
 
 extern void patch_subfile_names (struct subfile *subfile, const char *name);
@@ -87,9 +84,6 @@ extern struct compunit_symtab *start_symtab (struct objfile *objfile,
 					     CORE_ADDR start_addr,
 					     enum language language);
 
-extern void restart_symtab (struct compunit_symtab *cust,
-			    const char *name, CORE_ADDR start_addr);
-
 /* Record the name of the debug format in the current pending symbol
    table.  FORMAT must be a string with a lifetime at least as long as
    the symtab's objfile.  */
@@ -111,19 +105,6 @@ extern void set_last_source_file (const char *name);
 
 extern const char *get_last_source_file (void);
 
-/* Return the compunit symtab object.
-   It is only valid to call this between calls to start_symtab and the
-   end_symtab* functions.  */
-
-extern struct compunit_symtab *buildsym_compunit_symtab (void);
-
-/* Return the macro table.
-   Initialize it if this is the first use.
-   It is only valid to call this between calls to start_symtab and the
-   end_symtab* functions.  */
-
-extern struct macro_table *get_macro_table (void);
-
 /* Set the last source start address.  Can only be used between
    start_symtab and end_symtab* calls.  */
 
@@ -134,27 +115,10 @@ extern void set_last_source_start_addr (CORE_ADDR addr);
 
 extern CORE_ADDR get_last_source_start_addr ();
 
-/* Return the local using directives.  */
-
-extern struct using_direct **get_local_using_directives ();
-
-/* Set the list of local using directives.  */
-
-extern void set_local_using_directives (struct using_direct *new_local);
-
-/* Return the global using directives.  */
-
-extern struct using_direct **get_global_using_directives ();
-
 /* True if the context stack is empty.  */
 
 extern bool outermost_context_p ();
 
-/* Return the top of the context stack, or nullptr if there is an
-   entry.  */
-
-extern struct context_stack *get_current_context_stack ();
-
 /* Return the context stack depth.  */
 
 extern int get_context_stack_depth ();
-- 
2.35.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 2/2] gdb: rename start_symtab/end_symtab to start_compunit_symtab/end_compunit_symtab
  2022-03-28 22:17 [PATCH 1/2] gdb: remove some unused buildsym-legacy functions Simon Marchi
@ 2022-03-28 22:17 ` Simon Marchi
  2022-04-04 16:31   ` Tom Tromey
  2022-04-04 16:30 ` [PATCH 1/2] gdb: remove some unused buildsym-legacy functions Tom Tromey
  1 sibling, 1 reply; 5+ messages in thread
From: Simon Marchi @ 2022-03-28 22:17 UTC (permalink / raw)
  To: gdb-patches; +Cc: Simon Marchi

It's a bit confusing because we have both "compunit_symtab" and "symtab"
types, and many methods and functions containing "start_symtab" or
"end_symtab", which actually deal with compunit_symtabs.  I believe this
comes from the time before compunit_symtab was introduced, where
symtab did the job of both.

Rename everything I found containing start_symtab or end_symtab to use
start_compunit_symtab or end_compunit_symtab.

Change-Id: If3849b156f6433640173085ad479b6a0b085ade2
---
 gdb/buildsym-legacy.c | 19 +++++++------
 gdb/buildsym-legacy.h | 31 +++++++++++----------
 gdb/buildsym.c        | 64 +++++++++++++++++++++++--------------------
 gdb/buildsym.h        | 14 +++++-----
 gdb/coffread.c        | 32 +++++++++++-----------
 gdb/ctfread.c         | 16 +++++------
 gdb/dbxread.c         | 10 +++----
 gdb/dwarf2/cu.c       |  4 +--
 gdb/dwarf2/cu.h       | 10 +++----
 gdb/dwarf2/read.c     | 15 +++++-----
 gdb/mdebugread.c      |  5 ++--
 gdb/stabsread.c       |  4 +--
 gdb/xcoffread.c       | 28 ++++++++++---------
 13 files changed, 131 insertions(+), 121 deletions(-)

diff --git a/gdb/buildsym-legacy.c b/gdb/buildsym-legacy.c
index cfafcc38640..b16c97807ac 100644
--- a/gdb/buildsym-legacy.c
+++ b/gdb/buildsym-legacy.c
@@ -21,7 +21,7 @@
 #include "symtab.h"
 
 /* The work-in-progress of the compunit we are building.
-   This is created first, before any subfiles by start_symtab.  */
+   This is created first, before any subfiles by start_compunit_symtab.  */
 
 static struct buildsym_compunit *buildsym_compunit;
 
@@ -171,11 +171,11 @@ free_buildsym_compunit (void)
 }
 
 struct compunit_symtab *
-end_symtab (CORE_ADDR end_addr, int section)
+end_compunit_symtab (CORE_ADDR end_addr, int section)
 {
   gdb_assert (buildsym_compunit != nullptr);
   struct compunit_symtab *result
-    = buildsym_compunit->end_symtab (end_addr, section);
+    = buildsym_compunit->end_compunit_symtab (end_addr, section);
   free_buildsym_compunit ();
   return result;
 }
@@ -213,10 +213,10 @@ record_line (struct subfile *subfile, int line, CORE_ADDR pc)
   buildsym_compunit->record_line (subfile, line, pc, true);
 }
 
-/* Start a new symtab for a new source file in OBJFILE.  Called, for example,
-   when a stabs symbol of type N_SO is seen, or when a DWARF
-   TAG_compile_unit DIE is seen.  It indicates the start of data for
-   one original source file.
+/* Start a new compunit_symtab for a new source file in OBJFILE.  Called, for
+   example, when a stabs symbol of type N_SO is seen, or when a DWARF
+   DW_TAG_compile_unit DIE is seen.  It indicates the start of data for one
+   original source file.
 
    NAME is the name of the file (cannot be NULL).  COMP_DIR is the
    directory in which the file was compiled (or NULL if not known).
@@ -226,8 +226,9 @@ record_line (struct subfile *subfile, int line, CORE_ADDR pc)
    the filename.  */
 
 struct compunit_symtab *
-start_symtab (struct objfile *objfile, const char *name, const char *comp_dir,
-	      CORE_ADDR start_addr, enum language language)
+start_compunit_symtab (struct objfile *objfile, const char *name,
+		       const char *comp_dir, CORE_ADDR start_addr,
+		       enum language language)
 {
   /* These should have been reset either by successful completion of building
      a symtab, or by the scoped_free_pendings destructor.  */
diff --git a/gdb/buildsym-legacy.h b/gdb/buildsym-legacy.h
index b8b5caf0763..86e1e1c9b2c 100644
--- a/gdb/buildsym-legacy.h
+++ b/gdb/buildsym-legacy.h
@@ -30,20 +30,20 @@
    The basic way this module is used is as follows:
 
    scoped_free_pendings free_pending;
-   cust = start_symtab (...);
+   cust = start_compunit_symtab (...);
    ... read debug info ...
-   cust = end_symtab (...);
+   cust = end_compunit_symtab (...);
 
-   The compunit symtab pointer ("cust") is returned from both start_symtab
-   and end_symtab to simplify the debug info readers.
+   The compunit symtab pointer ("cust") is returned from both
+   start_compunit_symtab and end_compunit_symtab to simplify the debug info readers.
 
    dbxread.c and xcoffread.c use another variation:
 
    scoped_free_pendings free_pending;
-   cust = start_symtab (...);
+   cust = start_compunit_symtab (...);
    ... read debug info ...
-   cust = end_symtab (...);
-   ... start_symtab + read + end_symtab repeated ...
+   cust = end_compunit_symtab (...);
+   ... start_compunit_symtab + read + end_compunit_symtab repeated ...
 */
 
 class scoped_free_pendings
@@ -70,7 +70,8 @@ extern void push_subfile ();
 
 extern const char *pop_subfile ();
 
-extern struct compunit_symtab *end_symtab (CORE_ADDR end_addr, int section);
+extern struct compunit_symtab *end_compunit_symtab (CORE_ADDR end_addr,
+						    int section);
 
 extern struct context_stack *push_context (int desc, CORE_ADDR valu);
 
@@ -78,11 +79,11 @@ extern struct context_stack pop_context ();
 
 extern void record_line (struct subfile *subfile, int line, CORE_ADDR pc);
 
-extern struct compunit_symtab *start_symtab (struct objfile *objfile,
-					     const char *name,
-					     const char *comp_dir,
-					     CORE_ADDR start_addr,
-					     enum language language);
+extern struct compunit_symtab *start_compunit_symtab (struct objfile *objfile,
+						      const char *name,
+						      const char *comp_dir,
+						      CORE_ADDR start_addr,
+						      enum language language);
 
 /* Record the name of the debug format in the current pending symbol
    table.  FORMAT must be a string with a lifetime at least as long as
@@ -106,12 +107,12 @@ extern void set_last_source_file (const char *name);
 extern const char *get_last_source_file (void);
 
 /* Set the last source start address.  Can only be used between
-   start_symtab and end_symtab* calls.  */
+   start_compunit_symtab and end_compunit_symtab* calls.  */
 
 extern void set_last_source_start_addr (CORE_ADDR addr);
 
 /* Get the last source start address.  Can only be used between
-   start_symtab and end_symtab* calls.  */
+   start_compunit_symtab and end_compunit_symtab* calls.  */
 
 extern CORE_ADDR get_last_source_start_addr ();
 
diff --git a/gdb/buildsym.c b/gdb/buildsym.c
index 999f632f401..c970762badb 100644
--- a/gdb/buildsym.c
+++ b/gdb/buildsym.c
@@ -728,7 +728,7 @@ buildsym_compunit::record_line (struct subfile *subfile, int line,
 }
 
 \f
-/* Subroutine of end_symtab to simplify it.  Look for a subfile that
+/* Subroutine of end_compunit_symtab to simplify it.  Look for a subfile that
    matches the main source file's basename.  If there is only one, and
    if the main source file doesn't have any symbol or line number
    information, then copy this file's symtab and line_vector to the
@@ -796,13 +796,14 @@ buildsym_compunit::watch_main_source_file_lossage ()
     }
 }
 
-/* Implementation of the first part of end_symtab.  It allows modifying
-   STATIC_BLOCK before it gets finalized by end_symtab_from_static_block.
-   If the returned value is NULL there is no blockvector created for
-   this symtab (you still must call end_symtab_from_static_block).
+/* Implementation of the first part of end_compunit_symtab.  It allows modifying
+   STATIC_BLOCK before it gets finalized by
+   end_compunit_symtab_from_static_block.  If the returned value is NULL there
+   is no blockvector created for this symtab (you still must call
+   end_compunit_symtab_from_static_block).
 
-   END_ADDR is the same as for end_symtab: the address of the end of the
-   file's text.
+   END_ADDR is the same as for end_compunit_symtab: the address of the end of
+   the file's text.
 
    If EXPANDABLE is non-zero the STATIC_BLOCK dictionary is made
    expandable.
@@ -811,8 +812,9 @@ buildsym_compunit::watch_main_source_file_lossage ()
    not contain any symbols.  */
 
 struct block *
-buildsym_compunit::end_symtab_get_static_block (CORE_ADDR end_addr,
-						int expandable, int required)
+buildsym_compunit::end_compunit_symtab_get_static_block (CORE_ADDR end_addr,
+							 int expandable,
+							 int required)
 {
   /* Finish the lexical context of the last function in the file; pop
      the context stack.  */
@@ -832,7 +834,7 @@ buildsym_compunit::end_symtab_get_static_block (CORE_ADDR end_addr,
 	     same.  FIXME: Find out why it is happening.  This is not
 	     believed to happen in most cases (even for coffread.c);
 	     it used to be an abort().  */
-	  complaint (_("Context stack not empty in end_symtab"));
+	  complaint (_("Context stack not empty in end_compunit_symtab"));
 	  m_context_stack.clear ();
 	}
     }
@@ -896,13 +898,14 @@ buildsym_compunit::end_symtab_get_static_block (CORE_ADDR end_addr,
     }
 }
 
-/* Subroutine of end_symtab_from_static_block to simplify it.
+/* Subroutine of end_compunit_symtab_from_static_block to simplify it.
    Handle the "have blockvector" case.
-   See end_symtab_from_static_block for a description of the arguments.  */
+   See end_compunit_symtab_from_static_block for a description of the
+   arguments.  */
 
 struct compunit_symtab *
-buildsym_compunit::end_symtab_with_blockvector (struct block *static_block,
-						int section, int expandable)
+buildsym_compunit::end_compunit_symtab_with_blockvector
+  (struct block *static_block, int section, int expandable)
 {
   struct compunit_symtab *cu = m_compunit_symtab;
   struct blockvector *blockvector;
@@ -1057,18 +1060,18 @@ buildsym_compunit::end_symtab_with_blockvector (struct block *static_block,
   return cu;
 }
 
-/* Implementation of the second part of end_symtab.  Pass STATIC_BLOCK
-   as value returned by end_symtab_get_static_block.
+/* Implementation of the second part of end_compunit_symtab.  Pass STATIC_BLOCK
+   as value returned by end_compunit_symtab_get_static_block.
 
-   SECTION is the same as for end_symtab: the section number
+   SECTION is the same as for end_compunit_symtab: the section number
    (in objfile->section_offsets) of the blockvector and linetable.
 
    If EXPANDABLE is non-zero the GLOBAL_BLOCK dictionary is made
    expandable.  */
 
 struct compunit_symtab *
-buildsym_compunit::end_symtab_from_static_block (struct block *static_block,
-						 int section, int expandable)
+buildsym_compunit::end_compunit_symtab_from_static_block
+  (struct block *static_block, int section, int expandable)
 {
   struct compunit_symtab *cu;
 
@@ -1086,7 +1089,7 @@ buildsym_compunit::end_symtab_from_static_block (struct block *static_block,
       cu = NULL;
     }
   else
-    cu = end_symtab_with_blockvector (static_block, section, expandable);
+    cu = end_compunit_symtab_with_blockvector (static_block, section, expandable);
 
   return cu;
 }
@@ -1100,7 +1103,7 @@ buildsym_compunit::end_symtab_from_static_block (struct block *static_block,
    the section number (in objfile->section_offsets) of the blockvector
    and linetable.
 
-   Note that it is possible for end_symtab() to return NULL.  In
+   Note that it is possible for end_compunit_symtab() to return NULL.  In
    particular, for the DWARF case at least, it will return NULL when
    it finds a compilation unit that has exactly one DIE, a
    TAG_compile_unit DIE.  This can happen when we link in an object
@@ -1109,27 +1112,28 @@ buildsym_compunit::end_symtab_from_static_block (struct block *static_block,
    never know about this empty file (FIXME).
 
    If you need to modify STATIC_BLOCK before it is finalized you should
-   call end_symtab_get_static_block and end_symtab_from_static_block
-   yourself.  */
+   call end_compunit_symtab_get_static_block and
+   end_compunit_symtab_from_static_block yourself.  */
 
 struct compunit_symtab *
-buildsym_compunit::end_symtab (CORE_ADDR end_addr, int section)
+buildsym_compunit::end_compunit_symtab (CORE_ADDR end_addr, int section)
 {
   struct block *static_block;
 
-  static_block = end_symtab_get_static_block (end_addr, 0, 0);
-  return end_symtab_from_static_block (static_block, section, 0);
+  static_block = end_compunit_symtab_get_static_block (end_addr, 0, 0);
+  return end_compunit_symtab_from_static_block (static_block, section, 0);
 }
 
-/* Same as end_symtab except create a symtab that can be later added to.  */
+/* Same as end_compunit_symtab except create a symtab that can be later added
+   to.  */
 
 struct compunit_symtab *
 buildsym_compunit::end_expandable_symtab (CORE_ADDR end_addr, int section)
 {
   struct block *static_block;
 
-  static_block = end_symtab_get_static_block (end_addr, 1, 0);
-  return end_symtab_from_static_block (static_block, section, 1);
+  static_block = end_compunit_symtab_get_static_block (end_addr, 1, 0);
+  return end_compunit_symtab_from_static_block (static_block, section, 1);
 }
 
 /* Subroutine of augment_type_symtab to simplify it.
@@ -1153,7 +1157,7 @@ set_missing_symtab (struct pending *pending_list,
     }
 }
 
-/* Same as end_symtab, but for the case where we're adding more symbols
+/* Same as end_compunit_symtab, but for the case where we're adding more symbols
    to an existing symtab that is known to contain only type information.
    This is the case for DWARF4 Type Units.  */
 
diff --git a/gdb/buildsym.h b/gdb/buildsym.h
index 003d8a59719..fa774dbd6fb 100644
--- a/gdb/buildsym.h
+++ b/gdb/buildsym.h
@@ -271,13 +271,13 @@ struct buildsym_compunit
 
   struct context_stack pop_context ();
 
-  struct block *end_symtab_get_static_block (CORE_ADDR end_addr,
-					     int expandable, int required);
+  struct block *end_compunit_symtab_get_static_block
+    (CORE_ADDR end_addr, int expandable, int required);
 
-  struct compunit_symtab *end_symtab_from_static_block
-      (struct block *static_block, int section, int expandable);
+  struct compunit_symtab *end_compunit_symtab_from_static_block
+    (struct block *static_block, int section, int expandable);
 
-  struct compunit_symtab *end_symtab (CORE_ADDR end_addr, int section);
+  struct compunit_symtab *end_compunit_symtab (CORE_ADDR end_addr, int section);
 
   struct compunit_symtab *end_expandable_symtab (CORE_ADDR end_addr,
 						 int section);
@@ -299,8 +299,8 @@ struct buildsym_compunit
 
   void watch_main_source_file_lossage ();
 
-  struct compunit_symtab *end_symtab_with_blockvector
-      (struct block *static_block, int section, int expandable);
+  struct compunit_symtab *end_compunit_symtab_with_blockvector
+    (struct block *static_block, int section, int expandable);
 
   /* The objfile we're reading debug info from.  */
   struct objfile *m_objfile;
diff --git a/gdb/coffread.c b/gdb/coffread.c
index 3ff62bc96c0..1de2a79a0d9 100644
--- a/gdb/coffread.c
+++ b/gdb/coffread.c
@@ -365,18 +365,18 @@ coff_alloc_type (int index)
    it indicates the start of data for one original source file.  */
 
 static void
-coff_start_symtab (struct objfile *objfile, const char *name)
+coff_start_compunit_symtab (struct objfile *objfile, const char *name)
 {
   within_function = 0;
-  start_symtab (objfile,
-		name,
+  start_compunit_symtab (objfile,
+			 name,
   /* We never know the directory name for COFF.  */
-		 NULL,
+			 NULL,
   /* The start address is irrelevant, since we call
-     set_last_source_start_addr in coff_end_symtab.  */
-		 0,
+     set_last_source_start_addr in coff_end_compunit_symtab.  */
+			 0,
   /* Let buildsym.c deduce the language for this symtab.  */
-		 language_unknown);
+			 language_unknown);
   record_debugformat ("COFF");
 }
 
@@ -400,11 +400,11 @@ complete_symtab (const char *name, CORE_ADDR start_addr, unsigned int size)
    list of all such.  */
 
 static void
-coff_end_symtab (struct objfile *objfile)
+coff_end_compunit_symtab (struct objfile *objfile)
 {
   set_last_source_start_addr (current_source_start_addr);
 
-  end_symtab (current_source_end_addr, SECT_OFF_TEXT (objfile));
+  end_compunit_symtab (current_source_end_addr, SECT_OFF_TEXT (objfile));
 
   /* Reinitialize for beginning of new file.  */
   set_last_source_file (NULL);
@@ -812,7 +812,7 @@ coff_symtab_read (minimal_symbol_reader &reader,
   type_vector_length = INITIAL_TYPE_VECTOR_LENGTH;
   type_vector = XCNEWVEC (struct type *, type_vector_length);
 
-  coff_start_symtab (objfile, "");
+  coff_start_compunit_symtab (objfile, "");
 
   symnum = 0;
   while (symnum < nsyms)
@@ -824,10 +824,10 @@ coff_symtab_read (minimal_symbol_reader &reader,
       if (cs->c_symnum == next_file_symnum && cs->c_sclass != C_FILE)
 	{
 	  if (get_last_source_file ())
-	    coff_end_symtab (objfile);
+	    coff_end_compunit_symtab (objfile);
 
-	  coff_start_symtab (objfile, "_globals_");
-	  /* coff_start_symtab will set the language of this symtab to
+	  coff_start_compunit_symtab (objfile, "_globals_");
+	  /* coff_start_compunit_symtab will set the language of this symtab to
 	     language_unknown, since such a ``file name'' is not
 	     recognized.  Override that with the minimal language to
 	     allow printing values in this symtab.  */
@@ -890,8 +890,8 @@ coff_symtab_read (minimal_symbol_reader &reader,
 	     containing debugging information.  */
 	  if (get_last_source_file ())
 	    {
-	      coff_end_symtab (objfile);
-	      coff_start_symtab (objfile, filestring);
+	      coff_end_compunit_symtab (objfile);
+	      coff_start_compunit_symtab (objfile, filestring);
 	    }
 	  in_source_file = 1;
 	  break;
@@ -1170,7 +1170,7 @@ coff_symtab_read (minimal_symbol_reader &reader,
     }
 
   if (get_last_source_file ())
-    coff_end_symtab (objfile);
+    coff_end_compunit_symtab (objfile);
 
   /* Patch up any opaque types (references to types that are not defined
      in the file where they are referenced, e.g. "struct foo *bar").  */
diff --git a/gdb/ctfread.c b/gdb/ctfread.c
index 5d965bb0e08..5d23517374e 100644
--- a/gdb/ctfread.c
+++ b/gdb/ctfread.c
@@ -1246,8 +1246,8 @@ get_objfile_text_range (struct objfile *of, int *tsize)
 /* Start a symtab for OBJFILE in CTF format.  */
 
 static void
-ctf_start_symtab (ctf_psymtab *pst,
-		  struct objfile *of, CORE_ADDR text_offset)
+ctf_start_compunit_symtab (ctf_psymtab *pst,
+			   struct objfile *of, CORE_ADDR text_offset)
 {
   struct ctf_context *ccp;
 
@@ -1263,14 +1263,14 @@ ctf_start_symtab (ctf_psymtab *pst,
    the .text section number.  */
 
 static struct compunit_symtab *
-ctf_end_symtab (ctf_psymtab *pst,
-		CORE_ADDR end_addr, int section)
+ctf_end_compunit_symtab (ctf_psymtab *pst,
+			 CORE_ADDR end_addr, int section)
 {
   struct ctf_context *ccp;
 
   ccp = &pst->context;
   struct compunit_symtab *result
-    = ccp->builder->end_symtab (end_addr, section);
+    = ccp->builder->end_compunit_symtab (end_addr, section);
   delete ccp->builder;
   ccp->builder = nullptr;
   return result;
@@ -1407,13 +1407,13 @@ ctf_psymtab::read_symtab (struct objfile *objfile)
       int tsize;
 
       offset = get_objfile_text_range (objfile, &tsize);
-      ctf_start_symtab (this, objfile, offset);
+      ctf_start_compunit_symtab (this, objfile, offset);
       expand_psymtab (objfile);
 
       set_text_low (offset);
       set_text_high (offset + tsize);
-      compunit_symtab = ctf_end_symtab (this, offset + tsize,
-					SECT_OFF_TEXT (objfile));
+      compunit_symtab = ctf_end_compunit_symtab (this, offset + tsize,
+						 SECT_OFF_TEXT (objfile));
 
       /* Finish up the debug error message.  */
       if (info_verbose)
diff --git a/gdb/dbxread.c b/gdb/dbxread.c
index 165040dd7ce..2c77475139a 100644
--- a/gdb/dbxread.c
+++ b/gdb/dbxread.c
@@ -2318,8 +2318,8 @@ read_ofile_symtab (struct objfile *objfile, legacy_psymtab *pst)
   if (get_last_source_start_addr () > text_offset)
     set_last_source_start_addr (text_offset);
 
-  pst->compunit_symtab = end_symtab (text_offset + text_size,
-				     SECT_OFF_TEXT (objfile));
+  pst->compunit_symtab = end_compunit_symtab (text_offset + text_size,
+					      SECT_OFF_TEXT (objfile));
 
   end_stabs ();
 
@@ -2367,7 +2367,7 @@ cp_set_block_scope (const struct symbol *symbol,
    the pst->section_offsets.  All symbols that refer to memory
    locations need to be offset by these amounts.
    OBJFILE is the object file from which we are reading symbols.  It
-   is used in end_symtab.
+   is used in end_compunit_symtab.
    LANGUAGE is the language of the symtab.
 */
 
@@ -2575,7 +2575,7 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, const char *name,
 	      patch_subfile_names (get_current_subfile (), name);
 	      break;		/* Ignore repeated SOs.  */
 	    }
-	  end_symtab (valu, SECT_OFF_TEXT (objfile));
+	  end_compunit_symtab (valu, SECT_OFF_TEXT (objfile));
 	  end_stabs ();
 	}
 
@@ -2587,7 +2587,7 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, const char *name,
       function_start_offset = 0;
 
       start_stabs ();
-      start_symtab (objfile, name, NULL, valu, language);
+      start_compunit_symtab (objfile, name, NULL, valu, language);
       record_debugformat ("stabs");
       break;
 
diff --git a/gdb/dwarf2/cu.c b/gdb/dwarf2/cu.c
index b1fd688188a..d70eb0e25f9 100644
--- a/gdb/dwarf2/cu.c
+++ b/gdb/dwarf2/cu.c
@@ -54,8 +54,8 @@ dwarf2_cu::addr_sized_int_type (bool unsigned_p) const
    buildsym_compunit constructor.  */
 
 struct compunit_symtab *
-dwarf2_cu::start_symtab (const char *name, const char *comp_dir,
-			 CORE_ADDR low_pc)
+dwarf2_cu::start_compunit_symtab (const char *name, const char *comp_dir,
+				  CORE_ADDR low_pc)
 {
   gdb_assert (m_builder == nullptr);
 
diff --git a/gdb/dwarf2/cu.h b/gdb/dwarf2/cu.h
index bce0a3de63a..6b72ec234bf 100644
--- a/gdb/dwarf2/cu.h
+++ b/gdb/dwarf2/cu.h
@@ -59,11 +59,11 @@ struct dwarf2_cu
      We don't need the pc/line-number mapping for type units.  */
   void setup_type_unit_groups (struct die_info *die);
 
-  /* Start a symtab for DWARF.  NAME, COMP_DIR, LOW_PC are passed to the
-     buildsym_compunit constructor.  */
-  struct compunit_symtab *start_symtab (const char *name,
-					const char *comp_dir,
-					CORE_ADDR low_pc);
+  /* Start a compunit_symtab for DWARF.  NAME, COMP_DIR, LOW_PC are passed to
+     the buildsym_compunit constructor.  */
+  struct compunit_symtab *start_compunit_symtab (const char *name,
+						 const char *comp_dir,
+						 CORE_ADDR low_pc);
 
   /* Reset the builder.  */
   void reset_builder () { m_builder.reset (); }
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 6c41ede48b5..07c13b63464 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -9456,7 +9456,8 @@ process_full_comp_unit (dwarf2_cu *cu, enum language pretend_language)
   get_scope_pc_bounds (cu->dies, &lowpc, &highpc, cu);
 
   addr = gdbarch_adjust_dwarf2_addr (gdbarch, highpc + baseaddr);
-  static_block = cu->get_builder ()->end_symtab_get_static_block (addr, 0, 1);
+  static_block
+    = cu->get_builder ()->end_compunit_symtab_get_static_block (addr, 0, 1);
 
   /* If the comp unit has DW_AT_ranges, it may have discontiguous ranges.
      Also, DW_AT_ranges may record ranges not belonging to any child DIEs
@@ -9465,9 +9466,8 @@ process_full_comp_unit (dwarf2_cu *cu, enum language pretend_language)
      this comp unit.  */
   dwarf2_record_block_ranges (cu->dies, static_block, baseaddr, cu);
 
-  cust = cu->get_builder ()->end_symtab_from_static_block (static_block,
-						    SECT_OFF_TEXT (objfile),
-						    0);
+  cust = cu->get_builder ()->end_compunit_symtab_from_static_block
+    (static_block, SECT_OFF_TEXT (objfile), 0);
 
   if (cust != NULL)
     {
@@ -10623,7 +10623,8 @@ read_file_scope (struct die_info *die, struct dwarf2_cu *cu)
 
   file_and_directory &fnd = find_file_and_directory (die, cu);
 
-  cu->start_symtab (fnd.get_name (), fnd.intern_comp_dir (objfile), lowpc);
+  cu->start_compunit_symtab (fnd.get_name (), fnd.intern_comp_dir (objfile),
+			     lowpc);
 
   gdb_assert (per_objfile->sym_cu == nullptr);
   scoped_restore restore_sym_cu
@@ -10716,7 +10717,7 @@ dwarf2_cu::setup_type_unit_groups (struct die_info *die)
   if (lh == NULL)
     {
       if (first_time)
-	start_symtab ("", NULL, 0);
+	start_compunit_symtab ("", NULL, 0);
       else
 	{
 	  gdb_assert (tug_unshare->symtabs == NULL);
@@ -10737,7 +10738,7 @@ dwarf2_cu::setup_type_unit_groups (struct die_info *die)
 
   if (first_time)
     {
-      struct compunit_symtab *cust = start_symtab ("", NULL, 0);
+      struct compunit_symtab *cust = start_compunit_symtab ("", NULL, 0);
 
       /* Note: We don't assign tu_group->compunit_symtab yet because we're
 	 still initializing it, and our caller (a few levels up)
diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c
index 8ede3d6aa26..b1c9ecdd610 100644
--- a/gdb/mdebugread.c
+++ b/gdb/mdebugread.c
@@ -3961,7 +3961,7 @@ mdebug_expand_psymtab (legacy_psymtab *pst, struct objfile *objfile)
 		    {
 		      valu += section_offsets[SECT_OFF_TEXT (objfile)];
 		      previous_stab_code = N_SO;
-		      cust = end_symtab (valu, SECT_OFF_TEXT (objfile));
+		      cust = end_compunit_symtab (valu, SECT_OFF_TEXT (objfile));
 		      end_stabs ();
 		      last_symtab_ended = 1;
 		    }
@@ -4021,7 +4021,8 @@ mdebug_expand_psymtab (legacy_psymtab *pst, struct objfile *objfile)
 
       if (! last_symtab_ended)
 	{
-	  cust = end_symtab (pst->raw_text_high (), SECT_OFF_TEXT (objfile));
+	  cust = end_compunit_symtab (pst->raw_text_high (),
+				      SECT_OFF_TEXT (objfile));
 	  end_stabs ();
 	}
 
diff --git a/gdb/stabsread.c b/gdb/stabsread.c
index c6821f893cb..5e85c34303c 100644
--- a/gdb/stabsread.c
+++ b/gdb/stabsread.c
@@ -4659,7 +4659,7 @@ stabsread_new_init (void)
 }
 
 /* Initialize anything that needs initializing at the same time as
-   start_symtab() is called.  */
+   start_compunit_symtab() is called.  */
 
 void
 start_stabs (void)
@@ -4675,7 +4675,7 @@ start_stabs (void)
   common_block_name = NULL;
 }
 
-/* Call after end_symtab().  */
+/* Call after end_compunit_symtab().  */
 
 void
 end_stabs (void)
diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c
index f6db7f9ff7e..e45fa275c09 100644
--- a/gdb/xcoffread.c
+++ b/gdb/xcoffread.c
@@ -415,7 +415,7 @@ add_stab_to_list (char *stabname, struct pending_stabs **stabvector)
    and return it in a newly created table.  If the old one is good
    enough, return the old one.  */
 /* FIXME: I think all this stuff can be replaced by just passing
-   sort_linevec = 1 to end_symtab.  */
+   sort_linevec = 1 to end_compunit_symtab.  */
 
 static struct linetable *
 arrange_linetable (struct linetable *oldLineTb)
@@ -514,7 +514,7 @@ arrange_linetable (struct linetable *oldLineTb)
 }
 
 /* include file support: C_BINCL/C_EINCL pairs will be kept in the 
-   following `IncludeChain'.  At the end of each symtab (end_symtab),
+   following `IncludeChain'.  At the end of each symtab (end_compunit_symtab),
    we will determine if we should create additional symtab's to
    represent if (the include files.  */
 
@@ -1042,8 +1042,8 @@ read_xcoff_symtab (struct objfile *objfile, legacy_psymtab *pst)
   pst_symtab_language = deduce_language_from_filename (filestring);
 
   start_stabs ();
-  start_symtab (objfile, filestring, NULL, file_start_addr,
-		pst_symtab_language);
+  start_compunit_symtab (objfile, filestring, NULL, file_start_addr,
+			 pst_symtab_language);
   record_debugformat (debugfmt);
   symnum = ((struct symloc *) pst->read_symtab_private)->first_symnum;
   max_symnum =
@@ -1130,14 +1130,14 @@ read_xcoff_symtab (struct objfile *objfile, legacy_psymtab *pst)
 	{
 	  if (get_last_source_file ())
 	    {
-	      pst->compunit_symtab = end_symtab (cur_src_end_addr,
-						 SECT_OFF_TEXT (objfile));
+	      pst->compunit_symtab = end_compunit_symtab
+		(cur_src_end_addr, SECT_OFF_TEXT (objfile));
 	      end_stabs ();
 	    }
 
 	  start_stabs ();
-	  start_symtab (objfile, "_globals_", NULL,
-			0, pst_symtab_language);
+	  start_compunit_symtab (objfile, "_globals_", NULL,
+				 0, pst_symtab_language);
 	  record_debugformat (debugfmt);
 	  cur_src_end_addr = first_object_file_end;
 	  /* Done with all files, everything from here on is globals.  */
@@ -1221,12 +1221,13 @@ read_xcoff_symtab (struct objfile *objfile, legacy_psymtab *pst)
 			{
 			  complete_symtab (filestring, file_start_addr);
 			  cur_src_end_addr = file_end_addr;
-			  end_symtab (file_end_addr, SECT_OFF_TEXT (objfile));
+			  end_compunit_symtab (file_end_addr,
+					       SECT_OFF_TEXT (objfile));
 			  end_stabs ();
 			  start_stabs ();
 			  /* Give all csects for this source file the same
 			     name.  */
-			  start_symtab (objfile, filestring, NULL,
+			  start_compunit_symtab (objfile, filestring, NULL,
 					0, pst_symtab_language);
 			  record_debugformat (debugfmt);
 			}
@@ -1327,7 +1328,7 @@ read_xcoff_symtab (struct objfile *objfile, legacy_psymtab *pst)
 
 	  complete_symtab (filestring, file_start_addr);
 	  cur_src_end_addr = file_end_addr;
-	  end_symtab (file_end_addr, SECT_OFF_TEXT (objfile));
+	  end_compunit_symtab (file_end_addr, SECT_OFF_TEXT (objfile));
 	  end_stabs ();
 
 	  /* XCOFF, according to the AIX 3.2 documentation, puts the
@@ -1346,7 +1347,8 @@ read_xcoff_symtab (struct objfile *objfile, legacy_psymtab *pst)
 	    filestring = cs->c_name;
 
 	  start_stabs ();
-	  start_symtab (objfile, filestring, NULL, 0, pst_symtab_language);
+	  start_compunit_symtab (objfile, filestring, NULL, 0,
+				 pst_symtab_language);
 	  record_debugformat (debugfmt);
 	  last_csect_name = 0;
 
@@ -1514,7 +1516,7 @@ read_xcoff_symtab (struct objfile *objfile, legacy_psymtab *pst)
 
       complete_symtab (filestring, file_start_addr);
       cur_src_end_addr = file_end_addr;
-      cust = end_symtab (file_end_addr, SECT_OFF_TEXT (objfile));
+      cust = end_compunit_symtab (file_end_addr, SECT_OFF_TEXT (objfile));
       /* When reading symbols for the last C_FILE of the objfile, try
 	 to make sure that we set pst->compunit_symtab to the symtab for the
 	 file, not to the _globals_ symtab.  I'm not sure whether this
-- 
2.35.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] gdb: remove some unused buildsym-legacy functions
  2022-03-28 22:17 [PATCH 1/2] gdb: remove some unused buildsym-legacy functions Simon Marchi
  2022-03-28 22:17 ` [PATCH 2/2] gdb: rename start_symtab/end_symtab to start_compunit_symtab/end_compunit_symtab Simon Marchi
@ 2022-04-04 16:30 ` Tom Tromey
  1 sibling, 0 replies; 5+ messages in thread
From: Tom Tromey @ 2022-04-04 16:30 UTC (permalink / raw)
  To: Simon Marchi via Gdb-patches; +Cc: Simon Marchi

>>>>> "Simon" == Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> writes:

Simon> Pretty much self-explanatory.

Thanks, this looks good to me.

Tom

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] gdb: rename start_symtab/end_symtab to start_compunit_symtab/end_compunit_symtab
  2022-03-28 22:17 ` [PATCH 2/2] gdb: rename start_symtab/end_symtab to start_compunit_symtab/end_compunit_symtab Simon Marchi
@ 2022-04-04 16:31   ` Tom Tromey
  2022-04-04 16:58     ` Simon Marchi
  0 siblings, 1 reply; 5+ messages in thread
From: Tom Tromey @ 2022-04-04 16:31 UTC (permalink / raw)
  To: Simon Marchi via Gdb-patches; +Cc: Simon Marchi

>>>>> "Simon" == Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> writes:

Simon> It's a bit confusing because we have both "compunit_symtab" and "symtab"
Simon> types, and many methods and functions containing "start_symtab" or
Simon> "end_symtab", which actually deal with compunit_symtabs.  I believe this
Simon> comes from the time before compunit_symtab was introduced, where
Simon> symtab did the job of both.

Simon> Rename everything I found containing start_symtab or end_symtab to use
Simon> start_compunit_symtab or end_compunit_symtab.

Seems reasonable to me.

Tom

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] gdb: rename start_symtab/end_symtab to start_compunit_symtab/end_compunit_symtab
  2022-04-04 16:31   ` Tom Tromey
@ 2022-04-04 16:58     ` Simon Marchi
  0 siblings, 0 replies; 5+ messages in thread
From: Simon Marchi @ 2022-04-04 16:58 UTC (permalink / raw)
  To: Tom Tromey, Simon Marchi via Gdb-patches

On 2022-04-04 12:31, Tom Tromey wrote:
>>>>>> "Simon" == Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> writes:
> 
> Simon> It's a bit confusing because we have both "compunit_symtab" and "symtab"
> Simon> types, and many methods and functions containing "start_symtab" or
> Simon> "end_symtab", which actually deal with compunit_symtabs.  I believe this
> Simon> comes from the time before compunit_symtab was introduced, where
> Simon> symtab did the job of both.
> 
> Simon> Rename everything I found containing start_symtab or end_symtab to use
> Simon> start_compunit_symtab or end_compunit_symtab.
> 
> Seems reasonable to me.
> 
> Tom


Thanks, pushed both patches.

Simon

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-04-04 16:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-28 22:17 [PATCH 1/2] gdb: remove some unused buildsym-legacy functions Simon Marchi
2022-03-28 22:17 ` [PATCH 2/2] gdb: rename start_symtab/end_symtab to start_compunit_symtab/end_compunit_symtab Simon Marchi
2022-04-04 16:31   ` Tom Tromey
2022-04-04 16:58     ` Simon Marchi
2022-04-04 16:30 ` [PATCH 1/2] gdb: remove some unused buildsym-legacy functions Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).