mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-18 16:53:50 +08:00
gdb: add type::target_is_stub / type::set_target_is_stub
Add the `target_is_stub` and `set_target_is_stub` methods on `struct type`, in order to remove the `TYPE_TARGET_STUB` 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) <target_is_stub, set_target_is_stub>: New methods. (TYPE_TARGET_STUB): Use type::is_stub, change all write call sites to use type::set_target_is_stub. Change-Id: I9c71a89adc7ae8d018db9ee156f41c623be0484a
This commit is contained in:
@ -1,3 +1,10 @@
|
||||
2020-09-14 Simon Marchi <simon.marchi@efficios.com>
|
||||
|
||||
* gdbtypes.h (struct type) <target_is_stub, set_target_is_stub>:
|
||||
New methods.
|
||||
(TYPE_TARGET_STUB): Use type::is_stub, change all write call
|
||||
sites to use type::set_target_is_stub.
|
||||
|
||||
2020-09-14 Simon Marchi <simon.marchi@efficios.com>
|
||||
|
||||
* gdbtypes.h (TYPE_STUB): Remove, replace all
|
||||
|
@ -776,7 +776,7 @@ read_array_type (struct ctf_context *ccp, ctf_id_t tid)
|
||||
{
|
||||
range_type->bounds ()->high.set_undefined ();
|
||||
TYPE_LENGTH (type) = 0;
|
||||
TYPE_TARGET_STUB (type) = 1;
|
||||
type->set_target_is_stub (true);
|
||||
}
|
||||
else
|
||||
TYPE_LENGTH (type) = ctf_type_size (fp, tid);
|
||||
@ -876,7 +876,8 @@ read_typedef_type (struct ctf_context *ccp, ctf_id_t tid,
|
||||
TYPE_TARGET_TYPE (this_type) = target_type;
|
||||
else
|
||||
TYPE_TARGET_TYPE (this_type) = NULL;
|
||||
TYPE_TARGET_STUB (this_type) = TYPE_TARGET_TYPE (this_type) ? 1 : 0;
|
||||
|
||||
this_type->set_target_is_stub (TYPE_TARGET_TYPE (this_type) != nullptr);
|
||||
|
||||
return set_tid_type (objfile, tid, this_type);
|
||||
}
|
||||
|
@ -17795,7 +17795,7 @@ read_typedef (struct die_info *die, struct dwarf2_cu *cu)
|
||||
|
||||
name = dwarf2_full_name (NULL, die, cu);
|
||||
this_type = init_type (objfile, TYPE_CODE_TYPEDEF, 0, name);
|
||||
TYPE_TARGET_STUB (this_type) = 1;
|
||||
this_type->set_target_is_stub (true);
|
||||
set_die_type (die, this_type, cu);
|
||||
target_type = die_type (die, cu);
|
||||
if (target_type != this_type)
|
||||
|
@ -1643,14 +1643,14 @@ fbsd_get_siginfo_type (struct gdbarch *gdbarch)
|
||||
pid_type = arch_type (gdbarch, TYPE_CODE_TYPEDEF,
|
||||
TYPE_LENGTH (int32_type) * TARGET_CHAR_BIT, "__pid_t");
|
||||
TYPE_TARGET_TYPE (pid_type) = int32_type;
|
||||
TYPE_TARGET_STUB (pid_type) = 1;
|
||||
pid_type->set_target_is_stub (true);
|
||||
|
||||
/* __uid_t */
|
||||
uid_type = arch_type (gdbarch, TYPE_CODE_TYPEDEF,
|
||||
TYPE_LENGTH (uint32_type) * TARGET_CHAR_BIT,
|
||||
"__uid_t");
|
||||
TYPE_TARGET_TYPE (uid_type) = uint32_type;
|
||||
TYPE_TARGET_STUB (uid_type) = 1;
|
||||
pid_type->set_target_is_stub (true);
|
||||
|
||||
/* _reason */
|
||||
reason_type = arch_composite_type (gdbarch, NULL, TYPE_CODE_UNION);
|
||||
|
@ -935,7 +935,7 @@ create_range_type (struct type *result_type, struct type *index_type,
|
||||
result_type->set_code (TYPE_CODE_RANGE);
|
||||
TYPE_TARGET_TYPE (result_type) = index_type;
|
||||
if (index_type->is_stub ())
|
||||
TYPE_TARGET_STUB (result_type) = 1;
|
||||
result_type->set_target_is_stub (true);
|
||||
else
|
||||
TYPE_LENGTH (result_type) = TYPE_LENGTH (check_typedef (index_type));
|
||||
|
||||
@ -1307,7 +1307,7 @@ create_array_type_with_stride (struct type *result_type,
|
||||
|
||||
/* TYPE_TARGET_STUB will take care of zero length arrays. */
|
||||
if (TYPE_LENGTH (result_type) == 0)
|
||||
TYPE_TARGET_STUB (result_type) = 1;
|
||||
result_type->set_target_is_stub (true);
|
||||
|
||||
return result_type;
|
||||
}
|
||||
@ -2875,11 +2875,11 @@ check_typedef (struct type *type)
|
||||
else if (type->code () == TYPE_CODE_RANGE)
|
||||
{
|
||||
TYPE_LENGTH (type) = TYPE_LENGTH (target_type);
|
||||
TYPE_TARGET_STUB (type) = 0;
|
||||
type->set_target_is_stub (false);
|
||||
}
|
||||
else if (type->code () == TYPE_CODE_ARRAY
|
||||
&& update_static_array_size (type))
|
||||
TYPE_TARGET_STUB (type) = 0;
|
||||
type->set_target_is_stub (false);
|
||||
}
|
||||
|
||||
type = make_qualified_type (type, instance_flags, NULL);
|
||||
|
@ -222,7 +222,7 @@ DEF_ENUM_FLAGS_TYPE (enum type_instance_flag_value, type_instance_flags);
|
||||
based on the TYPE_LENGTH of the target type. Also, set for
|
||||
TYPE_CODE_TYPEDEF. */
|
||||
|
||||
#define TYPE_TARGET_STUB(t) (TYPE_MAIN_TYPE (t)->flag_target_stub)
|
||||
#define TYPE_TARGET_STUB(t) ((t)->target_is_stub ())
|
||||
|
||||
/* * This is a function type which appears to have a prototype. We
|
||||
need this for function calls in order to tell us if it's necessary
|
||||
@ -841,7 +841,7 @@ struct main_type
|
||||
unsigned int m_flag_unsigned : 1;
|
||||
unsigned int m_flag_nosign : 1;
|
||||
unsigned int m_flag_stub : 1;
|
||||
unsigned int flag_target_stub : 1;
|
||||
unsigned int m_flag_target_stub : 1;
|
||||
unsigned int flag_prototyped : 1;
|
||||
unsigned int flag_varargs : 1;
|
||||
unsigned int flag_vector : 1;
|
||||
@ -1092,6 +1092,16 @@ struct type
|
||||
this->main_type->m_flag_stub = is_stub;
|
||||
}
|
||||
|
||||
bool target_is_stub () const
|
||||
{
|
||||
return this->main_type->m_flag_target_stub;
|
||||
}
|
||||
|
||||
void set_target_is_stub (bool target_is_stub)
|
||||
{
|
||||
this->main_type->m_flag_target_stub = target_is_stub;
|
||||
}
|
||||
|
||||
/* * 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;
|
||||
|
@ -266,20 +266,20 @@ linux_get_siginfo_type_with_fields (struct gdbarch *gdbarch,
|
||||
pid_type = arch_type (gdbarch, TYPE_CODE_TYPEDEF,
|
||||
TYPE_LENGTH (int_type) * TARGET_CHAR_BIT, "__pid_t");
|
||||
TYPE_TARGET_TYPE (pid_type) = int_type;
|
||||
TYPE_TARGET_STUB (pid_type) = 1;
|
||||
pid_type->set_target_is_stub (true);
|
||||
|
||||
/* __uid_t */
|
||||
uid_type = arch_type (gdbarch, TYPE_CODE_TYPEDEF,
|
||||
TYPE_LENGTH (uint_type) * TARGET_CHAR_BIT, "__uid_t");
|
||||
TYPE_TARGET_TYPE (uid_type) = uint_type;
|
||||
TYPE_TARGET_STUB (uid_type) = 1;
|
||||
uid_type->set_target_is_stub (true);
|
||||
|
||||
/* __clock_t */
|
||||
clock_type = arch_type (gdbarch, TYPE_CODE_TYPEDEF,
|
||||
TYPE_LENGTH (long_type) * TARGET_CHAR_BIT,
|
||||
"__clock_t");
|
||||
TYPE_TARGET_TYPE (clock_type) = long_type;
|
||||
TYPE_TARGET_STUB (clock_type) = 1;
|
||||
clock_type->set_target_is_stub (true);
|
||||
|
||||
/* _sifields */
|
||||
sifields_type = arch_composite_type (gdbarch, NULL, TYPE_CODE_UNION);
|
||||
|
@ -1866,7 +1866,7 @@ upgrade_type (int fd, struct type **tpp, int tq, union aux_ext *ax, int bigend,
|
||||
|
||||
/* TYPE_TARGET_STUB now takes care of the zero TYPE_LENGTH problem. */
|
||||
if (TYPE_LENGTH (*tpp) == 0)
|
||||
TYPE_TARGET_STUB (t) = 1;
|
||||
t->set_target_is_stub (true);
|
||||
|
||||
*tpp = t;
|
||||
return 4 + off;
|
||||
|
@ -1716,7 +1716,7 @@ again:
|
||||
}
|
||||
else
|
||||
{
|
||||
TYPE_TARGET_STUB (type) = 1;
|
||||
type->set_target_is_stub (true);
|
||||
TYPE_TARGET_TYPE (type) = xtype;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user