diff options
author | Simon Marchi <simon.marchi@efficios.com> | 2020-09-14 11:08:05 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@efficios.com> | 2020-09-14 11:08:05 -0400 |
commit | 03cc72491b8139cffaf2c6ce9db84ebc17205323 (patch) | |
tree | 9e377bf2e96a097223f90e03ffd24d794f5720d2 /gdb | |
parent | 3f46044c09fc5a4982f4ad99aff5b7af60d3f186 (diff) | |
download | gdb-03cc72491b8139cffaf2c6ce9db84ebc17205323.zip gdb-03cc72491b8139cffaf2c6ce9db84ebc17205323.tar.gz gdb-03cc72491b8139cffaf2c6ce9db84ebc17205323.tar.bz2 |
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
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/gdbtypes.c | 4 | ||||
-rw-r--r-- | gdb/gdbtypes.h | 14 |
3 files changed, 21 insertions, 3 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 1bfe02b..0c78d2a 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,11 @@ 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 uses with type::stub_is_supported. diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index bc8a6f2..60d0cdb 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -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>", diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index ed1b30a..4a2dc2a 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; |