public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] gdb: remove MSYMBOL_TARGET_FLAG_{1,2} macros
@ 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=e165fcef1e79529442d6a5d8def71681c088cd18

commit e165fcef1e79529442d6a5d8def71681c088cd18
Author: Simon Marchi <simon.marchi@efficios.com>
Date:   Fri Jan 28 10:51:22 2022 -0500

    gdb: remove MSYMBOL_TARGET_FLAG_{1,2} macros
    
    Replace with equivalent getter/setter macros.
    
    Change-Id: I1042564dd47347337374762bd64ec31b5c573ee2

Diff:
---
 gdb/arm-tdep.c       |  4 ++--
 gdb/m68hc11-tdep.c   |  8 ++++----
 gdb/mips-tdep.c      |  4 ++--
 gdb/mips-tdep.h      | 13 +++++++++++--
 gdb/ppc-linux-tdep.c |  4 ++--
 gdb/symtab.h         | 35 ++++++++++++++++++++++++++++++-----
 6 files changed, 51 insertions(+), 17 deletions(-)

diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index 7002bcaa279..cc7773914d7 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -82,10 +82,10 @@ static bool arm_debug;
    MSYMBOL_IS_SPECIAL   Tests the "special" bit in a minimal symbol.  */
 
 #define MSYMBOL_SET_SPECIAL(msym)				\
-	MSYMBOL_TARGET_FLAG_1 (msym) = 1
+	(msym)->set_target_flag_1 (true)
 
 #define MSYMBOL_IS_SPECIAL(msym)				\
-	MSYMBOL_TARGET_FLAG_1 (msym)
+	(msym)->target_flag_1 ()
 
 struct arm_mapping_symbol
 {
diff --git a/gdb/m68hc11-tdep.c b/gdb/m68hc11-tdep.c
index e82b18a848f..98f1367423e 100644
--- a/gdb/m68hc11-tdep.c
+++ b/gdb/m68hc11-tdep.c
@@ -58,16 +58,16 @@
    MSYMBOL_IS_RTI       Tests the "RTC" bit in a minimal symbol.  */
 
 #define MSYMBOL_SET_RTC(msym)                           \
-	MSYMBOL_TARGET_FLAG_1 (msym) = 1
+	(msym)->set_target_flag_1 (true)
 
 #define MSYMBOL_SET_RTI(msym)                           \
-	MSYMBOL_TARGET_FLAG_2 (msym) = 1
+	(msym)->set_target_flag_2 (true)
 
 #define MSYMBOL_IS_RTC(msym)				\
-	MSYMBOL_TARGET_FLAG_1 (msym)
+	(msym)->target_flag_1 ()
 
 #define MSYMBOL_IS_RTI(msym)				\
-	MSYMBOL_TARGET_FLAG_2 (msym)
+	(msym)->target_flag_2 ()
 
 enum insn_return_kind {
   RETURN_RTS,
diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index ec95d5454ab..f31dacd4c7c 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -435,12 +435,12 @@ mips_elf_make_msymbol_special (asymbol * sym, struct minimal_symbol *msym)
 
   if (ELF_ST_IS_MICROMIPS (st_other))
     {
-      MSYMBOL_TARGET_FLAG_MICROMIPS (msym) = 1;
+      SET_MSYMBOL_TARGET_FLAG_MICROMIPS (msym);
       msym->set_value_address (msym->value_raw_address () | 1);
     }
   else if (ELF_ST_IS_MIPS16 (st_other))
     {
-      MSYMBOL_TARGET_FLAG_MIPS16 (msym) = 1;
+      SET_MSYMBOL_TARGET_FLAG_MIPS16 (msym);
       msym->set_value_address (msym->value_raw_address () | 1);
     }
 }
diff --git a/gdb/mips-tdep.h b/gdb/mips-tdep.h
index f0a74409d9b..4d2664d4273 100644
--- a/gdb/mips-tdep.h
+++ b/gdb/mips-tdep.h
@@ -50,8 +50,17 @@ enum mips_isa
   };
 
 /* Corresponding MSYMBOL_TARGET_FLAG aliases.  */
