public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] gdb: remove MSYMBOL_TYPE macro
@ 2022-04-11 14:48 Simon Marchi
  0 siblings, 0 replies; only message in thread
From: Simon Marchi @ 2022-04-11 14:48 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=60f62e2b83eb362c5063247235c111a59e13cad1

commit 60f62e2b83eb362c5063247235c111a59e13cad1
Author: Simon Marchi <simon.marchi@efficios.com>
Date:   Fri Jan 28 10:28:57 2022 -0500

    gdb: remove MSYMBOL_TYPE macro
    
    Add a getter and a setter for a minimal symbol's type.  Remove the
    corresponding macro and adjust all callers.
    
    Change-Id: I89900df5ffa5687133fe1a16b2e0d4684e67a77d

Diff:
---
 gdb/ada-lang.c                      |  6 +++---
 gdb/breakpoint.c                    |  8 +++----
 gdb/c-exp.y                         |  4 ++--
 gdb/coff-pe-read.c                  |  2 +-
 gdb/coffread.c                      |  6 +++---
 gdb/compile/compile-c-symbols.c     |  4 ++--
 gdb/compile/compile-cplus-symbols.c |  4 ++--
 gdb/compile/compile-object-load.c   |  2 +-
 gdb/elfread.c                       |  2 +-
 gdb/linespec.c                      | 14 ++++++------
 gdb/minsyms.c                       | 43 ++++++++++++++++++-------------------
 gdb/parse.c                         |  4 ++--
 gdb/printcmd.c                      | 14 ++++++------
 gdb/stabsread.c                     |  2 +-
 gdb/symmisc.c                       |  2 +-
 gdb/symtab.c                        | 34 ++++++++++++++---------------
 gdb/symtab.h                        | 17 +++++++++++++--
 17 files changed, 90 insertions(+), 78 deletions(-)

diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 29f2a4b255a..ffe35500d68 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -4898,7 +4898,7 @@ ada_lookup_simple_minsym (const char *name)
       for (minimal_symbol *msymbol : objfile->msymbols ())
 	{
 	  if (match_name (msymbol->linkage_name (), lookup_name, NULL)
-	      && MSYMBOL_TYPE (msymbol) != mst_solib_trampoline)
+	      && msymbol->type () != mst_solib_trampoline)
 	    {
 	      result.minsym = msymbol;
 	      result.objfile = objfile;
@@ -11717,7 +11717,7 @@ ada_has_this_exception_support (const struct exception_support_info *einfo)
       struct bound_minimal_symbol msym
 	= lookup_minimal_symbol (einfo->catch_exception_sym, NULL, NULL);
 
-      if (msym.minsym && MSYMBOL_TYPE (msym.minsym) != mst_solib_trampoline)
+      if (msym.minsym && msym.minsym->type () != mst_solib_trampoline)
 	error (_("Your Ada runtime appears to be missing some debugging "
 		 "information.\nCannot insert Ada exception catchpoint "
 		 "in this configuration."));
@@ -11740,7 +11740,7 @@ ada_has_this_exception_support (const struct exception_support_info *einfo)
       struct bound_minimal_symbol msym
 	= lookup_minimal_symbol (einfo->catch_handlers_sym, NULL, NULL);
 
-      if (msym.minsym && MSYMBOL_TYPE (msym.minsym) != mst_solib_trampoline)
+      if (msym.minsym && msym.minsym->type () != mst_solib_trampoline)
 	error (_("Your Ada runtime appears to be missing some debugging "
 		 "information.\nCannot insert Ada exception catchpoint "
 		 "in this configuration."));
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index af7eb6cc113..1a227e5d120 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -3439,8 +3439,8 @@ create_std_terminate_master_breakpoint (void)
 	      struct bound_minimal_symbol m;
 
 	      m = lookup_minimal_symbol (func_name, NULL, objfile);
-	      if (m.minsym == NULL || (MSYMBOL_TYPE (m.minsym) != mst_text
-				       && MSYMBOL_TYPE (m.minsym) != mst_file_text))
+	      if (m.minsym == NULL || (m.minsym->type () != mst_text
+				       && m.minsym->type () != mst_file_text))
 		{
 		  /* Prevent future lookups in this objfile.  */
 		  bp_objfile_data->terminate_msym.minsym = &msym_not_found;
@@ -7175,8 +7175,8 @@ set_breakpoint_location_function (struct bp_location *loc)
       const char *function_name;
 
       if (loc->msymbol != NULL
-	  && (MSYMBOL_TYPE (loc->msymbol) == mst_text_gnu_ifunc
-	      || MSYMBOL_TYPE (loc->msymbol) == mst_data_gnu_ifunc))
+	  && (loc->msymbol->type () == mst_text_gnu_ifunc
+	      || loc->msymbol->type () == mst_data_gnu_ifunc))
 	{
 	  struct breakpoint *b = loc->owner;
 
diff --git a/gdb/c-exp.y b/gdb/c-exp.y
index 4fa3f8d2fc4..d852b1e8a36 100644
--- a/gdb/c-exp.y
+++ b/gdb/c-exp.y
@@ -1232,8 +1232,8 @@ variable:	name_not_typename
 				 is important for example for "p
 				 *__errno_location()".  */
 			      symbol *alias_target
-				= ((msymbol.minsym->type != mst_text_gnu_ifunc
-				    && msymbol.minsym->type != mst_data_gnu_ifunc)
+				= ((msymbol.minsym->type () != mst_text_gnu_ifunc
+				    && msymbol.minsym->type () != mst_data_gnu_ifunc)
 				   ? find_function_alias_target (msymbol)
 				   : NULL);
 			      if (alias_target != NULL)
diff --git a/gdb/coff-pe-read.c b/gdb/coff-pe-read.c
index 1f11606cdff..3ae2a7ffb13 100644
--- a/gdb/coff-pe-read.c
+++ b/gdb/coff-pe-read.c
@@ -245,7 +245,7 @@ add_pe_forwarded_sym (minimal_symbol_reader &reader,
 		sym_name, dll_name, forward_qualified_name);
 
   vma = msymbol.value_address ();
-  msymtype = MSYMBOL_TYPE (msymbol.minsym);
+  msymtype = msymbol.minsym->type ();
   section = msymbol.minsym->section_index ();
 
   /* Generate a (hopefully unique) qualified name using the first part
diff --git a/gdb/coffread.c b/gdb/coffread.c
index 24dd9b96011..f5ef1285440 100644
--- a/gdb/coffread.c
+++ b/gdb/coffread.c
@@ -647,7 +647,7 @@ coff_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
 	     or "_imp_", get rid of the prefix, and search the minimal
 	     symbol in OBJFILE.  Note that 'maintenance print msymbols'
 	     shows that type of these "_imp_XXXX" symbols is mst_data.  */
-	  if (MSYMBOL_TYPE (msym) == mst_data)
+	  if (msym->type () == mst_data)
 	    {
 	      const char *name1 = NULL;
 
@@ -669,8 +669,8 @@ coff_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
 		     respectively in OBJFILE.  Set the type of symbol "foo"
 		     as 'mst_solib_trampoline'.  */
 		  if (found.minsym != NULL
-		      && MSYMBOL_TYPE (found.minsym) == mst_text)
-		    MSYMBOL_TYPE (found.minsym) = mst_solib_trampoline;
+		      && found.minsym->type () == mst_text)
+		    found.minsym->set_type (mst_solib_trampoline);
 		}
 	    }
 	}
