gdb: add type::is_gnu_ifunc / type::set_is_gnu_ifunc

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
This commit is contained in:
Simon Marchi
2020-09-14 11:08:05 -04:00
parent 3f46044c09
commit 03cc72491b
3 changed files with 21 additions and 3 deletions

View 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

View 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>",

View 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;