-#define MSYMBOL_TARGET_FLAG_MIPS16 MSYMBOL_TARGET_FLAG_1
-#define MSYMBOL_TARGET_FLAG_MICROMIPS MSYMBOL_TARGET_FLAG_2
+#define MSYMBOL_TARGET_FLAG_MIPS16(sym) \
+	(sym)->target_flag_1 ()
+
+#define SET_MSYMBOL_TARGET_FLAG_MIPS16(sym) \
+	(sym)->set_target_flag_1 (true)
+
+#define MSYMBOL_TARGET_FLAG_MICROMIPS(sym) \
+	(sym)->target_flag_2 ()
+
+#define SET_MSYMBOL_TARGET_FLAG_MICROMIPS(sym) \
+	(sym)->set_target_flag_2 (true)
 
 /* Return the MIPS ISA's register size.  Just a short cut to the BFD
    architecture's word size.  */
diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c
index a11f3672393..4c5f8b7a281 100644
--- a/gdb/ppc-linux-tdep.c
+++ b/gdb/ppc-linux-tdep.c
@@ -1639,7 +1639,7 @@ ppc_elfv2_elf_make_msymbol_special (asymbol *sym, struct minimal_symbol *msym)
     default:
       break;
     case 8:
-      MSYMBOL_TARGET_FLAG_1 (msym) = 1;
+      msym->set_target_flag_1 (true);
       break;
     }
 }
@@ -1659,7 +1659,7 @@ ppc_elfv2_skip_entrypoint (struct gdbarch *gdbarch, CORE_ADDR pc)
 
   /* See ppc_elfv2_elf_make_msymbol_special for how local entry point
      offset values are encoded.  */
-  if (MSYMBOL_TARGET_FLAG_1 (fun.minsym))
+  if (fun.minsym->target_flag_1 ())
     local_entry_offset = 8;
 
   if (fun.value_address () <= pc
diff --git a/gdb/symtab.h b/gdb/symtab.h
index e82572cdd50..11e89959e09 100644
--- a/gdb/symtab.h
+++ b/gdb/symtab.h
@@ -735,6 +735,34 @@ struct minimal_symbol : public general_symbol_info
     return m_has_size;
   }
 
+  /* Return this minimal symbol's first target-specific flag.  */
+
+  bool target_flag_1 () const
+  {
+    return m_target_flag_1;
+  }
+
+  /* Set this minimal symbol's first target-specific flag.  */
+
+  void set_target_flag_1 (bool target_flag_1)
+  {
+    m_target_flag_1 = target_flag_1;
+  }
+
+  /* Return this minimal symbol's second target-specific flag.  */
+
+  bool target_flag_2 () const
+  {
+    return m_target_flag_2;
+  }
+
+  /* Set this minimal symbol's second target-specific flag.  */
+
+  void set_target_flag_2 (bool target_flag_2)
+  {
+    m_target_flag_2 = target_flag_2;
+  }
+
   /* 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.  */
@@ -753,8 +781,8 @@ struct minimal_symbol : public general_symbol_info
   unsigned int created_by_gdb : 1;
 
   /* Two flag bits provided for the use of the target.  */
-  unsigned int target_flag_1 : 1;
-  unsigned int target_flag_2 : 1;
+  unsigned int m_target_flag_1 : 1;
+  unsigned int m_target_flag_2 : 1;
 
   /* Nonzero iff the size of the minimal symbol has been set.
      Symbol size information can sometimes not be determined, because
@@ -792,9 +820,6 @@ struct minimal_symbol : public general_symbol_info
   bool text_p () const;
 };
 
-#define MSYMBOL_TARGET_FLAG_1(msymbol)  (msymbol)->target_flag_1
-#define MSYMBOL_TARGET_FLAG_2(msymbol)  (msymbol)->target_flag_2
-
 #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_TARGET_FLAG_{1,2} macros 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).