gdb: add type::is_gnu_ifunc / type::set_is_gnu_ifunc
authorSimon Marchi <simon.marchi@efficios.com>
Mon, 14 Sep 2020 15:08:05 +0000 (11:08 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Mon, 14 Sep 2020 15:08:05 +0000 (11:08 -0400)
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/ChangeLog
gdb/gdbtypes.c
gdb/gdbtypes.h

index 1bfe02b504ff344ad9f46ecc3b660c7b47a87053..0c78d2aed3b60df904a3bb2d16e58be7d58d1620 100644 (file)
@@ -1,3 +1,9 @@
+2020-09-14  Simon Marchi  <simon.marchi@efficios.com>
+
+       * 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.
+
 2020-09-14  Simon Marchi  <simon.marchi@efficios.com>
 
        * gdbtypes.h (TYPE_STUB_SUPPORTED): Remove, replace all
index bc8a6f29a4e1effa1aa7887e06df14a3d84f3847..60d0cdbb8548f42cb25f0758b430cbf79fb4731a 100644 (file)
@@ -5934,10 +5934,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>",
index ed1b30a753dbd8c3d566ffdc4ceaf2ef2c96fc1f..4a2dc2a0794b6990a043c4302ff7f55516a5f057 100644 (file)
@@ -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;
This page took 0.049329 seconds and 4 git commands to generate.