mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-18 08:38:10 +08:00
gdb: add type::endianity_is_not_default / type::set_endianity_is_not_default
Add the `endianity_is_not_default` and `set_endianity_is_not_default` methods on `struct type`, in order to remove the `TYPE_ENDIANITY_NOT_DEFAULT` 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) <endianity_is_not_default, set_endianity_is_not_default>: New methods. (TYPE_ENDIANITY_NOT_DEFAULT): Use type::endianity_is_not_default, change all write call sites to use type::set_endianity_is_not_default. Change-Id: I67acd68fcdae424d7e4a601afda78612ad5d92db
This commit is contained in:
@ -1,3 +1,11 @@
|
|||||||
|
2020-09-14 Simon Marchi <simon.marchi@efficios.com>
|
||||||
|
|
||||||
|
* gdbtypes.h (struct type) <endianity_is_not_default,
|
||||||
|
set_endianity_is_not_default>: New methods.
|
||||||
|
(TYPE_ENDIANITY_NOT_DEFAULT): Use
|
||||||
|
type::endianity_is_not_default, change all write call sites to
|
||||||
|
use type::set_endianity_is_not_default.
|
||||||
|
|
||||||
2020-09-14 Simon Marchi <simon.marchi@efficios.com>
|
2020-09-14 Simon Marchi <simon.marchi@efficios.com>
|
||||||
|
|
||||||
* gdbtypes.h (TYPE_FIXED_INSTANCE): Remove, replace all
|
* gdbtypes.h (TYPE_FIXED_INSTANCE): Remove, replace all
|
||||||
|
@ -18063,7 +18063,7 @@ read_base_type (struct die_info *die, struct dwarf2_cu *cu)
|
|||||||
|
|
||||||
maybe_set_alignment (cu, die, type);
|
maybe_set_alignment (cu, die, type);
|
||||||
|
|
||||||
TYPE_ENDIANITY_NOT_DEFAULT (type) = gdbarch_byte_order (arch) != byte_order;
|
type->set_endianity_is_not_default (gdbarch_byte_order (arch) != byte_order);
|
||||||
|
|
||||||
return set_die_type (die, type, cu);
|
return set_die_type (die, type, cu);
|
||||||
}
|
}
|
||||||
|
@ -958,8 +958,8 @@ create_range_type (struct type *result_type, struct type *index_type,
|
|||||||
if (high_bound->kind () == PROP_CONST && high_bound->const_val () < 0)
|
if (high_bound->kind () == PROP_CONST && high_bound->const_val () < 0)
|
||||||
result_type->set_is_unsigned (false);
|
result_type->set_is_unsigned (false);
|
||||||
|
|
||||||
TYPE_ENDIANITY_NOT_DEFAULT (result_type)
|
result_type->set_endianity_is_not_default
|
||||||
= TYPE_ENDIANITY_NOT_DEFAULT (index_type);
|
(index_type->endianity_is_not_default ());
|
||||||
|
|
||||||
return result_type;
|
return result_type;
|
||||||
}
|
}
|
||||||
|
@ -214,7 +214,7 @@ DEF_ENUM_FLAGS_TYPE (enum type_instance_flag_value, type_instance_flags);
|
|||||||
that indicates the desired endian interpretation of the variable
|
that indicates the desired endian interpretation of the variable
|
||||||
differs from the native endian representation. */
|
differs from the native endian representation. */
|
||||||
|
|
||||||
#define TYPE_ENDIANITY_NOT_DEFAULT(t) (TYPE_MAIN_TYPE (t)->flag_endianity_not_default)
|
#define TYPE_ENDIANITY_NOT_DEFAULT(t) ((t)->endianity_is_not_default ())
|
||||||
|
|
||||||
/* * Not textual. By default, GDB treats all single byte integers as
|
/* * Not textual. By default, GDB treats all single byte integers as
|
||||||
characters (or elements of strings) unless this flag is set. */
|
characters (or elements of strings) unless this flag is set. */
|
||||||
@ -798,7 +798,7 @@ struct main_type
|
|||||||
unsigned int m_flag_gnu_ifunc : 1;
|
unsigned int m_flag_gnu_ifunc : 1;
|
||||||
unsigned int m_flag_fixed_instance : 1;
|
unsigned int m_flag_fixed_instance : 1;
|
||||||
unsigned int flag_objfile_owned : 1;
|
unsigned int flag_objfile_owned : 1;
|
||||||
unsigned int flag_endianity_not_default : 1;
|
unsigned int m_flag_endianity_not_default : 1;
|
||||||
|
|
||||||
/* * True if this type was declared with "class" rather than
|
/* * True if this type was declared with "class" rather than
|
||||||
"struct". */
|
"struct". */
|
||||||
@ -1149,6 +1149,16 @@ struct type
|
|||||||
this->main_type->m_flag_fixed_instance = is_fixed_instance;
|
this->main_type->m_flag_fixed_instance = is_fixed_instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool endianity_is_not_default () const
|
||||||
|
{
|
||||||
|
return this->main_type->m_flag_endianity_not_default;
|
||||||
|
}
|
||||||
|
|
||||||
|
void set_endianity_is_not_default (bool endianity_is_not_default)
|
||||||
|
{
|
||||||
|
this->main_type->m_flag_endianity_not_default = endianity_is_not_default;
|
||||||
|
}
|
||||||
|
|
||||||
/* * Return the dynamic property of the requested KIND from this type's
|
/* * Return the dynamic property of the requested KIND from this type's
|
||||||
list of dynamic properties. */
|
list of dynamic properties. */
|
||||||
dynamic_prop *dyn_prop (dynamic_prop_node_kind kind) const;
|
dynamic_prop *dyn_prop (dynamic_prop_node_kind kind) const;
|
||||||
|
Reference in New Issue
Block a user