[PATCH 17/22] gdb: add type::is_gnu_ifunc / type::set_is_gnu_ifunc

Simon Marchi simon.marchi@efficios.com
Tue Aug 18 16:58:36 GMT 2020


Add the `is_gnu_ifunc` and `set_is_gnu_ifunc` methods on `struct type`, in
order to remove the `TYPE_GNU_IFUNC` macro.  In this patch, the macro is
changed to use the getter, so all the call sites of the macro that are
used as a setter are changed to use the setter method directly.  The
next patch will remove the macro completely.

gdb/ChangeLog:

	* gdbtypes.h (struct type) <is_gnu_ifunc, set_is_gnu_ifunc>: New methods.
	(TYPE_GNU_IFUNC): Use type::is_gnu_ifunc, change all write call sites to
	use type::set_is_gnu_ifunc.

Change-Id: Ic23ba8c5b8e589d9fc368385111aa16a94e014e2
---
 gdb/gdbtypes.c |  4 +++-
 gdb/gdbtypes.h | 14 ++++++++++++--
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index b1f00d66050..80f16d62283 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -5927,10 +5927,12 @@ objfile_type (struct objfile *objfile)
   objfile_type->nodebug_text_symbol
     = init_type (objfile, TYPE_CODE_FUNC, TARGET_CHAR_BIT,
 		 "<text variable, no debug info>");
+
   objfile_type->nodebug_text_gnu_ifunc_symbol
     = init_type (objfile, TYPE_CODE_FUNC, TARGET_CHAR_BIT,
 		 "<text gnu-indirect-function variable, no debug info>");
-  TYPE_GNU_IFUNC (objfile_type->nodebug_text_gnu_ifunc_symbol) = 1;
+  objfile_type->nodebug_text_gnu_ifunc_symbol->set_is_gnu_ifunc (true);
+
   objfile_type->nodebug_got_plt_symbol
     = init_pointer_type (objfile, gdbarch_addr_bit (gdbarch),
 			 "<text from jump slot in .got.plt, no debug info>",
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index bfe4232699a..5534b5bf2fb 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -238,7 +238,7 @@ DEF_ENUM_FLAGS_TYPE (enum type_instance_flag_value, type_instance_flags);
    determines the final returned function type to be presented to
    user.  */
 
-#define TYPE_GNU_IFUNC(t)	(TYPE_MAIN_TYPE (t)->flag_gnu_ifunc)
+#define TYPE_GNU_IFUNC(t)	((t)->is_gnu_ifunc ())
 
 /* * Type owner.  If TYPE_OBJFILE_OWNED is true, the type is owned by
    the objfile retrieved as TYPE_OBJFILE.  Otherwise, the type is
@@ -814,7 +814,7 @@ struct main_type
   unsigned int m_flag_varargs : 1;
   unsigned int m_flag_vector : 1;
   unsigned int m_flag_stub_supported : 1;
-  unsigned int flag_gnu_ifunc : 1;
+  unsigned int m_flag_gnu_ifunc : 1;
   unsigned int flag_fixed_instance : 1;
   unsigned int flag_objfile_owned : 1;
   unsigned int flag_endianity_not_default : 1;
@@ -1133,6 +1133,16 @@ struct type
     this->main_type->m_flag_stub_supported = stub_is_supported;
   }
 
+  bool is_gnu_ifunc () const
+  {
+    return this->main_type->m_flag_gnu_ifunc;
+  }
+
+  void set_is_gnu_ifunc (bool is_gnu_ifunc)
+  {
+    this->main_type->m_flag_gnu_ifunc = is_gnu_ifunc;
+  }
+
   /* * Return the dynamic property of the requested KIND from this type's
      list of dynamic properties.  */
   dynamic_prop *dyn_prop (dynamic_prop_node_kind kind) const;
-- 
2.28.0



More information about the Gdb-patches mailing list