public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@polymtl.ca>
To: gdb-patches@sourceware.org
Cc: Simon Marchi <simon.marchi@efficios.com>
Subject: [PATCH 4/4] gdb: remove MSYMBOL_TARGET_FLAG_{1,2} macros
Date: Sun, 10 Apr 2022 08:51:56 -0400	[thread overview]
Message-ID: <20220410125156.2440992-4-simon.marchi@polymtl.ca> (raw)
In-Reply-To: <20220410125156.2440992-1-simon.marchi@polymtl.ca>

From: Simon Marchi <simon.marchi@efficios.com>

Replace with equivalent getter/setter macros.

Change-Id: I1042564dd47347337374762bd64ec31b5c573ee2
---
 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         | 27 ++++++++++++++++++++++-----
 6 files changed, 43 insertions(+), 17 deletions(-)

diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index 7002bcaa279f..cc7773914d72 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 e82b18a848fc..98f1367423eb 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 ec95d5454ab8..f31dacd4c7c3 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 f0a74409d9b3..4d2664d42731 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 a11f3672393b..4c5f8b7a281c 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 43ea140a64a0..498840143707 100644
--- a/gdb/symtab.h
+++ b/gdb/symtab.h
@@ -725,6 +725,26 @@ struct minimal_symbol : public general_symbol_info
     return m_has_size;
   }
 
+  bool target_flag_1 () const
+  {
+    return m_target_flag_1;
+  }
+
+  void set_target_flag_1 (bool target_flag_1)
+  {
+    m_target_flag_1 = target_flag_1;
+  }
+
+  bool target_flag_2 () const
+  {
+    return m_target_flag_2;
+  }
+
+  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.  */
@@ -743,8 +763,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
@@ -782,9 +802,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"
 
 \f
-- 
2.35.1


  parent reply	other threads:[~2022-04-10 12:52 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-10 12:51 [PATCH 1/4] gdb: remove symbol value macros Simon Marchi
2022-04-10 12:51 ` [PATCH 2/4] gdb: remove MSYMBOL_TYPE macro Simon Marchi
2022-04-12 15:54   ` Tom Tromey
2022-04-10 12:51 ` [PATCH 3/4] gdb: remove minimal symbol size macros Simon Marchi
2022-04-12 15:54   ` Tom Tromey
2022-04-10 12:51 ` Simon Marchi [this message]
2022-04-12 15:55   ` [PATCH 4/4] gdb: remove MSYMBOL_TARGET_FLAG_{1,2} macros Tom Tromey
2022-04-10 21:36 ` [PATCH 1/4] gdb: remove symbol value macros Tom Tromey
2022-04-10 21:36 ` Tom Tromey
2022-04-11 14:48   ` Simon Marchi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220410125156.2440992-4-simon.marchi@polymtl.ca \
    --to=simon.marchi@polymtl.ca \
    --cc=gdb-patches@sourceware.org \
    --cc=simon.marchi@efficios.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).