diff --git a/gdb/compile/compile-c-symbols.c b/gdb/compile/compile-c-symbols.c
index a50e84d117a..642c0be5db3 100644
--- a/gdb/compile/compile-c-symbols.c
+++ b/gdb/compile/compile-c-symbols.c
@@ -273,7 +273,7 @@ convert_symbol_bmsym (compile_c_instance *context,
   addr = msym->value_address (objfile);
 
   /* Conversion copied from write_exp_msymbol.  */
-  switch (MSYMBOL_TYPE (msym))
+  switch (msym->type ())
     {
     case mst_text:
     case mst_file_text:
@@ -422,7 +422,7 @@ gcc_symbol_address (void *datum, struct gcc_c_context *gcc_context,
 			    "symbol\n",
 			    identifier);
 	      result = msym.value_address ();
-	      if (MSYMBOL_TYPE (msym.minsym) == mst_text_gnu_ifunc)
+	      if (msym.minsym->type () == mst_text_gnu_ifunc)
 		result = gnu_ifunc_resolve_addr (target_gdbarch (), result);
 	      found = 1;
 	    }
diff --git a/gdb/compile/compile-cplus-symbols.c b/gdb/compile/compile-cplus-symbols.c
index b68184c55f9..7ad9ea91132 100644
--- a/gdb/compile/compile-cplus-symbols.c
+++ b/gdb/compile/compile-cplus-symbols.c
@@ -284,7 +284,7 @@ convert_symbol_bmsym (compile_cplus_instance *instance,
   addr = msym->value_address (objfile);
 
   /* Conversion copied from write_exp_msymbol.  */
-  switch (MSYMBOL_TYPE (msym))
+  switch (msym->type ())
     {
     case mst_text:
     case mst_file_text:
@@ -459,7 +459,7 @@ gcc_cplus_symbol_address (void *datum, struct gcc_cp_context *gcc_context,
 			    "symbol\n",
 			    identifier);
 	      result = msym.value_address ();
-	      if (MSYMBOL_TYPE (msym.minsym) == mst_text_gnu_ifunc)
+	      if (msym.minsym->type () == mst_text_gnu_ifunc)
 		result = gnu_ifunc_resolve_addr (target_gdbarch (), result);
 	      found = 1;
 	    }
diff --git a/gdb/compile/compile-object-load.c b/gdb/compile/compile-object-load.c
index bfb40c9625c..dee7882e7e3 100644
--- a/gdb/compile/compile-object-load.c
+++ b/gdb/compile/compile-object-load.c
@@ -766,7 +766,7 @@ compile_object_load (const compile_file_names &file_names,
 
       bmsym = lookup_minimal_symbol (sym->name, NULL, NULL);
       switch (bmsym.minsym == NULL
-	      ? mst_unknown : MSYMBOL_TYPE (bmsym.minsym))
+	      ? mst_unknown : bmsym.minsym->type ())
 	{
 	case mst_text:
 	case mst_bss:
diff --git a/gdb/elfread.c b/gdb/elfread.c
index 3f1f87650f2..6df206b19db 100644
--- a/gdb/elfread.c
+++ b/gdb/elfread.c
@@ -828,7 +828,7 @@ elf_gnu_ifunc_resolve_by_got (const char *name, CORE_ADDR *addr_p)
       msym = lookup_minimal_symbol (name_got_plt, NULL, objfile);
       if (msym.minsym == NULL)
 	continue;
-      if (MSYMBOL_TYPE (msym.minsym) != mst_slot_got_plt)
+      if (msym.minsym->type () != mst_slot_got_plt)
 	continue;
       pointer_address = msym.value_address ();
 
diff --git a/gdb/linespec.c b/gdb/linespec.c
index 3c176bea94e..ba89bd09b56 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -2228,11 +2228,11 @@ convert_linespec_to_sals (struct linespec_state *state, linespec *ls)
 
 		  for (const auto &elem : ls->minimal_symbols)
 		    {
-		      if (MSYMBOL_TYPE (elem.minsym) == mst_text_gnu_ifunc
-			  || MSYMBOL_TYPE (elem.minsym) == mst_data_gnu_ifunc)
+		      if (elem.minsym->type () == mst_text_gnu_ifunc
+			  || elem.minsym->type () == mst_data_gnu_ifunc)
 			{
 			  CORE_ADDR msym_addr = elem.value_address ();
-			  if (MSYMBOL_TYPE (elem.minsym) == mst_data_gnu_ifunc)
+			  if (elem.minsym->type () == mst_data_gnu_ifunc)
 			    {
 			      struct gdbarch *gdbarch
 				= elem.objfile->arch ();
@@ -4146,8 +4146,8 @@ minsym_found (struct linespec_state *self, struct objfile *objfile,
     {
       const char *msym_name = msymbol->linkage_name ();
 
-      if (MSYMBOL_TYPE (msymbol) == mst_text_gnu_ifunc
-	  || MSYMBOL_TYPE (msymbol) == mst_data_gnu_ifunc)
+      if (msymbol->type () == mst_text_gnu_ifunc
+	  || msymbol->type () == mst_data_gnu_ifunc)
 	want_start_sal = gnu_ifunc_resolve_name (msym_name, &func_addr);
       else
 	want_start_sal = true;
@@ -4284,7 +4284,7 @@ search_minsyms_for_name (struct collect_info *info,
   for (const bound_minimal_symbol &item : minsyms)
     {
       bool skip = false;
-      if (MSYMBOL_TYPE (item.minsym) == mst_solib_trampoline)
+      if (item.minsym->type () == mst_solib_trampoline)
 	{
 	  for (const bound_minimal_symbol &item2 : minsyms)
 	    {
@@ -4293,7 +4293,7 @@ search_minsyms_for_name (struct collect_info *info,
 
 	      /* Trampoline symbols can only jump to exported
 		 symbols.  */
-	      if (msymbol_type_is_static (MSYMBOL_TYPE (item2.minsym)))
+	      if (msymbol_type_is_static (item2.minsym->type ()))
 		continue;
 
 	      if (strcmp (item.minsym->linkage_name (),
diff --git a/gdb/minsyms.c b/gdb/minsyms.c
index e93cbed8621..11d357b8096 100644
--- a/gdb/minsyms.c
+++ b/gdb/minsyms.c
@@ -115,7 +115,7 @@ msymbol_is_function (struct objfile *objfile, minimal_symbol *minsym,
 {
   CORE_ADDR msym_addr = minsym->value_address (objfile);
 
-  switch (minsym->type)
+  switch (minsym->type ())
     {
     case mst_slot_got_plt:
     case mst_data:
@@ -253,7 +253,7 @@ found_minimal_symbols::maybe_collect (const char *sfile,
 				      struct objfile *objfile,
 				      minimal_symbol *msymbol)
 {
-  switch (MSYMBOL_TYPE (msymbol))
+  switch (msymbol->type ())
     {
     case mst_file_text:
     case mst_file_data:
@@ -586,8 +586,8 @@ lookup_minimal_symbol_linkage (const char *name, struct objfile *objf)
 	   msymbol = msymbol->hash_next)
 	{
 	  if (strcmp (msymbol->linkage_name (), name) == 0
-	      && (MSYMBOL_TYPE (msymbol) == mst_data
-		  || MSYMBOL_TYPE (msymbol) == mst_bss))
+	      && (msymbol->type () == mst_data
+		  || msymbol->type () == mst_bss))
 	    return {msymbol, objfile};
 	}
     }
@@ -619,11 +619,11 @@ lookup_minimal_symbol_text (const char *name, struct objfile *objf)
 	       msymbol = msymbol->hash_next)
 	    {
 	      if (strcmp (msymbol->linkage_name (), name) == 0 &&
-		  (MSYMBOL_TYPE (msymbol) == mst_text
-		   || MSYMBOL_TYPE (msymbol) == mst_text_gnu_ifunc
-		   || MSYMBOL_TYPE (msymbol) == mst_file_text))
+		  (msymbol->type () == mst_text
+		   || msymbol->type () == mst_text_gnu_ifunc
+		   || msymbol->type () == mst_file_text))
 		{
-		  switch (MSYMBOL_TYPE (msymbol))
+		  switch (msymbol->type ())
 		    {
 		    case mst_file_text:
 		      found_file_symbol.minsym = msymbol;
@@ -840,7 +840,7 @@ lookup_minimal_symbol_by_pc_section (CORE_ADDR pc_in, struct obj_section *sectio
 		     triggered by a special mst_abs_or_lib or some
 		     such.  */
 
-		  if (MSYMBOL_TYPE (&msymbol[hi]) == mst_abs)
+		  if (msymbol[hi].type () == mst_abs)
 		    {
 		      hi--;
 		      continue;
@@ -866,8 +866,8 @@ lookup_minimal_symbol_by_pc_section (CORE_ADDR pc_in, struct obj_section *sectio
 		     preceding symbol too.  If they are otherwise
 		     identical prefer that one.  */
 		  if (hi > 0
-		      && MSYMBOL_TYPE (&msymbol[hi]) != want_type
-		      && MSYMBOL_TYPE (&msymbol[hi - 1]) == want_type
+		      && msymbol[hi].type () != want_type
+		      && msymbol[hi - 1].type () == want_type
 		      && (MSYMBOL_SIZE (&msymbol[hi])
 			  == MSYMBOL_SIZE (&msymbol[hi - 1]))
 		      && (msymbol[hi].value_raw_address ()
@@ -993,7 +993,7 @@ in_gnu_ifunc_stub (CORE_ADDR pc)
   bound_minimal_symbol msymbol
     = lookup_minimal_symbol_by_pc_section (pc, NULL,
 					   lookup_msym_prefer::GNU_IFUNC);
-  return msymbol.minsym && MSYMBOL_TYPE (msymbol.minsym) == mst_text_gnu_ifunc;
+  return msymbol.minsym && msymbol.minsym->type () == mst_text_gnu_ifunc;
 }
 
 /* See elf_gnu_ifunc_resolve_addr for its real implementation.  */
@@ -1211,7 +1211,7 @@ minimal_symbol_reader::record_full (gdb::string_view name,
   msymbol->set_value_address (address);
   msymbol->set_section_index (section);
 
-  MSYMBOL_TYPE (msymbol) = ms_type;
+  msymbol->set_type (ms_type);
 
   /* If we already read minimal symbols for this objfile, then don't
      ever allocate a new one.  */
@@ -1303,10 +1303,9 @@ compact_minimal_symbols (struct minimal_symbol *msymbol, int mcount,
 	      && strcmp (copyfrom->linkage_name (),
 			 (copyfrom + 1)->linkage_name ()) == 0)
 	    {
-	      if (MSYMBOL_TYPE ((copyfrom + 1)) == mst_unknown)
-		{
-		  MSYMBOL_TYPE ((copyfrom + 1)) = MSYMBOL_TYPE (copyfrom);
-		}
+	      if ((copyfrom + 1)->type () == mst_unknown)
+		(copyfrom + 1)->set_type (copyfrom->type ());
+
 	      copyfrom++;
 	    }
 	  else
@@ -1530,7 +1529,7 @@ lookup_solib_trampoline_symbol_by_pc (CORE_ADDR pc)
 					   lookup_msym_prefer::TRAMPOLINE);
 
   if (msymbol.minsym != NULL
-      && MSYMBOL_TYPE (msymbol.minsym) == mst_solib_trampoline)
+      && msymbol.minsym->type () == mst_solib_trampoline)
     return msymbol.minsym;
   return NULL;
 }
@@ -1558,10 +1557,10 @@ find_solib_trampoline_target (struct frame_info *frame, CORE_ADDR pc)
 	    {
 	      /* Also handle minimal symbols pointing to function
 		 descriptors.  */
-	      if ((MSYMBOL_TYPE (msymbol) == mst_text
-		   || MSYMBOL_TYPE (msymbol) == mst_text_gnu_ifunc
-		   || MSYMBOL_TYPE (msymbol) == mst_data
-		   || MSYMBOL_TYPE (msymbol) == mst_data_gnu_ifunc)
+	      if ((msymbol->type () == mst_text
+		   || msymbol->type () == mst_text_gnu_ifunc
+		   || msymbol->type () == mst_data
+		   || msymbol->type () == mst_data_gnu_ifunc)
 		  && strcmp (msymbol->linkage_name (),
 			     tsymbol->linkage_name ()) == 0)
 		{
diff --git a/gdb/parse.c b/gdb/parse.c
index 2389dbf0b0f..73669923890 100644
--- a/gdb/parse.c
+++ b/gdb/parse.c
@@ -103,7 +103,7 @@ find_minsym_type_and_address (minimal_symbol *msymbol,
 {
   bound_minimal_symbol bound_msym = {msymbol, objfile};
   struct obj_section *section = msymbol->obj_section (objfile);
-  enum minimal_symbol_type type = MSYMBOL_TYPE (msymbol);
+  enum minimal_symbol_type type = msymbol->type ();
 
   bool is_tls = (section != NULL
 		 && section->the_bfd_section->flags & SEC_THREAD_LOCAL);
@@ -124,7 +124,7 @@ find_minsym_type_and_address (minimal_symbol *msymbol,
 	  /* This means we resolved a function descriptor, and we now
 	     have an address for a code/text symbol instead of a data
 	     symbol.  */
-	  if (MSYMBOL_TYPE (msymbol) == mst_data_gnu_ifunc)
+	  if (msymbol->type () == mst_data_gnu_ifunc)
 	    type = mst_text_gnu_ifunc;
 	  else
 	    type = mst_text;
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index e870b35cf38..19add04d3b3 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -655,9 +655,9 @@ build_address_symbolic (struct gdbarch *gdbarch,
   if (msymbol.minsym != NULL
       && MSYMBOL_HAS_SIZE (msymbol.minsym)
       && MSYMBOL_SIZE (msymbol.minsym) == 0
-      && MSYMBOL_TYPE (msymbol.minsym) != mst_text
-      && MSYMBOL_TYPE (msymbol.minsym) != mst_text_gnu_ifunc
-      && MSYMBOL_TYPE (msymbol.minsym) != mst_file_text)
+      && msymbol.minsym->type () != mst_text
+      && msymbol.minsym->type () != mst_text_gnu_ifunc
+      && msymbol.minsym->type () != mst_file_text)
     msymbol.minsym = NULL;
 
   if (msymbol.minsym != NULL)
@@ -681,10 +681,10 @@ build_address_symbolic (struct gdbarch *gdbarch,
 	     first instruction of a Thumb function as <function>; the
 	     second instruction will be <function+2>, even though the
 	     pointer is <function+3>.  This matches the ISA behavior.  */
-	  if (MSYMBOL_TYPE (msymbol.minsym) == mst_text
-	      || MSYMBOL_TYPE (msymbol.minsym) == mst_text_gnu_ifunc
-	      || MSYMBOL_TYPE (msymbol.minsym) == mst_file_text
-	      || MSYMBOL_TYPE (msymbol.minsym) == mst_solib_trampoline)
+	  if (msymbol.minsym->type () == mst_text
+	      || msymbol.minsym->type () == mst_text_gnu_ifunc
+	      || msymbol.minsym->type () == mst_file_text
+	      || msymbol.minsym->type () == mst_solib_trampoline)
 	    addr = gdbarch_addr_bits_remove (gdbarch, addr);
 
 	  symbol = 0;
diff --git a/gdb/stabsread.c b/gdb/stabsread.c
index 3f173da71d5..4fe2110a47f 100644
--- a/gdb/stabsread.c
+++ b/gdb/stabsread.c
@@ -4538,7 +4538,7 @@ scan_file_globals (struct objfile *objfile)
 	  QUIT;
 
 	  /* Skip static symbols.  */
-	  switch (MSYMBOL_TYPE (msymbol))
+	  switch (msymbol->type ())
 	    {
 	    case mst_file_text:
 	    case mst_file_data:
diff --git a/gdb/symmisc.c b/gdb/symmisc.c
index 1bc5f9f0bd9..18741e4cab5 100644
--- a/gdb/symmisc.c
+++ b/gdb/symmisc.c
@@ -160,7 +160,7 @@ dump_msymbols (struct objfile *objfile, struct ui_file *outfile)
     {
       struct obj_section *section = msymbol->obj_section (objfile);
 
-      switch (MSYMBOL_TYPE (msymbol))
+      switch (msymbol->type ())
 	{
 	case mst_unknown:
 	  ms_type = 'u';
diff --git a/gdb/symtab.c b/gdb/symtab.c
index d15eec8b6b4..a75492603b8 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -432,11 +432,11 @@ minimal_symbol::value_address (objfile *objfile) const
 bool
 minimal_symbol::data_p () const
 {
-  return type == mst_data
-    || type == mst_bss
-    || type == mst_abs
-    || type == mst_file_data
-    || type == mst_file_bss;
+  return m_type == mst_data
+    || m_type == mst_bss
+    || m_type == mst_abs
+    || m_type == mst_file_data
+    || m_type == mst_file_bss;
 }
 
 /* See symtab.h.  */
@@ -444,12 +444,12 @@ minimal_symbol::data_p () const
 bool
 minimal_symbol::text_p () const
 {
-  return type == mst_text
-    || type == mst_text_gnu_ifunc
-    || type == mst_data_gnu_ifunc
-    || type == mst_slot_got_plt
-    || type == mst_solib_trampoline
-    || type == mst_file_text;
+  return m_type == mst_text
+    || m_type == mst_text_gnu_ifunc
+    || m_type == mst_data_gnu_ifunc
+    || m_type == mst_slot_got_plt
+    || m_type == mst_solib_trampoline
+    || m_type == mst_file_text;
 }
 
 /* See whether FILENAME matches SEARCH_NAME using the rule that we
@@ -3238,7 +3238,7 @@ find_pc_sect_line (CORE_ADDR pc, struct obj_section *section, int notcurrent)
    */
   msymbol = lookup_minimal_symbol_by_pc (pc);
   if (msymbol.minsym != NULL)
-    if (MSYMBOL_TYPE (msymbol.minsym) == mst_solib_trampoline)
+    if (msymbol.minsym->type () == mst_solib_trampoline)
       {
 	struct bound_minimal_symbol mfunsym
 	  = lookup_minimal_symbol_text (msymbol.minsym->linkage_name (),
@@ -4751,7 +4751,7 @@ bool
 global_symbol_searcher::is_suitable_msymbol
 	(const enum search_domain kind, const minimal_symbol *msymbol)
 {
-  switch (MSYMBOL_TYPE (msymbol))
+  switch (msymbol->type ())
     {
     case mst_data:
     case mst_bss:
@@ -5767,7 +5767,7 @@ symbol_is_function_or_method (symbol *sym)
 bool
 symbol_is_function_or_method (minimal_symbol *msymbol)
 {
-  switch (MSYMBOL_TYPE (msymbol))
+  switch (msymbol->type ())
     {
     case mst_text:
     case mst_text_gnu_ifunc:
@@ -5797,11 +5797,11 @@ find_gnu_ifunc (const symbol *sym)
   iterate_over_minimal_symbols (objfile, lookup_name,
 				[&] (minimal_symbol *minsym)
     {
-      if (MSYMBOL_TYPE (minsym) == mst_text_gnu_ifunc
-	  || MSYMBOL_TYPE (minsym) == mst_data_gnu_ifunc)
+      if (minsym->type () == mst_text_gnu_ifunc
+	  || minsym->type () == mst_data_gnu_ifunc)
 	{
 	  CORE_ADDR msym_addr = minsym->value_address (objfile);
-	  if (MSYMBOL_TYPE (minsym) == mst_data_gnu_ifunc)
+	  if (minsym->type () == mst_data_gnu_ifunc)
 	    {
 	      struct gdbarch *gdbarch = objfile->arch ();
 	      msym_addr = gdbarch_convert_from_func_ptr_addr
diff --git a/gdb/symtab.h b/gdb/symtab.h
index 390ee9d0d67..3bb23d6f7ef 100644
--- a/gdb/symtab.h
+++ b/gdb/symtab.h
@@ -699,6 +699,20 @@ struct minimal_symbol : public general_symbol_info
     return m_value.address;
   }
 
+  /* Return this minimal symbol's type.  */
+
+  minimal_symbol_type type () const
+  {
+    return m_type;
+  }
+
+  /* Set this minimal symbol's type.  */
+
+  void set_type (minimal_symbol_type type)
+  {
+    m_type = type;
+  }
+
   /* Size of this symbol.  dbx_end_psymtab in dbxread.c uses this
      information to calculate the end of the partial symtab based on the
      address of the last symbol plus the size of the last symbol.  */
@@ -710,7 +724,7 @@ struct minimal_symbol : public general_symbol_info
 
   /* Classification type for this minimal symbol.  */
 
-  ENUM_BITFIELD(minimal_symbol_type) type : MINSYM_TYPE_BITS;
+  ENUM_BITFIELD(minimal_symbol_type) m_type : MINSYM_TYPE_BITS;
 
   /* Non-zero if this symbol was created by gdb.
      Such symbols do not appear in the output of "info var|fun".  */
@@ -766,7 +780,6 @@ struct minimal_symbol : public general_symbol_info
       (msymbol)->has_size = 1;			\
     } while (0)
 #define MSYMBOL_HAS_SIZE(msymbol)	((msymbol)->has_size + 0)
-#define MSYMBOL_TYPE(msymbol)		(msymbol)->type
 
 #include "minsyms.h"


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-04-11 14:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-11 14:48 [binutils-gdb] gdb: remove MSYMBOL_TYPE macro Simon Marchi

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).