Patchwork [RFA,07/15] Change symbol_set_names to take an objfile_per_bfd_storage

login
register
mail settings
Submitter Tom Tromey
Date May 10, 2018, 10:23 p.m.
Message ID <20180510222357.27332-8-tom@tromey.com>
Download mbox | patch
Permalink /patch/27223/
State New
Headers show

Comments

Tom Tromey - May 10, 2018, 10:23 p.m.
This changes symbol_set_names to take an objfile_per_bfd_storage
argument, and updates the users.  It also changes PSYMBOL_SET_NAMES to
take this argument directly; I feel this clarifies the storage
location of objects created in psymtab.c.

2018-05-09  Tom Tromey  <tom@tromey.com>

	* symtab.h (SYMBOL_SET_NAMES): Update.
	(symbol_set_names): Update.
	(MSYMBOL_SET_NAMES): Update.
	* symtab.c (symbol_set_names): Change argument to be an
	objfile_per_bfd_storage.
	* psymtab.c (add_psymbol_to_bcache): Update.
	* psympriv.h (PSYMBOL_SET_NAMES): Take per_bfd argument.
---
 gdb/ChangeLog  | 10 ++++++++++
 gdb/psympriv.h |  4 ++--
 gdb/psymtab.c  |  2 +-
 gdb/symtab.c   |  3 +--
 gdb/symtab.h   |  8 +++++---
 5 files changed, 19 insertions(+), 8 deletions(-)

Patch

diff --git a/gdb/psympriv.h b/gdb/psympriv.h
index 32c9ee1199..7673eaef39 100644
--- a/gdb/psympriv.h
+++ b/gdb/psympriv.h
@@ -66,8 +66,8 @@  struct partial_symbol
 
 #define PSYMBOL_SET_LANGUAGE(symbol,language,obstack)	\
   (symbol_set_language (&(symbol)->pginfo, (language), (obstack)))
-#define PSYMBOL_SET_NAMES(symbol,linkage_name,len,copy_name,objfile)	\
-  symbol_set_names (&(symbol)->pginfo, linkage_name, len, copy_name, objfile)
+#define PSYMBOL_SET_NAMES(symbol,linkage_name,len,copy_name,per_bfd)	\
+  symbol_set_names (&(symbol)->pginfo, linkage_name, len, copy_name, per_bfd)
 
 #define PSYMBOL_LINKAGE_NAME(symbol)	(symbol)->pginfo.name
 #define PSYMBOL_DEMANGLED_NAME(symbol) \
diff --git a/gdb/psymtab.c b/gdb/psymtab.c
index c1c8cba800..a966b39730 100644
--- a/gdb/psymtab.c
+++ b/gdb/psymtab.c
@@ -1673,7 +1673,7 @@  add_psymbol_to_bcache (const char *name, int namelength, int copy_name,
   PSYMBOL_DOMAIN (&psymbol) = domain;
   PSYMBOL_CLASS (&psymbol) = theclass;
 
-  PSYMBOL_SET_NAMES (&psymbol, name, namelength, copy_name, objfile);
+  PSYMBOL_SET_NAMES (&psymbol, name, namelength, copy_name, objfile->per_bfd);
 
   /* Stash the partial symbol away in the cache.  */
   return psymbol_bcache_full (&psymbol, objfile->psymbol_cache, added);
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 7426770e9e..4af4848859 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -773,13 +773,12 @@  symbol_find_demangled_name (struct general_symbol_info *gsymbol,
 void
 symbol_set_names (struct general_symbol_info *gsymbol,
 		  const char *linkage_name, int len, int copy_name,
-		  struct objfile *objfile)
+		  struct objfile_per_bfd_storage *per_bfd)
 {
   struct demangled_name_entry **slot;
   /* A 0-terminated copy of the linkage name.  */
   const char *linkage_name_copy;
   struct demangled_name_entry entry;
-  struct objfile_per_bfd_storage *per_bfd = objfile->per_bfd;
 
   if (gsymbol->language == language_ada)
     {
diff --git a/gdb/symtab.h b/gdb/symtab.h
index 84fc897658..cc97452b3d 100644
--- a/gdb/symtab.h
+++ b/gdb/symtab.h
@@ -492,10 +492,11 @@  extern void symbol_set_language (struct general_symbol_info *symbol,
 /* Set the linkage and natural names of a symbol, by demangling
    the linkage name.  */
 #define SYMBOL_SET_NAMES(symbol,linkage_name,len,copy_name,objfile)	\
-  symbol_set_names (&(symbol)->ginfo, linkage_name, len, copy_name, objfile)
+  symbol_set_names (&(symbol)->ginfo, linkage_name, len, copy_name, \
+		    (objfile)->per_bfd)
 extern void symbol_set_names (struct general_symbol_info *symbol,
 			      const char *linkage_name, int len, int copy_name,
-			      struct objfile *objfile);
+			      struct objfile_per_bfd_storage *per_bfd);
 
 /* Now come lots of name accessor macros.  Short version as to when to
    use which: Use SYMBOL_NATURAL_NAME to refer to the name of the
@@ -732,7 +733,8 @@  struct minimal_symbol
 #define MSYMBOL_SEARCH_NAME(symbol)					 \
    (symbol_search_name (&(symbol)->mginfo))
 #define MSYMBOL_SET_NAMES(symbol,linkage_name,len,copy_name,objfile)	\
-  symbol_set_names (&(symbol)->mginfo, linkage_name, len, copy_name, objfile)
+  symbol_set_names (&(symbol)->mginfo, linkage_name, len, copy_name, \
+		    (objfile)->per_bfd)
 
 #include "minsyms.h"