diff options
author | Simon Marchi <simon.marchi@polymtl.ca> | 2017-12-05 16:30:28 -0500 |
---|---|---|
committer | Simon Marchi <simon.marchi@ericsson.com> | 2017-12-05 16:30:28 -0500 |
commit | d4a0e8b57d6f85e4ee4a31e0e6929ff5b4fd9823 (patch) | |
tree | 0e83717fd7af88d2bef064f8580d8ef57d48e428 | |
parent | f0cddbef410cb626ea87b3a954bd4e3d7526115e (diff) | |
download | gdb-d4a0e8b57d6f85e4ee4a31e0e6929ff5b4fd9823.zip gdb-d4a0e8b57d6f85e4ee4a31e0e6929ff5b4fd9823.tar.gz gdb-d4a0e8b57d6f85e4ee4a31e0e6929ff5b4fd9823.tar.bz2 |
Split tdesc_type into multiple classes
This patch makes tdesc_type an abstract base class and creates three
subclasses:
- tdesc_type_builtin, for builtin types
- tdesc_type_vector, for vector types
- tdesc_type_with_fields, for struct, union, flag and enum types
This allows getting rid of the union in tdesc_type and to not allow the
std::vector separately. I tried to go further and create separate
classes for struct, union, flag and enum, but it proved too difficult.
One problem is that from the point of the of the target description
code, the types tdesc_type_* are opaque (only forward-declared).
Therefore, it doesn't know about inheritance relationship between those
classes. This makes it impossible to make functions that accept a
pointer to a base class and pass a pointer to a derived class, for
example. I think this patch here is a good compromise, and if somebody
wants to improve things further, the door is open.
A make_gdb_type virtual pure method is added to tdesc_type, which
replaces the current tdesc_gdb_type function. Calling this method on a
tdesc_type returns the corresponding built gdb type.
gdb/ChangeLog:
* target-descriptions.c (struct tdesc_type): Use default
destructor.
<u>: Remove.
<accept>: Remove.
(struct tdesc_type_builtin): New.
(struct tdesc_type_vector): New.
(struct tdesc_type_with_fields): New.
(tdesc_predefined_types): Change type to tdesc_type_builtin[].
(tdesc_gdb_type): Remove.
(tdesc_register_type): Adjust.
(tdesc_create_vector): Create tdesc_type_vector.
(tdesc_create_struct): Create tdesc_type_with_fields.
(tdesc_set_struct_size): Change parameter type.
(tdesc_create_union): Create tdesc_type_with_fields.
(tdesc_create_flags): Likewise.
(tdesc_create_enum): Likewise.
(tdesc_add_field): Change parameter type.
(tdesc_add_typed_bitfield): Likewise.
(tdesc_add_bitfield): Likewise.
(tdesc_add_flag): Likewise.
(tdesc_add_enum_value): Likewise.
(print_c_tdesc) <visit>: Remove overload with tdesc_type
parameter, add overloads for tdesc_type_builtin,
tdesc_type_with_fields and tdesc_type_vector.
<m_printed_type>: Remove.
<m_printed_element_type, m_printed_type_with_fields>: Add.
* target-descriptions.h (tdesc_create_enum): Change return type.
(tdesc_add_typed_bitfield): Change parameter type.
(tdesc_add_enum_value): Change parameter type.
* xml-tdesc.c (struct tdesc_parsing_data) <current_type>: Change
type to tdesc_type_with_fields.
(tdesc_start_struct): Adjust.
(tdesc_start_flags): Adjust.
(tdesc_start_enum): Adjust.
(tdesc_start_field): Adjust.
* arch/tdesc.h (struct tdesc_type_builtin): Forward-declare.
(struct tdesc_type_vector): Forward-declare.
(struct tdesc_type_with_fields): Forward-declare.
(tdesc_create_struct): Change return type.
(tdesc_create_union): Likewise.
(tdesc_create_flags): Likewise.
(tdesc_add_field): Change parameter type.
(tdesc_set_struct_size): Likewise.
(tdesc_add_bitfield): Likewise.
(tdesc_add_flag): Likewise.
* features: Re-generate C files.
gdb/gdbserver/ChangeLog:
* tdesc.c (struct tdesc_type): Change return type.
(tdesc_add_flag): Change parameter type.
(tdesc_add_bitfield): Likewise.
(tdesc_add_field): Likewise.
(tdesc_set_struct_size): Likewise.
42 files changed, 1187 insertions, 1074 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 2c4e428..1d3a3e8 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,54 @@ 2017-12-05 Simon Marchi <simon.marchi@polymtl.ca> + * target-descriptions.c (struct tdesc_type): Use default + destructor. + <u>: Remove. + <accept>: Remove. + (struct tdesc_type_builtin): New. + (struct tdesc_type_vector): New. + (struct tdesc_type_with_fields): New. + (tdesc_predefined_types): Change type to tdesc_type_builtin[]. + (tdesc_gdb_type): Remove. + (tdesc_register_type): Adjust. + (tdesc_create_vector): Create tdesc_type_vector. + (tdesc_create_struct): Create tdesc_type_with_fields. + (tdesc_set_struct_size): Change parameter type. + (tdesc_create_union): Create tdesc_type_with_fields. + (tdesc_create_flags): Likewise. + (tdesc_create_enum): Likewise. + (tdesc_add_field): Change parameter type. + (tdesc_add_typed_bitfield): Likewise. + (tdesc_add_bitfield): Likewise. + (tdesc_add_flag): Likewise. + (tdesc_add_enum_value): Likewise. + (print_c_tdesc) <visit>: Remove overload with tdesc_type + parameter, add overloads for tdesc_type_builtin, + tdesc_type_with_fields and tdesc_type_vector. + <m_printed_type>: Remove. + <m_printed_element_type, m_printed_type_with_fields>: Add. + * target-descriptions.h (tdesc_create_enum): Change return type. + (tdesc_add_typed_bitfield): Change parameter type. + (tdesc_add_enum_value): Change parameter type. + * xml-tdesc.c (struct tdesc_parsing_data) <current_type>: Change + type to tdesc_type_with_fields. + (tdesc_start_struct): Adjust. + (tdesc_start_flags): Adjust. + (tdesc_start_enum): Adjust. + (tdesc_start_field): Adjust. + * arch/tdesc.h (struct tdesc_type_builtin): Forward-declare. + (struct tdesc_type_vector): Forward-declare. + (struct tdesc_type_with_fields): Forward-declare. + (tdesc_create_struct): Change return type. + (tdesc_create_union): Likewise. + (tdesc_create_flags): Likewise. + (tdesc_add_field): Change parameter type. + (tdesc_set_struct_size): Likewise. + (tdesc_add_bitfield): Likewise. + (tdesc_add_flag): Likewise. + * features: Re-generate C files. + +2017-12-05 Simon Marchi <simon.marchi@polymtl.ca> + * target-descriptions.c (tdesc_arch_reg): Remove typedef. (struct tdesc_arch_reg): Add constructor. (DEF_VEC_O (tdesc_arch_reg)): Remove. diff --git a/gdb/arch/tdesc.h b/gdb/arch/tdesc.h index 78bb0fb..2240df6 100644 --- a/gdb/arch/tdesc.h +++ b/gdb/arch/tdesc.h @@ -20,6 +20,9 @@ struct tdesc_feature; struct tdesc_type; +struct tdesc_type_builtin; +struct tdesc_type_vector; +struct tdesc_type_with_fields; struct tdesc_reg; struct target_desc; @@ -51,37 +54,37 @@ struct tdesc_type *tdesc_create_vector (struct tdesc_feature *feature, int count); /* Return the created struct tdesc_type named NAME in FEATURE. */ -struct tdesc_type *tdesc_create_struct (struct tdesc_feature *feature, - const char *name); +tdesc_type_with_fields *tdesc_create_struct (struct tdesc_feature *feature, + const char *name); /* Return the created union tdesc_type named NAME in FEATURE. */ -struct tdesc_type *tdesc_create_union (struct tdesc_feature *feature, - const char *name); +tdesc_type_with_fields *tdesc_create_union (struct tdesc_feature *feature, + const char *name); /* Return the created flags tdesc_type named NAME in FEATURE. */ -struct tdesc_type *tdesc_create_flags (struct tdesc_feature *feature, - const char *name, - int size); +tdesc_type_with_fields *tdesc_create_flags (struct tdesc_feature *feature, + const char *name, + int size); /* Add a new field to TYPE. FIELD_NAME is its name, and FIELD_TYPE is its type. */ -void tdesc_add_field (struct tdesc_type *type, const char *field_name, +void tdesc_add_field (tdesc_type_with_fields *type, const char *field_name, struct tdesc_type *field_type); /* Set the total length of TYPE. Structs which contain bitfields may omit the reserved bits, so the end of the last field may not suffice. */ -void tdesc_set_struct_size (struct tdesc_type *type, int size); +void tdesc_set_struct_size (tdesc_type_with_fields *type, int size); /* Add a new untyped bitfield to TYPE. Untyped bitfields become either uint32 or uint64 depending on the size of the underlying type. */ -void tdesc_add_bitfield (struct tdesc_type *type, const char *field_name, +void tdesc_add_bitfield (tdesc_type_with_fields *type, const char *field_name, int start, int end); /* A flag is just a typed(bool) single-bit bitfield. This function is kept to minimize changes in generated files. */ -void tdesc_add_flag (struct tdesc_type *type, int start, +void tdesc_add_flag (tdesc_type_with_fields *type, int start, const char *flag_name); /* Create a register in feature FEATURE. */ diff --git a/gdb/features/aarch64-core.c b/gdb/features/aarch64-core.c index f3fad40..618a7ef 100644 --- a/gdb/features/aarch64-core.c +++ b/gdb/features/aarch64-core.c @@ -9,24 +9,24 @@ create_feature_aarch64_core (struct target_desc *result, long regnum) struct tdesc_feature *feature; feature = tdesc_create_feature (result, "org.gnu.gdb.aarch64.core", "aarch64-core.xml"); - struct tdesc_type *field_type; - struct tdesc_type *type; - type = tdesc_create_flags (feature, "cpsr_flags", 4); - tdesc_add_flag (type, 0, "SP"); - tdesc_add_flag (type, 1, ""); - tdesc_add_bitfield (type, "EL", 2, 3); - tdesc_add_flag (type, 4, "nRW"); - tdesc_add_flag (type, 5, ""); - tdesc_add_flag (type, 6, "F"); - tdesc_add_flag (type, 7, "I"); - tdesc_add_flag (type, 8, "A"); - tdesc_add_flag (type, 9, "D"); - tdesc_add_flag (type, 20, "IL"); - tdesc_add_flag (type, 21, "SS"); - tdesc_add_flag (type, 28, "V"); - tdesc_add_flag (type, 29, "C"); - tdesc_add_flag (type, 30, "Z"); - tdesc_add_flag (type, 31, "N"); + tdesc_type_with_fields *type_with_fields; + tdesc_type *field_type; + type_with_fields = tdesc_create_flags (feature, "cpsr_flags", 4); + tdesc_add_flag (type_with_fields, 0, "SP"); + tdesc_add_flag (type_with_fields, 1, ""); + tdesc_add_bitfield (type_with_fields, "EL", 2, 3); + tdesc_add_flag (type_with_fields, 4, "nRW"); + tdesc_add_flag (type_with_fields, 5, ""); + tdesc_add_flag (type_with_fields, 6, "F"); + tdesc_add_flag (type_with_fields, 7, "I"); + tdesc_add_flag (type_with_fields, 8, "A"); + tdesc_add_flag (type_with_fields, 9, "D"); + tdesc_add_flag (type_with_fields, 20, "IL"); + tdesc_add_flag (type_with_fields, 21, "SS"); + tdesc_add_flag (type_with_fields, 28, "V"); + tdesc_add_flag (type_with_fields, 29, "C"); + tdesc_add_flag (type_with_fields, 30, "Z"); + tdesc_add_flag (type_with_fields, 31, "N"); tdesc_create_reg (feature, "x0", regnum++, 1, NULL, 64, "int"); tdesc_create_reg (feature, "x1", regnum++, 1, NULL, 64, "int"); diff --git a/gdb/features/aarch64-fpu.c b/gdb/features/aarch64-fpu.c index 3672f25..7328eb1 100644 --- a/gdb/features/aarch64-fpu.c +++ b/gdb/features/aarch64-fpu.c @@ -9,89 +9,90 @@ create_feature_aarch64_fpu (struct target_desc *result, long regnum) struct tdesc_feature *feature; feature = tdesc_create_feature (result, "org.gnu.gdb.aarch64.fpu", "aarch64-fpu.xml"); - struct tdesc_type *field_type; - field_type = tdesc_named_type (feature, "ieee_double"); - tdesc_create_vector (feature, "v2d", field_type, 2); + tdesc_type *element_type; + element_type = tdesc_named_type (feature, "ieee_double"); + tdesc_create_vector (feature, "v2d", element_type, 2); - field_type = tdesc_named_type (feature, "uint64"); - tdesc_create_vector (feature, "v2u", field_type, 2); + element_type = tdesc_named_type (feature, "uint64"); + tdesc_create_vector (feature, "v2u", element_type, 2); - field_type = tdesc_named_type (feature, "int64"); - tdesc_create_vector (feature, "v2i", field_type, 2); + element_type = tdesc_named_type (feature, "int64"); + tdesc_create_vector (feature, "v2i", element_type, 2); - field_type = tdesc_named_type (feature, "ieee_single"); - tdesc_create_vector (feature, "v4f", field_type, 4); + element_type = tdesc_named_type (feature, "ieee_single"); + tdesc_create_vector (feature, "v4f", element_type, 4); - field_type = tdesc_named_type (feature, "uint32"); - tdesc_create_vector (feature, "v4u", field_type, 4); + element_type = tdesc_named_type (feature, "uint32"); + tdesc_create_vector (feature, "v4u", element_type, 4); - field_type = tdesc_named_type (feature, "int32"); - tdesc_create_vector (feature, "v4i", field_type, 4); + element_type = tdesc_named_type (feature, "int32"); + tdesc_create_vector (feature, "v4i", element_type, 4); - field_type = tdesc_named_type (feature, "uint16"); - tdesc_create_vector (feature, "v8u", field_type, 8); + element_type = tdesc_named_type (feature, "uint16"); + tdesc_create_vector (feature, "v8u", element_type, 8); - field_type = tdesc_named_type (feature, "int16"); - tdesc_create_vector (feature, "v8i", field_type, 8); + element_type = tdesc_named_type (feature, "int16"); + tdesc_create_vector (feature, "v8i", element_type, 8); - field_type = tdesc_named_type (feature, "uint8"); - tdesc_create_vector (feature, "v16u", field_type, 16); + element_type = tdesc_named_type (feature, "uint8"); + tdesc_create_vector (feature, "v16u", element_type, 16); - field_type = tdesc_named_type (feature, "int8"); - tdesc_create_vector (feature, "v16i", field_type, 16); + element_type = tdesc_named_type (feature, "int8"); + tdesc_create_vector (feature, "v16i", element_type, 16); - field_type = tdesc_named_type (feature, "uint128"); - tdesc_create_vector (feature, "v1u", field_type, 1); + element_type = tdesc_named_type (feature, "uint128"); + tdesc_create_vector (feature, "v1u", element_type, 1); - field_type = tdesc_named_type (feature, "int128"); - tdesc_create_vector (feature, "v1i", field_type, 1); + element_type = tdesc_named_type (feature, "int128"); + tdesc_create_vector (feature, "v1i", element_type, 1); - struct tdesc_type *type; - type = tdesc_create_union (feature, "vnd"); + tdesc_type_with_fields *type_with_fields; + tdesc_type *field_type; + type_with_fields = tdesc_create_union (feature, "vnd"); field_type = tdesc_named_type (feature, "v2d"); - tdesc_add_field (type, "f", field_type); + tdesc_add_field (type_with_fields, "f", field_type); field_type = tdesc_named_type (feature, "v2u"); - tdesc_add_field (type, "u", field_type); + tdesc_add_field (type_with_fields, "u", field_type); field_type = tdesc_named_type (feature, "v2i"); - tdesc_add_field (type, "s", field_type); + tdesc_add_field (type_with_fields, "s", field_type); - type = tdesc_create_union (feature, "vns"); + type_with_fields = tdesc_create_union (feature, "vns"); field_type = tdesc_named_type (feature, "v4f"); - tdesc_add_field (type, "f", field_type); + tdesc_add_field (type_with_fields, "f", field_type); field_type = tdesc_named_type (feature, "v4u"); - tdesc_add_field (type, "u", field_type); + tdesc_add_field (type_with_fields, "u", field_type); field_type = tdesc_named_type (feature, "v4i"); - tdesc_add_field (type, "s", field_type); + tdesc_add_field (type_with_fields, "s", field_type); - type = tdesc_create_union (feature, "vnh"); + type_with_fields = tdesc_create_union (feature, "vnh"); field_type = tdesc_named_type (feature, "v8u"); - tdesc_add_field (type, "u", field_type); + tdesc_add_field (type_with_fields, "u", field_type); field_type = tdesc_named_type (feature, "v8i"); - tdesc_add_field (type, "s", field_type); + tdesc_add_field (type_with_fields, "s", field_type); - type = tdesc_create_union (feature, "vnb"); + type_with_fields = tdesc_create_union (feature, "vnb"); field_type = tdesc_named_type (feature, "v16u"); - tdesc_add_field (type, "u", field_type); + tdesc_add_field (type_with_fields, "u", field_type); field_type = tdesc_named_type (feature, "v16i"); - tdesc_add_field (type, "s", field_type); + tdesc_add_field (type_with_fields, "s", field_type); - type = tdesc_create_union (feature, "vnq"); + type_with_fields = tdesc_create_union (feature, "vnq"); field_type = tdesc_named_type (feature, "v1u"); - tdesc_add_field (type, "u", field_type); + tdesc_add_field (type_with_fields, "u", field_type); field_type = tdesc_named_type (feature, "v1i"); - tdesc_add_field (type, "s", field_type); + tdesc_add_field (type_with_fields, "s", field_type); - type = tdesc_create_union (feature, "aarch64v"); + type_with_fields = tdesc_create_union (feature, "aarch64v"); field_type = tdesc_named_type (feature, "vnd"); - tdesc_add_field (type, "d", field_type); + tdesc_add_field (type_with_fields, "d", field_type); field_type = tdesc_named_type (feature, "vns"); - tdesc_add_field (type, "s", field_type); + tdesc_add_field (type_with_fields, "s", field_type); field_type = tdesc_named_type (feature, "vnh"); - tdesc_add_field (type, "h", field_type); + tdesc_add_field (type_with_fields, "h", field_type); field_type = tdesc_named_type (feature, "vnb"); - tdesc_add_field (type, "b", field_type); + tdesc_add_field (type_with_fields, "b", field_type); field_type = tdesc_named_type (feature, "vnq"); - tdesc_add_field (type, "q", field_type); + tdesc_add_field (type_with_fields, "q", field_type); regnum = 34; tdesc_create_reg (feature, "v0", regnum++, 1, NULL, 128, "aarch64v"); diff --git a/gdb/features/arc-arcompact.c b/gdb/features/arc-arcompact.c index fd11e31..79b6889 100644 --- a/gdb/features/arc-arcompact.c +++ b/gdb/features/arc-arcompact.c @@ -51,22 +51,22 @@ initialize_tdesc_arc_arcompact (void) tdesc_create_reg (feature, "pcl", 33, 1, NULL, 32, "code_ptr"); feature = tdesc_create_feature (result, "org.gnu.gdb.arc.aux-minimal"); - struct tdesc_type *field_type; - struct tdesc_type *type; - type = tdesc_create_flags (feature, "status32_type", 4); - tdesc_add_flag (type, 0, "H"); - tdesc_add_bitfield (type, "E", 1, 2); - tdesc_add_bitfield (type, "A", 3, 4); - tdesc_add_flag (type, 5, "AE"); - tdesc_add_flag (type, 6, "DE"); - tdesc_add_flag (type, 7, "U"); - tdesc_add_flag (type, 8, "V"); - tdesc_add_flag (type, 9, "C"); - tdesc_add_flag (type, 10, "N"); - tdesc_add_flag (type, 11, "Z"); - tdesc_add_flag (type, 12, "L"); - tdesc_add_flag (type, 13, "R"); - tdesc_add_flag (type, 14, "SE"); + tdesc_type_with_fields *type_with_fields; + tdesc_type *field_type; + type_with_fields = tdesc_create_flags (feature, "status32_type", 4); + tdesc_add_flag (type_with_fields, 0, "H"); + tdesc_add_bitfield (type_with_fields, "E", 1, 2); + tdesc_add_bitfield (type_with_fields, "A", 3, 4); + tdesc_add_flag (type_with_fields, 5, "AE"); + tdesc_add_flag (type_with_fields, 6, "DE"); + tdesc_add_flag (type_with_fields, 7, "U"); + tdesc_add_flag (type_with_fields, 8, "V"); + tdesc_add_flag (type_with_fields, 9, "C"); + tdesc_add_flag (type_with_fields, 10, "N"); + tdesc_add_flag (type_with_fields, 11, "Z"); + tdesc_add_flag (type_with_fields, 12, "L"); + tdesc_add_flag (type_with_fields, 13, "R"); + tdesc_add_flag (type_with_fields, 14, "SE"); tdesc_create_reg (feature, "pc", 34, 1, NULL, 32, "code_ptr"); tdesc_create_reg (feature, "status32", 35, 1, NULL, 32, "status32_type"); diff --git a/gdb/features/arc-v2.c b/gdb/features/arc-v2.c index 6eeefdb..9908b4c 100644 --- a/gdb/features/arc-v2.c +++ b/gdb/features/arc-v2.c @@ -51,26 +51,26 @@ initialize_tdesc_arc_v2 (void) tdesc_create_reg (feature, "pcl", 33, 1, NULL, 32, "code_ptr"); feature = tdesc_create_feature (result, "org.gnu.gdb.arc.aux-minimal"); - struct tdesc_type *field_type; - struct tdesc_type *type; - type = tdesc_create_flags (feature, "status32_type", 4); - tdesc_add_flag (type, 0, "H"); - tdesc_add_bitfield (type, "E", 1, 4); - tdesc_add_flag (type, 5, "AE"); - tdesc_add_flag (type, 6, "DE"); - tdesc_add_flag (type, 7, "U"); - tdesc_add_flag (type, 8, "V"); - tdesc_add_flag (type, 9, "C"); - tdesc_add_flag (type, 10, "N"); - tdesc_add_flag (type, 11, "Z"); - tdesc_add_flag (type, 12, "L"); - tdesc_add_flag (type, 13, "DZ"); - tdesc_add_flag (type, 14, "SC"); - tdesc_add_flag (type, 15, "ES"); - tdesc_add_bitfield (type, "RB", 16, 18); - tdesc_add_flag (type, 19, "AD"); - tdesc_add_flag (type, 20, "US"); - tdesc_add_flag (type, 31, "IE"); + tdesc_type_with_fields *type_with_fields; + tdesc_type *field_type; + type_with_fields = tdesc_create_flags (feature, "status32_type", 4); + tdesc_add_flag (type_with_fields, 0, "H"); + tdesc_add_bitfield (type_with_fields, "E", 1, 4); + tdesc_add_flag (type_with_fields, 5, "AE"); + tdesc_add_flag (type_with_fields, 6, "DE"); + tdesc_add_flag (type_with_fields, 7, "U"); + tdesc_add_flag (type_with_fields, 8, "V"); + tdesc_add_flag (type_with_fields, 9, "C"); + tdesc_add_flag (type_with_fields, 10, "N"); + tdesc_add_flag (type_with_fields, 11, "Z"); + tdesc_add_flag (type_with_fields, 12, "L"); + tdesc_add_flag (type_with_fields, 13, "DZ"); + tdesc_add_flag (type_with_fields, 14, "SC"); + tdesc_add_flag (type_with_fields, 15, "ES"); + tdesc_add_bitfield (type_with_fields, "RB", 16, 18); + tdesc_add_flag (type_with_fields, 19, "AD"); + tdesc_add_flag (type_with_fields, 20, "US"); + tdesc_add_flag (type_with_fields, 31, "IE"); tdesc_create_reg (feature, "pc", 34, 1, NULL, 32, "code_ptr"); tdesc_create_reg (feature, "status32", 35, 1, NULL, 32, "status32_type"); diff --git a/gdb/features/arm/arm-with-iwmmxt.c b/gdb/features/arm/arm-with-iwmmxt.c index 5f839a0..5d6c357 100644 --- a/gdb/features/arm/arm-with-iwmmxt.c +++ b/gdb/features/arm/arm-with-iwmmxt.c @@ -34,26 +34,27 @@ initialize_tdesc_arm_with_iwmmxt (void) tdesc_create_reg (feature, "cpsr", 25, 1, NULL, 32, "int"); feature = tdesc_create_feature (result, "org.gnu.gdb.xscale.iwmmxt"); - struct tdesc_type *field_type; - field_type = tdesc_named_type (feature, "uint8"); - tdesc_create_vector (feature, "iwmmxt_v8u8", field_type, 8); + tdesc_type *element_type; + element_type = tdesc_named_type (feature, "uint8"); + tdesc_create_vector (feature, "iwmmxt_v8u8", element_type, 8); - field_type = tdesc_named_type (feature, "uint16"); - tdesc_create_vector (feature, "iwmmxt_v4u16", field_type, 4); + element_type = tdesc_named_type (feature, "uint16"); + tdesc_create_vector (feature, "iwmmxt_v4u16", element_type, 4); - field_type = tdesc_named_type (feature, "uint32"); - tdesc_create_vector (feature, "iwmmxt_v2u32", field_type, 2); + element_type = tdesc_named_type (feature, "uint32"); + tdesc_create_vector (feature, "iwmmxt_v2u32", element_type, 2); - struct tdesc_type *type; - type = tdesc_create_union (feature, "iwmmxt_vec64i"); + tdesc_type_with_fields *type_with_fields; + tdesc_type *field_type; + type_with_fields = tdesc_create_union (feature, "iwmmxt_vec64i"); field_type = tdesc_named_type (feature, "iwmmxt_v8u8"); - tdesc_add_field (type, "u8", field_type); + tdesc_add_field (type_with_fields, "u8", field_type); field_type = tdesc_named_type (feature, "iwmmxt_v4u16"); - tdesc_add_field (type, "u16", field_type); + tdesc_add_field (type_with_fields, "u16", field_type); field_type = tdesc_named_type (feature, "iwmmxt_v2u32"); - tdesc_add_field (type, "u32", field_type); + tdesc_add_field (type_with_fields, "u32", field_type); field_type = tdesc_named_type (feature, "uint64"); - tdesc_add_field (type, "u64", field_type); + tdesc_add_field (type_with_fields, "u64", field_type); tdesc_create_reg (feature, "wR0", 26, 1, NULL, 64, "iwmmxt_vec64i"); tdesc_create_reg (feature, "wR1", 27, 1, NULL, 64, "iwmmxt_vec64i"); diff --git a/gdb/features/i386/32bit-avx512.c b/gdb/features/i386/32bit-avx512.c index 82b20c5..39c7e97 100644 --- a/gdb/features/i386/32bit-avx512.c +++ b/gdb/features/i386/32bit-avx512.c @@ -9,9 +9,9 @@ create_feature_i386_32bit_avx512 (struct target_desc *result, long regnum) struct tdesc_feature *feature; feature = tdesc_create_feature (result, "org.gnu.gdb.i386.avx512", "32bit-avx512.xml"); - struct tdesc_type *field_type; - field_type = tdesc_named_type (feature, "uint128"); - tdesc_create_vector (feature, "v2ui128", field_type, 2); + tdesc_type *element_type; + element_type = tdesc_named_type (feature, "uint128"); + tdesc_create_vector (feature, "v2ui128", element_type, 2); tdesc_create_reg (feature, "k0", regnum++, 1, NULL, 64, "uint64"); tdesc_create_reg (feature, "k1", regnum++, 1, NULL, 64, "uint64"); diff --git a/gdb/features/i386/32bit-core.c b/gdb/features/i386/32bit-core.c index ec903f3..de2ce47 100644 --- a/gdb/features/i386/32bit-core.c +++ b/gdb/features/i386/32bit-core.c @@ -9,26 +9,26 @@ create_feature_i386_32bit_core (struct target_desc *result, long regnum) struct tdesc_feature *feature; feature = tdesc_create_feature (result, "org.gnu.gdb.i386.core", "32bit-core.xml"); - struct tdesc_type *field_type; - struct tdesc_type *type; - type = tdesc_create_flags (feature, "i386_eflags", 4); - tdesc_add_flag (type, 0, "CF"); - tdesc_add_flag (type, 1, ""); - tdesc_add_flag (type, 2, "PF"); - tdesc_add_flag (type, 4, "AF"); - tdesc_add_flag (type, 6, "ZF"); - tdesc_add_flag (type, 7, "SF"); - tdesc_add_flag (type, 8, "TF"); - tdesc_add_flag (type, 9, "IF"); - tdesc_add_flag (type, 10, "DF"); - tdesc_add_flag (type, 11, "OF"); - tdesc_add_flag (type, 14, "NT"); - tdesc_add_flag (type, 16, "RF"); - tdesc_add_flag (type, 17, "VM"); - tdesc_add_flag (type, 18, "AC"); - tdesc_add_flag (type, 19, "VIF"); - tdesc_add_flag (type, 20, "VIP"); - tdesc_add_flag (type, 21, "ID"); + tdesc_type_with_fields *type_with_fields; + tdesc_type *field_type; + type_with_fields = tdesc_create_flags (feature, "i386_eflags", 4); + tdesc_add_flag (type_with_fields, 0, "CF"); + tdesc_add_flag (type_with_fields, 1, ""); + tdesc_add_flag (type_with_fields, 2, "PF"); + tdesc_add_flag (type_with_fields, 4, "AF"); + tdesc_add_flag (type_with_fields, 6, "ZF"); + tdesc_add_flag (type_with_fields, 7, "SF"); + tdesc_add_flag (type_with_fields, 8, "TF"); + tdesc_add_flag (type_with_fields, 9, "IF"); + tdesc_add_flag (type_with_fields, 10, "DF"); + tdesc_add_flag (type_with_fields, 11, "OF"); + tdesc_add_flag (type_with_fields, 14, "NT"); + tdesc_add_flag (type_with_fields, 16, "RF"); + tdesc_add_flag (type_with_fields, 17, "VM"); + tdesc_add_flag (type_with_fields, 18, "AC"); + tdesc_add_flag (type_with_fields, 19, "VIF"); + tdesc_add_flag (type_with_fields, 20, "VIP"); + tdesc_add_flag (type_with_fields, 21, "ID"); tdesc_create_reg (feature, "eax", regnum++, 1, NULL, 32, "int32"); tdesc_create_reg (feature, "ecx", regnum++, 1, NULL, 32, "int32"); diff --git a/gdb/features/i386/32bit-mpx.c b/gdb/features/i386/32bit-mpx.c index 25a3fb1..38910d3 100644 --- a/gdb/features/i386/32bit-mpx.c +++ b/gdb/features/i386/32bit-mpx.c @@ -9,37 +9,37 @@ create_feature_i386_32bit_mpx (struct target_desc *result, long regnum) struct tdesc_feature *feature; feature = tdesc_create_feature (result, "org.gnu.gdb.i386.mpx", "32bit-mpx.xml"); - struct tdesc_type *field_type; - struct tdesc_type *type; - type = tdesc_create_struct (feature, "br128"); + tdesc_type_with_fields *type_with_fields; + tdesc_type *field_type; + type_with_fields = tdesc_create_struct (feature, "br128"); field_type = tdesc_named_type (feature, "uint64"); - tdesc_add_field (type, "lbound", field_type); + tdesc_add_field (type_with_fields, "lbound", field_type); field_type = tdesc_named_type (feature, "uint64"); - tdesc_add_field (type, "ubound_raw", field_type); + tdesc_add_field (type_with_fields, "ubound_raw", field_type); - type = tdesc_create_struct (feature, "_bndstatus"); - tdesc_set_struct_size (type, 8); - tdesc_add_bitfield (type, "bde", 2, 31); - tdesc_add_bitfield (type, "error", 0, 1); + type_with_fields = tdesc_create_struct (feature, "_bndstatus"); + tdesc_set_struct_size (type_with_fields, 8); + tdesc_add_bitfield (type_with_fields, "bde", 2, 31); + tdesc_add_bitfield (type_with_fields, "error", 0, 1); - type = tdesc_create_union (feature, "status"); + type_with_fields = tdesc_create_union (feature, "status"); field_type = tdesc_named_type (feature, "data_ptr"); - tdesc_add_field (type, "raw", field_type); + tdesc_add_field (type_with_fields, "raw", field_type); field_type = tdesc_named_type (feature, "_bndstatus"); - tdesc_add_field (type, "status", field_type); + tdesc_add_field (type_with_fields, "status", field_type); - type = tdesc_create_struct (feature, "_bndcfgu"); - tdesc_set_struct_size (type, 8); - tdesc_add_bitfield (type, "base", 12, 31); - tdesc_add_bitfield (type, "reserved", 2, 11); - tdesc_add_bitfield (type, "preserved", 1, 1); - tdesc_add_bitfield (type, "enabled", 0, 0); + type_with_fields = tdesc_create_struct (feature, "_bndcfgu"); + tdesc_set_struct_size (type_with_fields, 8); + tdesc_add_bitfield (type_with_fields, "base", 12, 31); + tdesc_add_bitfield (type_with_fields, "reserved", 2, 11); + tdesc_add_bitfield (type_with_fields, "preserved", 1, 1); + tdesc_add_bitfield (type_with_fields, "enabled", 0, 0); - type = tdesc_create_union (feature, "cfgu"); + type_with_fields = tdesc_create_union (feature, "cfgu"); field_type = tdesc_named_type (feature, "data_ptr"); - tdesc_add_field (type, "raw", field_type); + tdesc_add_field (type_with_fields, "raw", field_type); field_type = tdesc_named_type (feature, "_bndcfgu"); - tdesc_add_field (type, "config", field_type); + tdesc_add_field (type_with_fields, "config", field_type); tdesc_create_reg (feature, "bnd0raw", regnum++, 1, NULL, 128, "br128"); tdesc_create_reg (feature, "bnd1raw", regnum++, 1, NULL, 128, "br128"); diff --git a/gdb/features/i386/32bit-sse.c b/gdb/features/i386/32bit-sse.c index 01b2058..1c8a7e8 100644 --- a/gdb/features/i386/32bit-sse.c +++ b/gdb/features/i386/32bit-sse.c @@ -9,57 +9,58 @@ create_feature_i386_32bit_sse (struct target_desc *result, long regnum) struct tdesc_feature *feature; feature = tdesc_create_feature (result, "org.gnu.gdb.i386.sse", "32bit-sse.xml"); - struct tdesc_type *field_type; - field_type = tdesc_named_type (feature, "ieee_single"); - tdesc_create_vector (feature, "v4f", field_type, 4); + tdesc_type *element_type; + element_type = tdesc_named_type (feature, "ieee_single"); + tdesc_create_vector (feature, "v4f", element_type, 4); - field_type = tdesc_named_type (feature, "ieee_double"); - tdesc_create_vector (feature, "v2d", field_type, 2); + element_type = tdesc_named_type (feature, "ieee_double"); + tdesc_create_vector (feature, "v2d", element_type, 2); - field_type = tdesc_named_type (feature, "int8"); - tdesc_create_vector (feature, "v16i8", field_type, 16); + element_type = tdesc_named_type (feature, "int8"); + tdesc_create_vector (feature, "v16i8", element_type, 16); - field_type = tdesc_named_type (feature, "int16"); - tdesc_create_vector (feature, "v8i16", field_type, 8); + element_type = tdesc_named_type (feature, "int16"); + tdesc_create_vector (feature, "v8i16", element_type, 8); - field_type = tdesc_named_type (feature, "int32"); - tdesc_create_vector (feature, "v4i32", field_type, 4); + element_type = tdesc_named_type (feature, "int32"); + tdesc_create_vector (feature, "v4i32", element_type, 4); - field_type = tdesc_named_type (feature, "int64"); - tdesc_create_vector (feature, "v2i64", field_type, 2); + element_type = tdesc_named_type (feature, "int64"); + tdesc_create_vector (feature, "v2i64", element_type, 2); - struct tdesc_type *type; - type = tdesc_create_union (feature, "vec128"); + tdesc_type_with_fields *type_with_fields; + tdesc_type *field_type; + type_with_fields = tdesc_create_union (feature, "vec128"); field_type = tdesc_named_type (feature, "v4f"); - tdesc_add_field (type, "v4_float", field_type); + tdesc_add_field (type_with_fields, "v4_float", field_type); field_type = tdesc_named_type (feature, "v2d"); - tdesc_add_field (type, "v2_double", field_type); + tdesc_add_field (type_with_fields, "v2_double", field_type); field_type = tdesc_named_type (feature, "v16i8"); - tdesc_add_field (type, "v16_int8", field_type); + tdesc_add_field (type_with_fields, "v16_int8", field_type); field_type = tdesc_named_type (feature, "v8i16"); - tdesc_add_field (type, "v8_int16", field_type); + tdesc_add_field (type_with_fields, "v8_int16", field_type); field_type = tdesc_named_type (feature, "v4i32"); - tdesc_add_field (type, "v4_int32", field_type); + tdesc_add_field (type_with_fields, "v4_int32", field_type); field_type = tdesc_named_type (feature, "v2i64"); - tdesc_add_field (type, "v2_int64", field_type); + tdesc_add_field (type_with_fields, "v2_int64", field_type); field_type = tdesc_named_type (feature, "uint128"); - tdesc_add_field (type, "uint128", field_type); + tdesc_add_field (type_with_fields, "uint128", field_type); - type = tdesc_create_flags (feature, "i386_mxcsr", 4); - tdesc_add_flag (type, 0, "IE"); - tdesc_add_flag (type, 1, "DE"); - tdesc_add_flag (type, 2, "ZE"); - tdesc_add_flag (type, 3, "OE"); - tdesc_add_flag (type, 4, "UE"); - tdesc_add_flag (type, 5, "PE"); - tdesc_add_flag (type, 6, "DAZ"); - tdesc_add_flag (type, 7, "IM"); - tdesc_add_flag (type, 8, "DM"); - tdesc_add_flag (type, 9, "ZM"); - tdesc_add_flag (type, 10, "OM"); - tdesc_add_flag (type, 11, "UM"); - tdesc_add_flag (type, 12, "PM"); - tdesc_add_flag (type, 15, "FZ"); + type_with_fields = tdesc_create_flags (feature, "i386_mxcsr", 4); + tdesc_add_flag (type_with_fields, 0, "IE"); + tdesc_add_flag (type_with_fields, 1, "DE"); + tdesc_add_flag (type_with_fields, 2, "ZE"); + tdesc_add_flag (type_with_fields, 3, "OE"); + tdesc_add_flag (type_with_fields, 4, "UE"); + tdesc_add_flag (type_with_fields, 5, "PE"); + tdesc_add_flag (type_with_fields, 6, "DAZ"); + tdesc_add_flag (type_with_fields, 7, "IM"); + tdesc_add_flag (type_with_fields, 8, "DM"); + tdesc_add_flag (type_with_fields, 9, "ZM"); + tdesc_add_flag (type_with_fields, 10, "OM"); + tdesc_add_flag (type_with_fields, 11, "UM"); + tdesc_add_flag (type_with_fields, 12, "PM"); + tdesc_add_flag (type_with_fields, 15, "FZ"); regnum = 32; tdesc_create_reg (feature, "xmm0", regnum++, 1, NULL, 128, "vec128"); diff --git a/gdb/features/i386/64bit-avx512.c b/gdb/features/i386/64bit-avx512.c index fb50960..a565f42 100644 --- a/gdb/features/i386/64bit-avx512.c +++ b/gdb/features/i386/64bit-avx512.c @@ -9,44 +9,45 @@ create_feature_i386_64bit_avx512 (struct target_desc *result, long regnum) struct tdesc_feature *feature; feature = tdesc_create_feature (result, "org.gnu.gdb.i386.avx512", "64bit-avx512.xml"); - struct tdesc_type *field_type; - field_type = tdesc_named_type (feature, "ieee_single"); - tdesc_create_vector (feature, "v4f", field_type, 4); + tdesc_type *element_type; + element_type = tdesc_named_type (feature, "ieee_single"); + tdesc_create_vector (feature, "v4f", element_type, 4); - field_type = tdesc_named_type (feature, "ieee_double"); - tdesc_create_vector (feature, "v2d", field_type, 2); + element_type = tdesc_named_type (feature, "ieee_double"); + tdesc_create_vector (feature, "v2d", element_type, 2); - field_type = tdesc_named_type (feature, "int8"); - tdesc_create_vector (feature, "v16i8", field_type, 16); + element_type = tdesc_named_type (feature, "int8"); + tdesc_create_vector (feature, "v16i8", element_type, 16); - field_type = tdesc_named_type (feature, "int16"); - tdesc_create_vector (feature, "v8i16", field_type, 8); + element_type = tdesc_named_type (feature, "int16"); + tdesc_create_vector (feature, "v8i16", element_type, 8); - field_type = tdesc_named_type (feature, "int32"); - tdesc_create_vector (feature, "v4i32", field_type, 4); + element_type = tdesc_named_type (feature, "int32"); + tdesc_create_vector (feature, "v4i32", element_type, 4); - field_type = tdesc_named_type (feature, "int64"); - tdesc_create_vector (feature, "v2i64", field_type, 2); + element_type = tdesc_named_type (feature, "int64"); + tdesc_create_vector (feature, "v2i64", element_type, 2); - struct tdesc_type *type; - type = tdesc_create_union (feature, "vec128"); + tdesc_type_with_fields *type_with_fields; + tdesc_type *field_type; + type_with_fields = tdesc_create_union (feature, "vec128"); field_type = tdesc_named_type (feature, "v4f"); - tdesc_add_field (type, "v4_float", field_type); + tdesc_add_field (type_with_fields, "v4_float", field_type); field_type = tdesc_named_type (feature, "v2d"); - tdesc_add_field (type, "v2_double", field_type); + tdesc_add_field (type_with_fields, "v2_double", field_type); field_type = tdesc_named_type (feature, "v16i8"); - tdesc_add_field (type, "v16_int8", field_type); + tdesc_add_field (type_with_fields, "v16_int8", field_type); field_type = tdesc_named_type (feature, "v8i16"); - tdesc_add_field (type, "v8_int16", field_type); + tdesc_add_field (type_with_fields, "v8_int16", field_type); field_type = tdesc_named_type (feature, "v4i32"); - tdesc_add_field (type, "v4_int32", field_type); + tdesc_add_field (type_with_fields, "v4_int32", field_type); field_type = tdesc_named_type (feature, "v2i64"); - tdesc_add_field (type, "v2_int64", field_type); + tdesc_add_field (type_with_fields, "v2_int64", field_type); field_type = tdesc_named_type (feature, "uint128"); - tdesc_add_field (type, "uint128", field_type); + tdesc_add_field (type_with_fields, "uint128", field_type); - field_type = tdesc_named_type (feature, "uint128"); - tdesc_create_vector (feature, "v2ui128", field_type, 2); + element_type = tdesc_named_type (feature, "uint128"); + tdesc_create_vector (feature, "v2ui128", element_type, 2); tdesc_create_reg (feature, "xmm16", regnum++, 1, NULL, 128, "vec128"); tdesc_create_reg (feature, "xmm17", regnum++, 1, NULL, 128, "vec128"); diff --git a/gdb/features/i386/64bit-core.c b/gdb/features/i386/64bit-core.c index 14d4a19..f4cad06 100644 --- a/gdb/features/i386/64bit-core.c +++ b/gdb/features/i386/64bit-core.c @@ -9,26 +9,26 @@ create_feature_i386_64bit_core (struct target_desc *result, long regnum) struct tdesc_feature *feature; feature = tdesc_create_feature (result, "org.gnu.gdb.i386.core", "64bit-core.xml"); - struct tdesc_type *field_type; - struct tdesc_type *type; - type = tdesc_create_flags (feature, "i386_eflags", 4); - tdesc_add_flag (type, 0, "CF"); - tdesc_add_flag (type, 1, ""); - tdesc_add_flag (type, 2, "PF"); - tdesc_add_flag (type, 4, "AF"); - tdesc_add_flag (type, 6, "ZF"); - tdesc_add_flag (type, 7, "SF"); - tdesc_add_flag (type, 8, "TF"); - tdesc_add_flag (type, 9, "IF"); - tdesc_add_flag (type, 10, "DF"); - tdesc_add_flag (type, 11, "OF"); - tdesc_add_flag (type, 14, "NT"); - tdesc_add_flag (type, 16, "RF"); - tdesc_add_flag (type, 17, "VM"); - tdesc_add_flag (type, 18, "AC"); - tdesc_add_flag (type, 19, "VIF"); - tdesc_add_flag (type, 20, "VIP"); - tdesc_add_flag (type, 21, "ID"); + tdesc_type_with_fields *type_with_fields; + tdesc_type *field_type; + type_with_fields = tdesc_create_flags (feature, "i386_eflags", 4); + tdesc_add_flag (type_with_fields, 0, "CF"); + tdesc_add_flag (type_with_fields, 1, ""); + tdesc_add_flag (type_with_fields, 2, "PF"); + tdesc_add_flag (type_with_fields, 4, "AF"); + tdesc_add_flag (type_with_fields, 6, "ZF"); + tdesc_add_flag (type_with_fields, 7, "SF"); + tdesc_add_flag (type_with_fields, 8, "TF"); + tdesc_add_flag (type_with_fields, 9, "IF"); + tdesc_add_flag (type_with_fields, 10, "DF"); + tdesc_add_flag (type_with_fields, 11, "OF"); + tdesc_add_flag (type_with_fields, 14, "NT"); + tdesc_add_flag (type_with_fields, 16, "RF"); + tdesc_add_flag (type_with_fields, 17, "VM"); + tdesc_add_flag (type_with_fields, 18, "AC"); + tdesc_add_flag (type_with_fields, 19, "VIF"); + tdesc_add_flag (type_with_fields, 20, "VIP"); + tdesc_add_flag (type_with_fields, 21, "ID"); tdesc_create_reg (feature, "rax", regnum++, 1, NULL, 64, "int64"); tdesc_create_reg (feature, "rbx", regnum++, 1, NULL, 64, "int64"); diff --git a/gdb/features/i386/64bit-mpx.c b/gdb/features/i386/64bit-mpx.c index 2751e03..f8730b4 100644 --- a/gdb/features/i386/64bit-mpx.c +++ b/gdb/features/i386/64bit-mpx.c @@ -9,37 +9,37 @@ create_feature_i386_64bit_mpx (struct target_desc *result, long regnum) struct tdesc_feature *feature; feature = tdesc_create_feature (result, "org.gnu.gdb.i386.mpx", "64bit-mpx.xml"); - struct tdesc_type *field_type; - struct tdesc_type *type; - type = tdesc_create_struct (feature, "br128"); + tdesc_type_with_fields *type_with_fields; + tdesc_type *field_type; + type_with_fields = tdesc_create_struct (feature, "br128"); field_type = tdesc_named_type (feature, "uint64"); - tdesc_add_field (type, "lbound", field_type); + tdesc_add_field (type_with_fields, "lbound", field_type); field_type = tdesc_named_type (feature, "uint64"); - tdesc_add_field (type, "ubound_raw", field_type); + tdesc_add_field (type_with_fields, "ubound_raw", field_type); - type = tdesc_create_struct (feature, "_bndstatus"); - tdesc_set_struct_size (type, 8); - tdesc_add_bitfield (type, "bde", 2, 63); - tdesc_add_bitfield (type, "error", 0, 1); + type_with_fields = tdesc_create_struct (feature, "_bndstatus"); + tdesc_set_struct_size (type_with_fields, 8); + tdesc_add_bitfield (type_with_fields, "bde", 2, 63); + tdesc_add_bitfield (type_with_fields, "error", 0, 1); - type = tdesc_create_union (feature, "status"); + type_with_fields = tdesc_create_union (feature, "status"); field_type = tdesc_named_type (feature, "data_ptr"); - tdesc_add_field (type, "raw", field_type); + tdesc_add_field (type_with_fields, "raw", field_type); field_type = tdesc_named_type (feature, "_bndstatus"); - tdesc_add_field (type, "status", field_type); + tdesc_add_field (type_with_fields, "status", field_type); - type = tdesc_create_struct (feature, "_bndcfgu"); - tdesc_set_struct_size (type, 8); - tdesc_add_bitfield (type, "base", 12, 63); - tdesc_add_bitfield (type, "reserved", 2, 11); - tdesc_add_bitfield (type, "preserved", 1, 1); - tdesc_add_bitfield (type, "enabled", 0, 0); + type_with_fields = tdesc_create_struct (feature, "_bndcfgu"); + tdesc_set_struct_size (type_with_fields, 8); + tdesc_add_bitfield (type_with_fields, "base", 12, 63); + tdesc_add_bitfield (type_with_fields, "reserved", 2, 11); + tdesc_add_bitfield (type_with_fields, "preserved", 1, 1); + tdesc_add_bitfield (type_with_fields, "enabled", 0, 0); - type = tdesc_create_union (feature, "cfgu"); + type_with_fields = tdesc_create_union (feature, "cfgu"); field_type = tdesc_named_type (feature, "data_ptr"); - tdesc_add_field (type, "raw", field_type); + tdesc_add_field (type_with_fields, "raw", field_type); field_type = tdesc_named_type (feature, "_bndcfgu"); - tdesc_add_field (type, "config", field_type); + tdesc_add_field (type_with_fields, "config", field_type); tdesc_create_reg (feature, "bnd0raw", regnum++, 1, NULL, 128, "br128"); tdesc_create_reg (feature, "bnd1raw", regnum++, 1, NULL, 128, "br128"); diff --git a/gdb/features/i386/64bit-sse.c b/gdb/features/i386/64bit-sse.c index bc38498..e4f99c2 100644 --- a/gdb/features/i386/64bit-sse.c +++ b/gdb/features/i386/64bit-sse.c @@ -9,57 +9,58 @@ create_feature_i386_64bit_sse (struct target_desc *result, long regnum) struct tdesc_feature *feature; feature = tdesc_create_feature (result, "org.gnu.gdb.i386.sse", "64bit-sse.xml"); - struct tdesc_type *field_type; - field_type = tdesc_named_type (feature, "ieee_single"); - tdesc_create_vector (feature, "v4f", field_type, 4); + tdesc_type *element_type; + element_type = tdesc_named_type (feature, "ieee_single"); + tdesc_create_vector (feature, "v4f", element_type, 4); - field_type = tdesc_named_type (feature, "ieee_double"); - tdesc_create_vector (feature, "v2d", field_type, 2); + element_type = tdesc_named_type (feature, "ieee_double"); + tdesc_create_vector (feature, "v2d", element_type, 2); - field_type = tdesc_named_type (feature, "int8"); - tdesc_create_vector (feature, "v16i8", field_type, 16); + element_type = tdesc_named_type (feature, "int8"); + tdesc_create_vector (feature, "v16i8", element_type, 16); - field_type = tdesc_named_type (feature, "int16"); - tdesc_create_vector (feature, "v8i16", field_type, 8); + element_type = tdesc_named_type (feature, "int16"); + tdesc_create_vector (feature, "v8i16", element_type, 8); - field_type = tdesc_named_type (feature, "int32"); - tdesc_create_vector (feature, "v4i32", field_type, 4); + element_type = tdesc_named_type (feature, "int32"); + tdesc_create_vector (feature, "v4i32", element_type, 4); - field_type = tdesc_named_type (feature, "int64"); - tdesc_create_vector (feature, "v2i64", field_type, 2); + element_type = tdesc_named_type (feature, "int64"); + tdesc_create_vector (feature, "v2i64", element_type, 2); - struct tdesc_type *type; - type = tdesc_create_union (feature, "vec128"); + tdesc_type_with_fields *type_with_fields; + tdesc_type *field_type; + type_with_fields = tdesc_create_union (feature, "vec128"); field_type = tdesc_named_type (feature, "v4f"); - tdesc_add_field (type, "v4_float", field_type); + tdesc_add_field (type_with_fields, "v4_float", field_type); field_type = tdesc_named_type (feature, "v2d"); - tdesc_add_field (type, "v2_double", field_type); + tdesc_add_field (type_with_fields, "v2_double", field_type); field_type = tdesc_named_type (feature, "v16i8"); - tdesc_add_field (type, "v16_int8", field_type); + tdesc_add_field (type_with_fields, "v16_int8", field_type); field_type = tdesc_named_type (feature, "v8i16"); - tdesc_add_field (type, "v8_int16", field_type); + tdesc_add_field (type_with_fields, "v8_int16", field_type); field_type = tdesc_named_type (feature, "v4i32"); - tdesc_add_field (type, "v4_int32", field_type); + tdesc_add_field (type_with_fields, "v4_int32", field_type); field_type = tdesc_named_type (feature, "v2i64"); - tdesc_add_field (type, "v2_int64", field_type); + tdesc_add_field (type_with_fields, "v2_int64", field_type); field_type = tdesc_named_type (feature, "uint128"); - tdesc_add_field (type, "uint128", field_type); + tdesc_add_field (type_with_fields, "uint128", field_type); - type = tdesc_create_flags (feature, "i386_mxcsr", 4); - tdesc_add_flag (type, 0, "IE"); - tdesc_add_flag (type, 1, "DE"); - tdesc_add_flag (type, 2, "ZE"); - tdesc_add_flag (type, 3, "OE"); - tdesc_add_flag (type, 4, "UE"); - tdesc_add_flag (type, 5, "PE"); - tdesc_add_flag (type, 6, "DAZ"); - tdesc_add_flag (type, 7, "IM"); - tdesc_add_flag (type, 8, "DM"); - tdesc_add_flag (type, 9, "ZM"); - tdesc_add_flag (type, 10, "OM"); - tdesc_add_flag (type, 11, "UM"); - tdesc_add_flag (type, 12, "PM"); - tdesc_add_flag (type, 15, "FZ"); + type_with_fields = tdesc_create_flags (feature, "i386_mxcsr", 4); + tdesc_add_flag (type_with_fields, 0, "IE"); + tdesc_add_flag (type_with_fields, 1, "DE"); + tdesc_add_flag (type_with_fields, 2, "ZE"); + tdesc_add_flag (type_with_fields, 3, "OE"); + tdesc_add_flag (type_with_fields, 4, "UE"); + tdesc_add_flag (type_with_fields, 5, "PE"); + tdesc_add_flag (type_with_fields, 6, "DAZ"); + tdesc_add_flag (type_with_fields, 7, "IM"); + tdesc_add_flag (type_with_fields, 8, "DM"); + tdesc_add_flag (type_with_fields, 9, "ZM"); + tdesc_add_flag (type_with_fields, 10, "OM"); + tdesc_add_flag (type_with_fields, 11, "UM"); + tdesc_add_flag (type_with_fields, 12, "PM"); + tdesc_add_flag (type_with_fields, 15, "FZ"); regnum = 40; tdesc_create_reg (feature, "xmm0", regnum++, 1, NULL, 128, "vec128"); diff --git a/gdb/features/i386/x32-core.c b/gdb/features/i386/x32-core.c index 3939abc..acafc7d 100644 --- a/gdb/features/i386/x32-core.c +++ b/gdb/features/i386/x32-core.c @@ -9,26 +9,26 @@ create_feature_i386_x32_core (struct target_desc *result, long regnum) struct tdesc_feature *feature; feature = tdesc_create_feature (result, "org.gnu.gdb.i386.core", "x32-core.xml"); - struct tdesc_type *field_type; - struct tdesc_type *type; - type = tdesc_create_flags (feature, "i386_eflags", 4); - tdesc_add_flag (type, 0, "CF"); - tdesc_add_flag (type, 1, ""); - tdesc_add_flag (type, 2, "PF"); - tdesc_add_flag (type, 4, "AF"); - tdesc_add_flag (type, 6, "ZF"); - tdesc_add_flag (type, 7, "SF"); - tdesc_add_flag (type, 8, "TF"); - tdesc_add_flag (type, 9, "IF"); - tdesc_add_flag (type, 10, "DF"); - tdesc_add_flag (type, 11, "OF"); - tdesc_add_flag (type, 14, "NT"); - tdesc_add_flag (type, 16, "RF"); - tdesc_add_flag (type, 17, "VM"); - tdesc_add_flag (type, 18, "AC"); - tdesc_add_flag (type, 19, "VIF"); - tdesc_add_flag (type, 20, "VIP"); - tdesc_add_flag (type, 21, "ID"); + tdesc_type_with_fields *type_with_fields; + tdesc_type *field_type; + type_with_fields = tdesc_create_flags (feature, "i386_eflags", 4); + tdesc_add_flag (type_with_fields, 0, "CF"); + tdesc_add_flag (type_with_fields, 1, ""); + tdesc_add_flag (type_with_fields, 2, "PF"); + tdesc_add_flag (type_with_fields, 4, "AF"); + tdesc_add_flag (type_with_fields, 6, "ZF"); + tdesc_add_flag (type_with_fields, 7, "SF"); + tdesc_add_flag (type_with_fields, 8, "TF"); + tdesc_add_flag (type_with_fields, 9, "IF"); + tdesc_add_flag (type_with_fields, 10, "DF"); + tdesc_add_flag (type_with_fields, 11, "OF"); + tdesc_add_flag (type_with_fields, 14, "NT"); + tdesc_add_flag (type_with_fields, 16, "RF"); + tdesc_add_flag (type_with_fields, 17, "VM"); + tdesc_add_flag (type_with_fields, 18, "AC"); + tdesc_add_flag (type_with_fields, 19, "VIF"); + tdesc_add_flag (type_with_fields, 20, "VIP"); + tdesc_add_flag (type_with_fields, 21, "ID"); tdesc_create_reg (feature, "rax", regnum++, 1, NULL, 64, "int64"); tdesc_create_reg (feature, "rbx", regnum++, 1, NULL, 64, "int64"); diff --git a/gdb/features/rs6000/powerpc-7400.c b/gdb/features/rs6000/powerpc-7400.c index 32b6995..ba9f12c 100644 --- a/gdb/features/rs6000/powerpc-7400.c +++ b/gdb/features/rs6000/powerpc-7400.c @@ -138,31 +138,32 @@ initialize_tdesc_powerpc_7400 (void) tdesc_create_reg (feature, "ear", 118, 1, NULL, 32, "int"); feature = tdesc_create_feature (result, "org.gnu.gdb.power.altivec"); - struct tdesc_type *field_type; - field_type = tdesc_named_type (feature, "ieee_single"); - tdesc_create_vector (feature, "v4f", field_type, 4); + tdesc_type *element_type; + element_type = tdesc_named_type (feature, "ieee_single"); + tdesc_create_vector (feature, "v4f", element_type, 4); - field_type = tdesc_named_type (feature, "int32"); - tdesc_create_vector (feature, "v4i32", field_type, 4); + element_type = tdesc_named_type (feature, "int32"); + tdesc_create_vector (feature, "v4i32", element_type, 4); - field_type = tdesc_named_type (feature, "int16"); - tdesc_create_vector (feature, "v8i16", field_type, 8); + element_type = tdesc_named_type (feature, "int16"); + tdesc_create_vector (feature, "v8i16", element_type, 8); - field_type = tdesc_named_type (feature, "int8"); - tdesc_create_vector (feature, "v16i8", field_type, 16); + element_type = tdesc_named_type (feature, "int8"); + tdesc_create_vector (feature, "v16i8", element_type, 16); - struct tdesc_type *type; - type = tdesc_create_union (feature, "vec128"); + tdesc_type_with_fields *type_with_fields; + tdesc_type *field_type; + type_with_fields = tdesc_create_union (feature, "vec128"); field_type = tdesc_named_type (feature, "uint128"); - tdesc_add_field (type, "uint128", field_type); + tdesc_add_field (type_with_fields, "uint128", field_type); field_type = tdesc_named_type (feature, "v4f"); - tdesc_add_field (type, "v4_float", field_type); + tdesc_add_field (type_with_fields, "v4_float", field_type); field_type = tdesc_named_type (feature, "v4i32"); - tdesc_add_field (type, "v4_int32", field_type); + tdesc_add_field (type_with_fields, "v4_int32", field_type); field_type = tdesc_named_type (feature, "v8i16"); - tdesc_add_field (type, "v8_int16", field_type); + tdesc_add_field (type_with_fields, "v8_int16", field_type); field_type = tdesc_named_type (feature, "v16i8"); - tdesc_add_field (type, "v16_int8", field_type); + tdesc_add_field (type_with_fields, "v16_int8", field_type); tdesc_create_reg (feature, "vr0", 119, 1, NULL, 128, "vec128"); tdesc_create_reg (feature, "vr1", 120, 1, NULL, 128, "vec128"); diff --git a/gdb/features/rs6000/powerpc-altivec32.c b/gdb/features/rs6000/powerpc-altivec32.c index e97132e..9cb83ca 100644 --- a/gdb/features/rs6000/powerpc-altivec32.c +++ b/gdb/features/rs6000/powerpc-altivec32.c @@ -90,31 +90,32 @@ initialize_tdesc_powerpc_altivec32 (void) tdesc_create_reg (feature, "fpscr", 70, 1, "float", 32, "int"); feature = tdesc_create_feature (result, "org.gnu.gdb.power.altivec"); - struct tdesc_type *field_type; - field_type = tdesc_named_type (feature, "ieee_single"); - tdesc_create_vector (feature, "v4f", field_type, 4); + tdesc_type *element_type; + element_type = tdesc_named_type (feature, "ieee_single"); + tdesc_create_vector (feature, "v4f", element_type, 4); - field_type = tdesc_named_type (feature, "int32"); - tdesc_create_vector (feature, "v4i32", field_type, 4); + element_type = tdesc_named_type (feature, "int32"); + tdesc_create_vector (feature, "v4i32", element_type, 4); - field_type = tdesc_named_type (feature, "int16"); - tdesc_create_vector (feature, "v8i16", field_type, 8); + element_type = tdesc_named_type (feature, "int16"); + tdesc_create_vector (feature, "v8i16", element_type, 8); - field_type = tdesc_named_type (feature, "int8"); - tdesc_create_vector (feature, "v16i8", field_type, 16); + element_type = tdesc_named_type (feature, "int8"); + tdesc_create_vector (feature, "v16i8", element_type, 16); - struct tdesc_type *type; - type = tdesc_create_union (feature, "vec128"); + tdesc_type_with_fields *type_with_fields; + tdesc_type *field_type; + type_with_fields = tdesc_create_union (feature, "vec128"); field_type = tdesc_named_type (feature, "uint128"); - tdesc_add_field (type, "uint128", field_type); + tdesc_add_field (type_with_fields, "uint128", field_type); field_type = tdesc_named_type (feature, "v4f"); - tdesc_add_field (type, "v4_float", field_type); + tdesc_add_field (type_with_fields, "v4_float", field_type); field_type = tdesc_named_type (feature, "v4i32"); - tdesc_add_field (type, "v4_int32", field_type); + tdesc_add_field (type_with_fields, "v4_int32", field_type); field_type = tdesc_named_type (feature, "v8i16"); - tdesc_add_field (type, "v8_int16", field_type); + tdesc_add_field (type_with_fields, "v8_int16", field_type); field_type = tdesc_named_type (feature, "v16i8"); - tdesc_add_field (type, "v16_int8", field_type); + tdesc_add_field (type_with_fields, "v16_int8", field_type); tdesc_create_reg (feature, "vr0", 71, 1, NULL, 128, "vec128"); tdesc_create_reg (feature, "vr1", 72, 1, NULL, 128, "vec128"); diff --git a/gdb/features/rs6000/powerpc-altivec32l.c b/gdb/features/rs6000/powerpc-altivec32l.c index a9445d9..afaf8ed 100644 --- a/gdb/features/rs6000/powerpc-altivec32l.c +++ b/gdb/features/rs6000/powerpc-altivec32l.c @@ -94,31 +94,32 @@ initialize_tdesc_powerpc_altivec32l (void) tdesc_create_reg (feature, "trap", 72, 1, NULL, 32, "int"); feature = tdesc_create_feature (result, "org.gnu.gdb.power.altivec"); - struct tdesc_type *field_type; - field_type = tdesc_named_type (feature, "ieee_single"); - tdesc_create_vector (feature, "v4f", field_type, 4); + tdesc_type *element_type; + element_type = tdesc_named_type (feature, "ieee_single"); + tdesc_create_vector (feature, "v4f", element_type, 4); - field_type = tdesc_named_type (feature, "int32"); - tdesc_create_vector (feature, "v4i32", field_type, 4); + element_type = tdesc_named_type (feature, "int32"); + tdesc_create_vector (feature, "v4i32", element_type, 4); - field_type = tdesc_named_type (feature, "int16"); - tdesc_create_vector (feature, "v8i16", field_type, 8); + element_type = tdesc_named_type (feature, "int16"); + tdesc_create_vector (feature, "v8i16", element_type, 8); - field_type = tdesc_named_type (feature, "int8"); - tdesc_create_vector (feature, "v16i8", field_type, 16); + element_type = tdesc_named_type (feature, "int8"); + tdesc_create_vector (feature, "v16i8", element_type, 16); - struct tdesc_type *type; - type = tdesc_create_union (feature, "vec128"); + tdesc_type_with_fields *type_with_fields; + tdesc_type *field_type; + type_with_fields = tdesc_create_union (feature, "vec128"); field_type = tdesc_named_type (feature, "uint128"); - tdesc_add_field (type, "uint128", field_type); + tdesc_add_field (type_with_fields, "uint128", field_type); field_type = tdesc_named_type (feature, "v4f"); - tdesc_add_field (type, "v4_float", field_type); + tdesc_add_field (type_with_fields, "v4_float", field_type); field_type = tdesc_named_type (feature, "v4i32"); - tdesc_add_field (type, "v4_int32", field_type); + tdesc_add_field (type_with_fields, "v4_int32", field_type); field_type = tdesc_named_type (feature, "v8i16"); - tdesc_add_field (type, "v8_int16", field_type); + tdesc_add_field (type_with_fields, "v8_int16", field_type); field_type = tdesc_named_type (feature, "v16i8"); - tdesc_add_field (type, "v16_int8", field_type); + tdesc_add_field (type_with_fields, "v16_int8", field_type); tdesc_create_reg (feature, "vr0", 73, 1, NULL, 128, "vec128"); tdesc_create_reg (feature, "vr1", 74, 1, NULL, 128, "vec128"); diff --git a/gdb/features/rs6000/powerpc-altivec64.c b/gdb/features/rs6000/powerpc-altivec64.c index 3b626a9..94041e1 100644 --- a/gdb/features/rs6000/powerpc-altivec64.c +++ b/gdb/features/rs6000/powerpc-altivec64.c @@ -90,31 +90,32 @@ initialize_tdesc_powerpc_altivec64 (void) tdesc_create_reg (feature, "fpscr", 70, 1, "float", 32, "int"); feature = tdesc_create_feature (result, "org.gnu.gdb.power.altivec"); - struct tdesc_type *field_type; - field_type = tdesc_named_type (feature, "ieee_single"); - tdesc_create_vector (feature, "v4f", field_type, 4); + tdesc_type *element_type; + element_type = tdesc_named_type (feature, "ieee_single"); + tdesc_create_vector (feature, "v4f", element_type, 4); - field_type = tdesc_named_type (feature, "int32"); - tdesc_create_vector (feature, "v4i32", field_type, 4); + element_type = tdesc_named_type (feature, "int32"); + tdesc_create_vector (feature, "v4i32", element_type, 4); - field_type = tdesc_named_type (feature, "int16"); - tdesc_create_vector (feature, "v8i16", field_type, 8); + element_type = tdesc_named_type (feature, "int16"); + tdesc_create_vector (feature, "v8i16", element_type, 8); - field_type = tdesc_named_type (feature, "int8"); - tdesc_create_vector (feature, "v16i8", field_type, 16); + element_type = tdesc_named_type (feature, "int8"); + tdesc_create_vector (feature, "v16i8", element_type, 16); - struct tdesc_type *type; - type = tdesc_create_union (feature, "vec128"); + tdesc_type_with_fields *type_with_fields; + tdesc_type *field_type; + type_with_fields = tdesc_create_union (feature, "vec128"); field_type = tdesc_named_type (feature, "uint128"); - tdesc_add_field (type, "uint128", field_type); + tdesc_add_field (type_with_fields, "uint128", field_type); field_type = tdesc_named_type (feature, "v4f"); - tdesc_add_field (type, "v4_float", field_type); + tdesc_add_field (type_with_fields, "v4_float", field_type); field_type = tdesc_named_type (feature, "v4i32"); - tdesc_add_field (type, "v4_int32", field_type); + tdesc_add_field (type_with_fields, "v4_int32", field_type); field_type = tdesc_named_type (feature, "v8i16"); - tdesc_add_field (type, "v8_int16", field_type); + tdesc_add_field (type_with_fields, "v8_int16", field_type); field_type = tdesc_named_type (feature, "v16i8"); - tdesc_add_field (type, "v16_int8", field_type); + tdesc_add_field (type_with_fields, "v16_int8", field_type); tdesc_create_reg (feature, "vr0", 71, 1, NULL, 128, "vec128"); tdesc_create_reg (feature, "vr1", 72, 1, NULL, 128, "vec128"); diff --git a/gdb/features/rs6000/powerpc-altivec64l.c b/gdb/features/rs6000/powerpc-altivec64l.c index cca5353..c7ed171 100644 --- a/gdb/features/rs6000/powerpc-altivec64l.c +++ b/gdb/features/rs6000/powerpc-altivec64l.c @@ -94,31 +94,32 @@ initialize_tdesc_powerpc_altivec64l (void) tdesc_create_reg (feature, "trap", 72, 1, NULL, 64, "int"); feature = tdesc_create_feature (result, "org.gnu.gdb.power.altivec"); - struct tdesc_type *field_type; - field_type = tdesc_named_type (feature, "ieee_single"); - tdesc_create_vector (feature, "v4f", field_type, 4); + tdesc_type *element_type; + element_type = tdesc_named_type (feature, "ieee_single"); + tdesc_create_vector (feature, "v4f", element_type, 4); - field_type = tdesc_named_type (feature, "int32"); - tdesc_create_vector (feature, "v4i32", field_type, 4); + element_type = tdesc_named_type (feature, "int32"); + tdesc_create_vector (feature, "v4i32", element_type, 4); - field_type = tdesc_named_type (feature, "int16"); - tdesc_create_vector (feature, "v8i16", field_type, 8); + element_type = tdesc_named_type (feature, "int16"); + tdesc_create_vector (feature, "v8i16", element_type, 8); - field_type = tdesc_named_type (feature, "int8"); - tdesc_create_vector (feature, "v16i8", field_type, 16); + element_type = tdesc_named_type (feature, "int8"); + tdesc_create_vector (feature, "v16i8", element_type, 16); - struct tdesc_type *type; - type = tdesc_create_union (feature, "vec128"); + tdesc_type_with_fields *type_with_fields; + tdesc_type *field_type; + type_with_fields = tdesc_create_union (feature, "vec128"); field_type = tdesc_named_type (feature, "uint128"); - tdesc_add_field (type, "uint128", field_type); + tdesc_add_field (type_with_fields, "uint128", field_type); field_type = tdesc_named_type (feature, "v4f"); - tdesc_add_field (type, "v4_float", field_type); + tdesc_add_field (type_with_fields, "v4_float", field_type); field_type = tdesc_named_type (feature, "v4i32"); - tdesc_add_field (type, "v4_int32", field_type); + tdesc_add_field (type_with_fields, "v4_int32", field_type); field_type = tdesc_named_type (feature, "v8i16"); - tdesc_add_field (type, "v8_int16", field_type); + tdesc_add_field (type_with_fields, "v8_int16", field_type); field_type = tdesc_named_type (feature, "v16i8"); - tdesc_add_field (type, "v16_int8", field_type); + tdesc_add_field (type_with_fields, "v16_int8", field_type); tdesc_create_reg (feature, "vr0", 73, 1, NULL, 128, "vec128"); tdesc_create_reg (feature, "vr1", 74, 1, NULL, 128, "vec128"); diff --git a/gdb/features/rs6000/powerpc-cell32l.c b/gdb/features/rs6000/powerpc-cell32l.c index c615b8d..390d7b2 100644 --- a/gdb/features/rs6000/powerpc-cell32l.c +++ b/gdb/features/rs6000/powerpc-cell32l.c @@ -96,31 +96,32 @@ initialize_tdesc_powerpc_cell32l (void) tdesc_create_reg (feature, "trap", 72, 1, NULL, 32, "int"); feature = tdesc_create_feature (result, "org.gnu.gdb.power.altivec"); - struct tdesc_type *field_type; - field_type = tdesc_named_type (feature, "ieee_single"); - tdesc_create_vector (feature, "v4f", field_type, 4); + tdesc_type *element_type; + element_type = tdesc_named_type (feature, "ieee_single"); + tdesc_create_vector (feature, "v4f", element_type, 4); - field_type = tdesc_named_type (feature, "int32"); - tdesc_create_vector (feature, "v4i32", field_type, 4); + element_type = tdesc_named_type (feature, "int32"); + tdesc_create_vector (feature, "v4i32", element_type, 4); - field_type = tdesc_named_type (feature, "int16"); - tdesc_create_vector (feature, "v8i16", field_type, 8); + element_type = tdesc_named_type (feature, "int16"); + tdesc_create_vector (feature, "v8i16", element_type, 8); - field_type = tdesc_named_type (feature, "int8"); - tdesc_create_vector (feature, "v16i8", field_type, 16); + element_type = tdesc_named_type (feature, "int8"); + tdesc_create_vector (feature, "v16i8", element_type, 16); - struct tdesc_type *type; - type = tdesc_create_union (feature, "vec128"); + tdesc_type_with_fields *type_with_fields; + tdesc_type *field_type; + type_with_fields = tdesc_create_union (feature, "vec128"); field_type = tdesc_named_type (feature, "uint128"); - tdesc_add_field (type, "uint128", field_type); + tdesc_add_field (type_with_fields, "uint128", field_type); field_type = tdesc_named_type (feature, "v4f"); - tdesc_add_field (type, "v4_float", field_type); + tdesc_add_field (type_with_fields, "v4_float", field_type); field_type = tdesc_named_type (feature, "v4i32"); - tdesc_add_field (type, "v4_int32", field_type); + tdesc_add_field (type_with_fields, "v4_int32", field_type); field_type = tdesc_named_type (feature, "v8i16"); - tdesc_add_field (type, "v8_int16", field_type); + tdesc_add_field (type_with_fields, "v8_int16", field_type); field_type = tdesc_named_type (feature, "v16i8"); - tdesc_add_field (type, "v16_int8", field_type); + tdesc_add_field (type_with_fields, "v16_int8", field_type); tdesc_create_reg (feature, "vr0", 73, 1, NULL, 128, "vec128"); tdesc_create_reg (feature, "vr1", 74, 1, NULL, 128, "vec128"); diff --git a/gdb/features/rs6000/powerpc-cell64l.c b/gdb/features/rs6000/powerpc-cell64l.c index 5040e5e..39890ba 100644 --- a/gdb/features/rs6000/powerpc-cell64l.c +++ b/gdb/features/rs6000/powerpc-cell64l.c @@ -96,31 +96,32 @@ initialize_tdesc_powerpc_cell64l (void) tdesc_create_reg (feature, "trap", 72, 1, NULL, 64, "int"); feature = tdesc_create_feature (result, "org.gnu.gdb.power.altivec"); - struct tdesc_type *field_type; - field_type = tdesc_named_type (feature, "ieee_single"); - tdesc_create_vector (feature, "v4f", field_type, 4); + tdesc_type *element_type; + element_type = tdesc_named_type (feature, "ieee_single"); + tdesc_create_vector (feature, "v4f", element_type, 4); - field_type = tdesc_named_type (feature, "int32"); - tdesc_create_vector (feature, "v4i32", field_type, 4); + element_type = tdesc_named_type (feature, "int32"); + tdesc_create_vector (feature, "v4i32", element_type, 4); - field_type = tdesc_named_type (feature, "int16"); - tdesc_create_vector (feature, "v8i16", field_type, 8); + element_type = tdesc_named_type (feature, "int16"); + tdesc_create_vector (feature, "v8i16", element_type, 8); - field_type = tdesc_named_type (feature, "int8"); - tdesc_create_vector (feature, "v16i8", field_type, 16); + element_type = tdesc_named_type (feature, "int8"); + tdesc_create_vector (feature, "v16i8", element_type, 16); - struct tdesc_type *type; - type = tdesc_create_union (feature, "vec128"); + tdesc_type_with_fields *type_with_fields; + tdesc_type *field_type; + type_with_fields = tdesc_create_union (feature, "vec128"); field_type = tdesc_named_type (feature, "uint128"); - tdesc_add_field (type, "uint128", field_type); + tdesc_add_field (type_with_fields, "uint128", field_type); field_type = tdesc_named_type (feature, "v4f"); - tdesc_add_field (type, "v4_float", field_type); + tdesc_add_field (type_with_fields, "v4_float", field_type); field_type = tdesc_named_type (feature, "v4i32"); - tdesc_add_field (type, "v4_int32", field_type); + tdesc_add_field (type_with_fields, "v4_int32", field_type); field_type = tdesc_named_type (feature, "v8i16"); - tdesc_add_field (type, "v8_int16", field_type); + tdesc_add_field (type_with_fields, "v8_int16", field_type); field_type = tdesc_named_type (feature, "v16i8"); - tdesc_add_field (type, "v16_int8", field_type); + tdesc_add_field (type_with_fields, "v16_int8", field_type); tdesc_create_reg (feature, "vr0", 73, 1, NULL, 128, "vec128"); tdesc_create_reg (feature, "vr1", 74, 1, NULL, 128, "vec128"); diff --git a/gdb/features/rs6000/powerpc-isa205-altivec32l.c b/gdb/features/rs6000/powerpc-isa205-altivec32l.c index 943d02d..203bb4a 100644 --- a/gdb/features/rs6000/powerpc-isa205-altivec32l.c +++ b/gdb/features/rs6000/powerpc-isa205-altivec32l.c @@ -94,31 +94,32 @@ initialize_tdesc_powerpc_isa205_altivec32l (void) tdesc_create_reg (feature, "trap", 72, 1, NULL, 32, "int"); feature = tdesc_create_feature (result, "org.gnu.gdb.power.altivec"); - struct tdesc_type *field_type; - field_type = tdesc_named_type (feature, "ieee_single"); - tdesc_create_vector (feature, "v4f", field_type, 4); + tdesc_type *element_type; + element_type = tdesc_named_type (feature, "ieee_single"); + tdesc_create_vector (feature, "v4f", element_type, 4); - field_type = tdesc_named_type (feature, "int32"); - tdesc_create_vector (feature, "v4i32", field_type, 4); + element_type = tdesc_named_type (feature, "int32"); + tdesc_create_vector (feature, "v4i32", element_type, 4); - field_type = tdesc_named_type (feature, "int16"); - tdesc_create_vector (feature, "v8i16", field_type, 8); + element_type = tdesc_named_type (feature, "int16"); + tdesc_create_vector (feature, "v8i16", element_type, 8); - field_type = tdesc_named_type (feature, "int8"); - tdesc_create_vector (feature, "v16i8", field_type, 16); + element_type = tdesc_named_type (feature, "int8"); + tdesc_create_vector (feature, "v16i8", element_type, 16); - struct tdesc_type *type; - type = tdesc_create_union (feature, "vec128"); + tdesc_type_with_fields *type_with_fields; + tdesc_type *field_type; + type_with_fields = tdesc_create_union (feature, "vec128"); field_type = tdesc_named_type (feature, "uint128"); - tdesc_add_field (type, "uint128", field_type); + tdesc_add_field (type_with_fields, "uint128", field_type); field_type = tdesc_named_type (feature, "v4f"); - tdesc_add_field (type, "v4_float", field_type); + tdesc_add_field (type_with_fields, "v4_float", field_type); field_type = tdesc_named_type (feature, "v4i32"); - tdesc_add_field (type, "v4_int32", field_type); + tdesc_add_field (type_with_fields, "v4_int32", field_type); field_type = tdesc_named_type (feature, "v8i16"); - tdesc_add_field (type, "v8_int16", field_type); + tdesc_add_field (type_with_fields, "v8_int16", field_type); field_type = tdesc_named_type (feature, "v16i8"); - tdesc_add_field (type, "v16_int8", field_type); + tdesc_add_field (type_with_fields, "v16_int8", field_type); tdesc_create_reg (feature, "vr0", 73, 1, NULL, 128, "vec128"); tdesc_create_reg (feature, "vr1", 74, 1, NULL, 128, "vec128"); diff --git a/gdb/features/rs6000/powerpc-isa205-altivec64l.c b/gdb/features/rs6000/powerpc-isa205-altivec64l.c index d454bac..8f66a16 100644 --- a/gdb/features/rs6000/powerpc-isa205-altivec64l.c +++ b/gdb/features/rs6000/powerpc-isa205-altivec64l.c @@ -94,31 +94,32 @@ initialize_tdesc_powerpc_isa205_altivec64l (void) tdesc_create_reg (feature, "trap", 72, 1, NULL, 64, "int"); feature = tdesc_create_feature (result, "org.gnu.gdb.power.altivec"); - struct tdesc_type *field_type; - field_type = tdesc_named_type (feature, "ieee_single"); - tdesc_create_vector (feature, "v4f", field_type, 4); + tdesc_type *element_type; + element_type = tdesc_named_type (feature, "ieee_single"); + tdesc_create_vector (feature, "v4f", element_type, 4); - field_type = tdesc_named_type (feature, "int32"); - tdesc_create_vector (feature, "v4i32", field_type, 4); + element_type = tdesc_named_type (feature, "int32"); + tdesc_create_vector (feature, "v4i32", element_type, 4); - field_type = tdesc_named_type (feature, "int16"); - tdesc_create_vector (feature, "v8i16", field_type, 8); + element_type = tdesc_named_type (feature, "int16"); + tdesc_create_vector (feature, "v8i16", element_type, 8); - field_type = tdesc_named_type (feature, "int8"); - tdesc_create_vector (feature, "v16i8", field_type, 16); + element_type = tdesc_named_type (feature, "int8"); + tdesc_create_vector (feature, "v16i8", element_type, 16); - struct tdesc_type *type; - type = tdesc_create_union (feature, "vec128"); + tdesc_type_with_fields *type_with_fields; + tdesc_type *field_type; + type_with_fields = tdesc_create_union (feature, "vec128"); field_type = tdesc_named_type (feature, "uint128"); - tdesc_add_field (type, "uint128", field_type); + tdesc_add_field (type_with_fields, "uint128", field_type); field_type = tdesc_named_type (feature, "v4f"); - tdesc_add_field (type, "v4_float", field_type); + tdesc_add_field (type_with_fields, "v4_float", field_type); field_type = tdesc_named_type (feature, "v4i32"); - tdesc_add_field (type, "v4_int32", field_type); + tdesc_add_field (type_with_fields, "v4_int32", field_type); field_type = tdesc_named_type (feature, "v8i16"); - tdesc_add_field (type, "v8_int16", field_type); + tdesc_add_field (type_with_fields, "v8_int16", field_type); field_type = tdesc_named_type (feature, "v16i8"); - tdesc_add_field (type, "v16_int8", field_type); + tdesc_add_field (type_with_fields, "v16_int8", field_type); tdesc_create_reg (feature, "vr0", 73, 1, NULL, 128, "vec128"); tdesc_create_reg (feature, "vr1", 74, 1, NULL, 128, "vec128"); diff --git a/gdb/features/rs6000/powerpc-isa205-vsx32l.c b/gdb/features/rs6000/powerpc-isa205-vsx32l.c index 09fd5ce..fc0f615 100644 --- a/gdb/features/rs6000/powerpc-isa205-vsx32l.c +++ b/gdb/features/rs6000/powerpc-isa205-vsx32l.c @@ -94,31 +94,32 @@ initialize_tdesc_powerpc_isa205_vsx32l (void) tdesc_create_reg (feature, "trap", 72, 1, NULL, 32, "int"); feature = tdesc_create_feature (result, "org.gnu.gdb.power.altivec"); - struct tdesc_type *field_type; - field_type = tdesc_named_type (feature, "ieee_single"); - tdesc_create_vector (feature, "v4f", field_type, 4); + tdesc_type *element_type; + element_type = tdesc_named_type (feature, "ieee_single"); + tdesc_create_vector (feature, "v4f", element_type, 4); - field_type = tdesc_named_type (feature, "int32"); - tdesc_create_vector (feature, "v4i32", field_type, 4); + element_type = tdesc_named_type (feature, "int32"); + tdesc_create_vector (feature, "v4i32", element_type, 4); - field_type = tdesc_named_type (feature, "int16"); - tdesc_create_vector (feature, "v8i16", field_type, 8); + element_type = tdesc_named_type (feature, "int16"); + tdesc_create_vector (feature, "v8i16", element_type, 8); - field_type = tdesc_named_type (feature, "int8"); - tdesc_create_vector (feature, "v16i8", field_type, 16); + element_type = tdesc_named_type (feature, "int8"); + tdesc_create_vector (feature, "v16i8", element_type, 16); - struct tdesc_type *type; - type = tdesc_create_union (feature, "vec128"); + tdesc_type_with_fields *type_with_fields; + tdesc_type *field_type; + type_with_fields = tdesc_create_union (feature, "vec128"); field_type = tdesc_named_type (feature, "uint128"); - tdesc_add_field (type, "uint128", field_type); + tdesc_add_field (type_with_fields, "uint128", field_type); field_type = tdesc_named_type (feature, "v4f"); - tdesc_add_field (type, "v4_float", field_type); + tdesc_add_field (type_with_fields, "v4_float", field_type); field_type = tdesc_named_type (feature, "v4i32"); - tdesc_add_field (type, "v4_int32", field_type); + tdesc_add_field (type_with_fields, "v4_int32", field_type); field_type = tdesc_named_type (feature, "v8i16"); - tdesc_add_field (type, "v8_int16", field_type); + tdesc_add_field (type_with_fields, "v8_int16", field_type); field_type = tdesc_named_type (feature, "v16i8"); - tdesc_add_field (type, "v16_int8", field_type); + tdesc_add_field (type_with_fields, "v16_int8", field_type); tdesc_create_reg (feature, "vr0", 73, 1, NULL, 128, "vec128"); tdesc_create_reg (feature, "vr1", 74, 1, NULL, 128, "vec128"); diff --git a/gdb/features/rs6000/powerpc-isa205-vsx64l.c b/gdb/features/rs6000/powerpc-isa205-vsx64l.c index d295ab7..3313d04 100644 --- a/gdb/features/rs6000/powerpc-isa205-vsx64l.c +++ b/gdb/features/rs6000/powerpc-isa205-vsx64l.c @@ -94,31 +94,32 @@ initialize_tdesc_powerpc_isa205_vsx64l (void) tdesc_create_reg (feature, "trap", 72, 1, NULL, 64, "int"); feature = tdesc_create_feature (result, "org.gnu.gdb.power.altivec"); - struct tdesc_type *field_type; - field_type = tdesc_named_type (feature, "ieee_single"); - tdesc_create_vector (feature, "v4f", field_type, 4); + tdesc_type *element_type; + element_type = tdesc_named_type (feature, "ieee_single"); + tdesc_create_vector (feature, "v4f", element_type, 4); - field_type = tdesc_named_type (feature, "int32"); - tdesc_create_vector (feature, "v4i32", field_type, 4); + element_type = tdesc_named_type (feature, "int32"); + tdesc_create_vector (feature, "v4i32", element_type, 4); - field_type = tdesc_named_type (feature, "int16"); - tdesc_create_vector (feature, "v8i16", field_type, 8); + element_type = tdesc_named_type (feature, "int16"); + tdesc_create_vector (feature, "v8i16", element_type, 8); - field_type = tdesc_named_type (feature, "int8"); - tdesc_create_vector (feature, "v16i8", field_type, 16); + element_type = tdesc_named_type (feature, "int8"); + tdesc_create_vector (feature, "v16i8", element_type, 16); - struct tdesc_type *type; - type = tdesc_create_union (feature, "vec128"); + tdesc_type_with_fields *type_with_fields; + tdesc_type *field_type; + type_with_fields = tdesc_create_union (feature, "vec128"); field_type = tdesc_named_type (feature, "uint128"); - tdesc_add_field (type, "uint128", field_type); + tdesc_add_field (type_with_fields, "uint128", field_type); field_type = tdesc_named_type (feature, "v4f"); - tdesc_add_field (type, "v4_float", field_type); + tdesc_add_field (type_with_fields, "v4_float", field_type); field_type = tdesc_named_type (feature, "v4i32"); - tdesc_add_field (type, "v4_int32", field_type); + tdesc_add_field (type_with_fields, "v4_int32", field_type); field_type = tdesc_named_type (feature, "v8i16"); - tdesc_add_field (type, "v8_int16", field_type); + tdesc_add_field (type_with_fields, "v8_int16", field_type); field_type = tdesc_named_type (feature, "v16i8"); - tdesc_add_field (type, "v16_int8", field_type); + tdesc_add_field (type_with_fields, "v16_int8", field_type); tdesc_create_reg (feature, "vr0", 73, 1, NULL, 128, "vec128"); tdesc_create_reg (feature, "vr1", 74, 1, NULL, 128, "vec128"); diff --git a/gdb/features/rs6000/powerpc-vsx32.c b/gdb/features/rs6000/powerpc-vsx32.c index 8cf7562..1a824a8 100644 --- a/gdb/features/rs6000/powerpc-vsx32.c +++ b/gdb/features/rs6000/powerpc-vsx32.c @@ -90,31 +90,32 @@ initialize_tdesc_powerpc_vsx32 (void) tdesc_create_reg (feature, "fpscr", 70, 1, "float", 32, "int"); feature = tdesc_create_feature (result, "org.gnu.gdb.power.altivec"); - struct tdesc_type *field_type; - field_type = tdesc_named_type (feature, "ieee_single"); - tdesc_create_vector (feature, "v4f", field_type, 4); + tdesc_type *element_type; + element_type = tdesc_named_type (feature, "ieee_single"); + tdesc_create_vector (feature, "v4f", element_type, 4); - field_type = tdesc_named_type (feature, "int32"); - tdesc_create_vector (feature, "v4i32", field_type, 4); + element_type = tdesc_named_type (feature, "int32"); + tdesc_create_vector (feature, "v4i32", element_type, 4); - field_type = tdesc_named_type (feature, "int16"); - tdesc_create_vector (feature, "v8i16", field_type, 8); + element_type = tdesc_named_type (feature, "int16"); + tdesc_create_vector (feature, "v8i16", element_type, 8); - field_type = tdesc_named_type (feature, "int8"); - tdesc_create_vector (feature, "v16i8", field_type, 16); + element_type = tdesc_named_type (feature, "int8"); + tdesc_create_vector (feature, "v16i8", element_type, 16); - struct tdesc_type *type; - type = tdesc_create_union (feature, "vec128"); + tdesc_type_with_fields *type_with_fields; + tdesc_type *field_type; + type_with_fields = tdesc_create_union (feature, "vec128"); field_type = tdesc_named_type (feature, "uint128"); - tdesc_add_field (type, "uint128", field_type); + tdesc_add_field (type_with_fields, "uint128", field_type); field_type = tdesc_named_type (feature, "v4f"); - tdesc_add_field (type, "v4_float", field_type); + tdesc_add_field (type_with_fields, "v4_float", field_type); field_type = tdesc_named_type (feature, "v4i32"); - tdesc_add_field (type, "v4_int32", field_type); + tdesc_add_field (type_with_fields, "v4_int32", field_type); field_type = tdesc_named_type (feature, "v8i16"); - tdesc_add_field (type, "v8_int16", field_type); + tdesc_add_field (type_with_fields, "v8_int16", field_type); field_type = tdesc_named_type (feature, "v16i8"); - tdesc_add_field (type, "v16_int8", field_type); + tdesc_add_field (type_with_fields, "v16_int8", field_type); tdesc_create_reg (feature, "vr0", 71, 1, NULL, 128, "vec128"); tdesc_create_reg (feature, "vr1", 72, 1, NULL, 128, "vec128"); diff --git a/gdb/features/rs6000/powerpc-vsx32l.c b/gdb/features/rs6000/powerpc-vsx32l.c index e8c1881..f5bf11e 100644 --- a/gdb/features/rs6000/powerpc-vsx32l.c +++ b/gdb/features/rs6000/powerpc-vsx32l.c @@ -94,31 +94,32 @@ initialize_tdesc_powerpc_vsx32l (void) tdesc_create_reg (feature, "trap", 72, 1, NULL, 32, "int"); feature = tdesc_create_feature (result, "org.gnu.gdb.power.altivec"); - struct tdesc_type *field_type; - field_type = tdesc_named_type (feature, "ieee_single"); - tdesc_create_vector (feature, "v4f", field_type, 4); + tdesc_type *element_type; + element_type = tdesc_named_type (feature, "ieee_single"); + tdesc_create_vector (feature, "v4f", element_type, 4); - field_type = tdesc_named_type (feature, "int32"); - tdesc_create_vector (feature, "v4i32", field_type, 4); + element_type = tdesc_named_type (feature, "int32"); + tdesc_create_vector (feature, "v4i32", element_type, 4); - field_type = tdesc_named_type (feature, "int16"); - tdesc_create_vector (feature, "v8i16", field_type, 8); + element_type = tdesc_named_type (feature, "int16"); + tdesc_create_vector (feature, "v8i16", element_type, 8); - field_type = tdesc_named_type (feature, "int8"); - tdesc_create_vector (feature, "v16i8", field_type, 16); + element_type = tdesc_named_type (feature, "int8"); + tdesc_create_vector (feature, "v16i8", element_type, 16); - struct tdesc_type *type; - type = tdesc_create_union (feature, "vec128"); + tdesc_type_with_fields *type_with_fields; + tdesc_type *field_type; + type_with_fields = tdesc_create_union (feature, "vec128"); field_type = tdesc_named_type (feature, "uint128"); - tdesc_add_field (type, "uint128", field_type); + tdesc_add_field (type_with_fields, "uint128", field_type); field_type = tdesc_named_type (feature, "v4f"); - tdesc_add_field (type, "v4_float", field_type); + tdesc_add_field (type_with_fields, "v4_float", field_type); field_type = tdesc_named_type (feature, "v4i32"); - tdesc_add_field (type, "v4_int32", field_type); + tdesc_add_field (type_with_fields, "v4_int32", field_type); field_type = tdesc_named_type (feature, "v8i16"); - tdesc_add_field (type, "v8_int16", field_type); + tdesc_add_field (type_with_fields, "v8_int16", field_type); field_type = tdesc_named_type (feature, "v16i8"); - tdesc_add_field (type, "v16_int8", field_type); + tdesc_add_field (type_with_fields, "v16_int8", field_type); tdesc_create_reg (feature, "vr0", 73, 1, NULL, 128, "vec128"); tdesc_create_reg (feature, "vr1", 74, 1, NULL, 128, "vec128"); diff --git a/gdb/features/rs6000/powerpc-vsx64.c b/gdb/features/rs6000/powerpc-vsx64.c index 30953c5..601df39 100644 --- a/gdb/features/rs6000/powerpc-vsx64.c +++ b/gdb/features/rs6000/powerpc-vsx64.c @@ -90,31 +90,32 @@ initialize_tdesc_powerpc_vsx64 (void) tdesc_create_reg (feature, "fpscr", 70, 1, "float", 32, "int"); feature = tdesc_create_feature (result, "org.gnu.gdb.power.altivec"); - struct tdesc_type *field_type; - field_type = tdesc_named_type (feature, "ieee_single"); - tdesc_create_vector (feature, "v4f", field_type, 4); + tdesc_type *element_type; + element_type = tdesc_named_type (feature, "ieee_single"); + tdesc_create_vector (feature, "v4f", element_type, 4); - field_type = tdesc_named_type (feature, "int32"); - tdesc_create_vector (feature, "v4i32", field_type, 4); + element_type = tdesc_named_type (feature, "int32"); + tdesc_create_vector (feature, "v4i32", element_type, 4); - field_type = tdesc_named_type (feature, "int16"); - tdesc_create_vector (feature, "v8i16", field_type, 8); + element_type = tdesc_named_type (feature, "int16"); + tdesc_create_vector (feature, "v8i16", element_type, 8); - field_type = tdesc_named_type (feature, "int8"); - tdesc_create_vector (feature, "v16i8", field_type, 16); + element_type = tdesc_named_type (feature, "int8"); + tdesc_create_vector (feature, "v16i8", element_type, 16); - struct tdesc_type *type; - type = tdesc_create_union (feature, "vec128"); + tdesc_type_with_fields *type_with_fields; + tdesc_type *field_type; + type_with_fields = tdesc_create_union (feature, "vec128"); field_type = tdesc_named_type (feature, "uint128"); - tdesc_add_field (type, "uint128", field_type); + tdesc_add_field (type_with_fields, "uint128", field_type); field_type = tdesc_named_type (feature, "v4f"); - tdesc_add_field (type, "v4_float", field_type); + tdesc_add_field (type_with_fields, "v4_float", field_type); field_type = tdesc_named_type (feature, "v4i32"); - tdesc_add_field (type, "v4_int32", field_type); + tdesc_add_field (type_with_fields, "v4_int32", field_type); field_type = tdesc_named_type (feature, "v8i16"); - tdesc_add_field (type, "v8_int16", field_type); + tdesc_add_field (type_with_fields, "v8_int16", field_type); field_type = tdesc_named_type (feature, "v16i8"); - tdesc_add_field (type, "v16_int8", field_type); + tdesc_add_field (type_with_fields, "v16_int8", field_type); tdesc_create_reg (feature, "vr0", 71, 1, NULL, 128, "vec128"); tdesc_create_reg (feature, "vr1", 72, 1, NULL, 128, "vec128"); diff --git a/gdb/features/rs6000/powerpc-vsx64l.c b/gdb/features/rs6000/powerpc-vsx64l.c index 5f12650..d34bd81 100644 --- a/gdb/features/rs6000/powerpc-vsx64l.c +++ b/gdb/features/rs6000/powerpc-vsx64l.c @@ -94,31 +94,32 @@ initialize_tdesc_powerpc_vsx64l (void) tdesc_create_reg (feature, "trap", 72, 1, NULL, 64, "int"); feature = tdesc_create_feature (result, "org.gnu.gdb.power.altivec"); - struct tdesc_type *field_type; - field_type = tdesc_named_type (feature, "ieee_single"); - tdesc_create_vector (feature, "v4f", field_type, 4); + tdesc_type *element_type; + element_type = tdesc_named_type (feature, "ieee_single"); + tdesc_create_vector (feature, "v4f", element_type, 4); - field_type = tdesc_named_type (feature, "int32"); - tdesc_create_vector (feature, "v4i32", field_type, 4); + element_type = tdesc_named_type (feature, "int32"); + tdesc_create_vector (feature, "v4i32", element_type, 4); - field_type = tdesc_named_type (feature, "int16"); - tdesc_create_vector (feature, "v8i16", field_type, 8); + element_type = tdesc_named_type (feature, "int16"); + tdesc_create_vector (feature, "v8i16", element_type, 8); - field_type = tdesc_named_type (feature, "int8"); - tdesc_create_vector (feature, "v16i8", field_type, 16); + element_type = tdesc_named_type (feature, "int8"); + tdesc_create_vector (feature, "v16i8", element_type, 16); - struct tdesc_type *type; - type = tdesc_create_union (feature, "vec128"); + tdesc_type_with_fields *type_with_fields; + tdesc_type *field_type; + type_with_fields = tdesc_create_union (feature, "vec128"); field_type = tdesc_named_type (feature, "uint128"); - tdesc_add_field (type, "uint128", field_type); + tdesc_add_field (type_with_fields, "uint128", field_type); field_type = tdesc_named_type (feature, "v4f"); - tdesc_add_field (type, "v4_float", field_type); + tdesc_add_field (type_with_fields, "v4_float", field_type); field_type = tdesc_named_type (feature, "v4i32"); - tdesc_add_field (type, "v4_int32", field_type); + tdesc_add_field (type_with_fields, "v4_int32", field_type); field_type = tdesc_named_type (feature, "v8i16"); - tdesc_add_field (type, "v8_int16", field_type); + tdesc_add_field (type_with_fields, "v8_int16", field_type); field_type = tdesc_named_type (feature, "v16i8"); - tdesc_add_field (type, "v16_int8", field_type); + tdesc_add_field (type_with_fields, "v16_int8", field_type); tdesc_create_reg (feature, "vr0", 73, 1, NULL, 128, "vec128"); tdesc_create_reg (feature, "vr1", 74, 1, NULL, 128, "vec128"); diff --git a/gdb/features/s390-gs-linux64.c b/gdb/features/s390-gs-linux64.c index 39e7043..126835b 100644 --- a/gdb/features/s390-gs-linux64.c +++ b/gdb/features/s390-gs-linux64.c @@ -115,41 +115,42 @@ initialize_tdesc_s390_gs_linux64 (void) tdesc_create_reg (feature, "tr15", 89, 1, "tdb", 64, "uint64"); feature = tdesc_create_feature (result, "org.gnu.gdb.s390.vx"); - struct tdesc_type *field_type; - field_type = tdesc_named_type (feature, "ieee_single"); - tdesc_create_vector (feature, "v4f", field_type, 4); + tdesc_type *element_type; + element_type = tdesc_named_type (feature, "ieee_single"); + tdesc_create_vector (feature, "v4f", element_type, 4); - field_type = tdesc_named_type (feature, "ieee_double"); - tdesc_create_vector (feature, "v2d", field_type, 2); + element_type = tdesc_named_type (feature, "ieee_double"); + tdesc_create_vector (feature, "v2d", element_type, 2); - field_type = tdesc_named_type (feature, "int8"); - tdesc_create_vector (feature, "v16i8", field_type, 16); + element_type = tdesc_named_type (feature, "int8"); + tdesc_create_vector (feature, "v16i8", element_type, 16); - field_type = tdesc_named_type (feature, "int16"); - tdesc_create_vector (feature, "v8i16", field_type, 8); + element_type = tdesc_named_type (feature, "int16"); + tdesc_create_vector (feature, "v8i16", element_type, 8); - field_type = tdesc_named_type (feature, "int32"); - tdesc_create_vector (feature, "v4i32", field_type, 4); + element_type = tdesc_named_type (feature, "int32"); + tdesc_create_vector (feature, "v4i32", element_type, 4); - field_type = tdesc_named_type (feature, "int64"); - tdesc_create_vector (feature, "v2i64", field_type, 2); + element_type = tdesc_named_type (feature, "int64"); + tdesc_create_vector (feature, "v2i64", element_type, 2); - struct tdesc_type *type; - type = tdesc_create_union (feature, "vec128"); + tdesc_type_with_fields *type_with_fields; + tdesc_type *field_type; + type_with_fields = tdesc_create_union (feature, "vec128"); field_type = tdesc_named_type (feature, "v4f"); - tdesc_add_field (type, "v4_float", field_type); + tdesc_add_field (type_with_fields, "v4_float", field_type); field_type = tdesc_named_type (feature, "v2d"); - tdesc_add_field (type, "v2_double", field_type); + tdesc_add_field (type_with_fields, "v2_double", field_type); field_type = tdesc_named_type (feature, "v16i8"); - tdesc_add_field (type, "v16_int8", field_type); + tdesc_add_field (type_with_fields, "v16_int8", field_type); field_type = tdesc_named_type (feature, "v8i16"); - tdesc_add_field (type, "v8_int16", field_type); + tdesc_add_field (type_with_fields, "v8_int16", field_type); field_type = tdesc_named_type (feature, "v4i32"); - tdesc_add_field (type, "v4_int32", field_type); + tdesc_add_field (type_with_fields, "v4_int32", field_type); field_type = tdesc_named_type (feature, "v2i64"); - tdesc_add_field (type, "v2_int64", field_type); + tdesc_add_field (type_with_fields, "v2_int64", field_type); field_type = tdesc_named_type (feature, "uint128"); - tdesc_add_field (type, "uint128", field_type); + tdesc_add_field (type_with_fields, "uint128", field_type); tdesc_create_reg (feature, "v0l", 90, 1, NULL, 64, "uint64"); tdesc_create_reg (feature, "v1l", 91, 1, NULL, 64, "uint64"); diff --git a/gdb/features/s390-tevx-linux64.c b/gdb/features/s390-tevx-linux64.c index d9b18d3..a9ee9e1 100644 --- a/gdb/features/s390-tevx-linux64.c +++ b/gdb/features/s390-tevx-linux64.c @@ -115,41 +115,42 @@ initialize_tdesc_s390_tevx_linux64 (void) tdesc_create_reg (feature, "tr15", 89, 1, "tdb", 64, "uint64"); feature = tdesc_create_feature (result, "org.gnu.gdb.s390.vx"); - struct tdesc_type *field_type; - field_type = tdesc_named_type (feature, "ieee_single"); - tdesc_create_vector (feature, "v4f", field_type, 4); + tdesc_type *element_type; + element_type = tdesc_named_type (feature, "ieee_single"); + tdesc_create_vector (feature, "v4f", element_type, 4); - field_type = tdesc_named_type (feature, "ieee_double"); - tdesc_create_vector (feature, "v2d", field_type, 2); + element_type = tdesc_named_type (feature, "ieee_double"); + tdesc_create_vector (feature, "v2d", element_type, 2); - field_type = tdesc_named_type (feature, "int8"); - tdesc_create_vector (feature, "v16i8", field_type, 16); + element_type = tdesc_named_type (feature, "int8"); + tdesc_create_vector (feature, "v16i8", element_type, 16); - field_type = tdesc_named_type (feature, "int16"); - tdesc_create_vector (feature, "v8i16", field_type, 8); + element_type = tdesc_named_type (feature, "int16"); + tdesc_create_vector (feature, "v8i16", element_type, 8); - field_type = tdesc_named_type (feature, "int32"); - tdesc_create_vector (feature, "v4i32", field_type, 4); + element_type = tdesc_named_type (feature, "int32"); + tdesc_create_vector (feature, "v4i32", element_type, 4); - field_type = tdesc_named_type (feature, "int64"); - tdesc_create_vector (feature, "v2i64", field_type, 2); + element_type = tdesc_named_type (feature, "int64"); + tdesc_create_vector (feature, "v2i64", element_type, 2); - struct tdesc_type *type; - type = tdesc_create_union (feature, "vec128"); + tdesc_type_with_fields *type_with_fields; + tdesc_type *field_type; + type_with_fields = tdesc_create_union (feature, "vec128"); field_type = tdesc_named_type (feature, "v4f"); - tdesc_add_field (type, "v4_float", field_type); + tdesc_add_field (type_with_fields, "v4_float", field_type); field_type = tdesc_named_type (feature, "v2d"); - tdesc_add_field (type, "v2_double", field_type); + tdesc_add_field (type_with_fields, "v2_double", field_type); field_type = tdesc_named_type (feature, "v16i8"); - tdesc_add_field (type, "v16_int8", field_type); + tdesc_add_field (type_with_fields, "v16_int8", field_type); field_type = tdesc_named_type (feature, "v8i16"); - tdesc_add_field (type, "v8_int16", field_type); + tdesc_add_field (type_with_fields, "v8_int16", field_type); field_type = tdesc_named_type (feature, "v4i32"); - tdesc_add_field (type, "v4_int32", field_type); + tdesc_add_field (type_with_fields, "v4_int32", field_type); field_type = tdesc_named_type (feature, "v2i64"); - tdesc_add_field (type, "v2_int64", field_type); + tdesc_add_field (type_with_fields, "v2_int64", field_type); field_type = tdesc_named_type (feature, "uint128"); - tdesc_add_field (type, "uint128", field_type); + tdesc_add_field (type_with_fields, "uint128", field_type); tdesc_create_reg (feature, "v0l", 90, 1, NULL, 64, "uint64"); tdesc_create_reg (feature, "v1l", 91, 1, NULL, 64, "uint64"); diff --git a/gdb/features/s390-vx-linux64.c b/gdb/features/s390-vx-linux64.c index b2138dd..b6c5dda 100644 --- a/gdb/features/s390-vx-linux64.c +++ b/gdb/features/s390-vx-linux64.c @@ -93,41 +93,42 @@ initialize_tdesc_s390_vx_linux64 (void) tdesc_create_reg (feature, "system_call", 69, 1, "system", 32, "uint32"); feature = tdesc_create_feature (result, "org.gnu.gdb.s390.vx"); - struct tdesc_type *field_type; - field_type = tdesc_named_type (feature, "ieee_single"); - tdesc_create_vector (feature, "v4f", field_type, 4); + tdesc_type *element_type; + element_type = tdesc_named_type (feature, "ieee_single"); + tdesc_create_vector (feature, "v4f", element_type, 4); - field_type = tdesc_named_type (feature, "ieee_double"); - tdesc_create_vector (feature, "v2d", field_type, 2); + element_type = tdesc_named_type (feature, "ieee_double"); + tdesc_create_vector (feature, "v2d", element_type, 2); - field_type = tdesc_named_type (feature, "int8"); - tdesc_create_vector (feature, "v16i8", field_type, 16); + element_type = tdesc_named_type (feature, "int8"); + tdesc_create_vector (feature, "v16i8", element_type, 16); - field_type = tdesc_named_type (feature, "int16"); - tdesc_create_vector (feature, "v8i16", field_type, 8); + element_type = tdesc_named_type (feature, "int16"); + tdesc_create_vector (feature, "v8i16", element_type, 8); - field_type = tdesc_named_type (feature, "int32"); - tdesc_create_vector (feature, "v4i32", field_type, 4); + element_type = tdesc_named_type (feature, "int32"); + tdesc_create_vector (feature, "v4i32", element_type, 4); - field_type = tdesc_named_type (feature, "int64"); - tdesc_create_vector (feature, "v2i64", field_type, 2); + element_type = tdesc_named_type (feature, "int64"); + tdesc_create_vector (feature, "v2i64", element_type, 2); - struct tdesc_type *type; - type = tdesc_create_union (feature, "vec128"); + tdesc_type_with_fields *type_with_fields; + tdesc_type *field_type; + type_with_fields = tdesc_create_union (feature, "vec128"); field_type = tdesc_named_type (feature, "v4f"); - tdesc_add_field (type, "v4_float", field_type); + tdesc_add_field (type_with_fields, "v4_float", field_type); field_type = tdesc_named_type (feature, "v2d"); - tdesc_add_field (type, "v2_double", field_type); + tdesc_add_field (type_with_fields, "v2_double", field_type); field_type = tdesc_named_type (feature, "v16i8"); - tdesc_add_field (type, "v16_int8", field_type); + tdesc_add_field (type_with_fields, "v16_int8", field_type); field_type = tdesc_named_type (feature, "v8i16"); - tdesc_add_field (type, "v8_int16", field_type); + tdesc_add_field (type_with_fields, "v8_int16", field_type); field_type = tdesc_named_type (feature, "v4i32"); - tdesc_add_field (type, "v4_int32", field_type); + tdesc_add_field (type_with_fields, "v4_int32", field_type); field_type = tdesc_named_type (feature, "v2i64"); - tdesc_add_field (type, "v2_int64", field_type); + tdesc_add_field (type_with_fields, "v2_int64", field_type); field_type = tdesc_named_type (feature, "uint128"); - tdesc_add_field (type, "uint128", field_type); + tdesc_add_field (type_with_fields, "uint128", field_type); tdesc_create_reg (feature, "v0l", 70, 1, NULL, 64, "uint64"); tdesc_create_reg (feature, "v1l", 71, 1, NULL, 64, "uint64"); diff --git a/gdb/features/s390x-gs-linux64.c b/gdb/features/s390x-gs-linux64.c index 652e6cf..5ab3e3d 100644 --- a/gdb/features/s390x-gs-linux64.c +++ b/gdb/features/s390x-gs-linux64.c @@ -99,41 +99,42 @@ initialize_tdesc_s390x_gs_linux64 (void) tdesc_create_reg (feature, "tr15", 73, 1, "tdb", 64, "uint64"); feature = tdesc_create_feature (result, "org.gnu.gdb.s390.vx"); - struct tdesc_type *field_type; - field_type = tdesc_named_type (feature, "ieee_single"); - tdesc_create_vector (feature, "v4f", field_type, 4); + tdesc_type *element_type; + element_type = tdesc_named_type (feature, "ieee_single"); + tdesc_create_vector (feature, "v4f", element_type, 4); - field_type = tdesc_named_type (feature, "ieee_double"); - tdesc_create_vector (feature, "v2d", field_type, 2); + element_type = tdesc_named_type (feature, "ieee_double"); + tdesc_create_vector (feature, "v2d", element_type, 2); - field_type = tdesc_named_type (feature, "int8"); - tdesc_create_vector (feature, "v16i8", field_type, 16); + element_type = tdesc_named_type (feature, "int8"); + tdesc_create_vector (feature, "v16i8", element_type, 16); - field_type = tdesc_named_type (feature, "int16"); - tdesc_create_vector (feature, "v8i16", field_type, 8); + element_type = tdesc_named_type (feature, "int16"); + tdesc_create_vector (feature, "v8i16", element_type, 8); - field_type = tdesc_named_type (feature, "int32"); - tdesc_create_vector (feature, "v4i32", field_type, 4); + element_type = tdesc_named_type (feature, "int32"); + tdesc_create_vector (feature, "v4i32", element_type, 4); - field_type = tdesc_named_type (feature, "int64"); - tdesc_create_vector (feature, "v2i64", field_type, 2); + element_type = tdesc_named_type (feature, "int64"); + tdesc_create_vector (feature, "v2i64", element_type, 2); - struct tdesc_type *type; - type = tdesc_create_union (feature, "vec128"); + tdesc_type_with_fields *type_with_fields; + tdesc_type *field_type; + type_with_fields = tdesc_create_union (feature, "vec128"); field_type = tdesc_named_type (feature, "v4f"); - tdesc_add_field (type, "v4_float", field_type); + tdesc_add_field (type_with_fields, "v4_float", field_type); field_type = tdesc_named_type (feature, "v2d"); - tdesc_add_field (type, "v2_double", field_type); + tdesc_add_field (type_with_fields, "v2_double", field_type); field_type = tdesc_named_type (feature, "v16i8"); - tdesc_add_field (type, "v16_int8", field_type); + tdesc_add_field (type_with_fields, "v16_int8", field_type); field_type = tdesc_named_type (feature, "v8i16"); - tdesc_add_field (type, "v8_int16", field_type); + tdesc_add_field (type_with_fields, "v8_int16", field_type); field_type = tdesc_named_type (feature, "v4i32"); - tdesc_add_field (type, "v4_int32", field_type); + tdesc_add_field (type_with_fields, "v4_int32", field_type); field_type = tdesc_named_type (feature, "v2i64"); - tdesc_add_field (type, "v2_int64", field_type); + tdesc_add_field (type_with_fields, "v2_int64", field_type); field_type = tdesc_named_type (feature, "uint128"); - tdesc_add_field (type, "uint128", field_type); + tdesc_add_field (type_with_fields, "uint128", field_type); tdesc_create_reg (feature, "v0l", 74, 1, NULL, 64, "uint64"); tdesc_create_reg (feature, "v1l", 75, 1, NULL, 64, "uint64"); diff --git a/gdb/features/s390x-tevx-linux64.c b/gdb/features/s390x-tevx-linux64.c index 02afd3a..e5ecedf 100644 --- a/gdb/features/s390x-tevx-linux64.c +++ b/gdb/features/s390x-tevx-linux64.c @@ -99,41 +99,42 @@ initialize_tdesc_s390x_tevx_linux64 (void) tdesc_create_reg (feature, "tr15", 73, 1, "tdb", 64, "uint64"); feature = tdesc_create_feature (result, "org.gnu.gdb.s390.vx"); - struct tdesc_type *field_type; - field_type = tdesc_named_type (feature, "ieee_single"); - tdesc_create_vector (feature, "v4f", field_type, 4); + tdesc_type *element_type; + element_type = tdesc_named_type (feature, "ieee_single"); + tdesc_create_vector (feature, "v4f", element_type, 4); - field_type = tdesc_named_type (feature, "ieee_double"); - tdesc_create_vector (feature, "v2d", field_type, 2); + element_type = tdesc_named_type (feature, "ieee_double"); + tdesc_create_vector (feature, "v2d", element_type, 2); - field_type = tdesc_named_type (feature, "int8"); - tdesc_create_vector (feature, "v16i8", field_type, 16); + element_type = tdesc_named_type (feature, "int8"); + tdesc_create_vector (feature, "v16i8", element_type, 16); - field_type = tdesc_named_type (feature, "int16"); - tdesc_create_vector (feature, "v8i16", field_type, 8); + element_type = tdesc_named_type (feature, "int16"); + tdesc_create_vector (feature, "v8i16", element_type, 8); - field_type = tdesc_named_type (feature, "int32"); - tdesc_create_vector (feature, "v4i32", field_type, 4); + element_type = tdesc_named_type (feature, "int32"); + tdesc_create_vector (feature, "v4i32", element_type, 4); - field_type = tdesc_named_type (feature, "int64"); - tdesc_create_vector (feature, "v2i64", field_type, 2); + element_type = tdesc_named_type (feature, "int64"); + tdesc_create_vector (feature, "v2i64", element_type, 2); - struct tdesc_type *type; - type = tdesc_create_union (feature, "vec128"); + tdesc_type_with_fields *type_with_fields; + tdesc_type *field_type; + type_with_fields = tdesc_create_union (feature, "vec128"); field_type = tdesc_named_type (feature, "v4f"); - tdesc_add_field (type, "v4_float", field_type); + tdesc_add_field (type_with_fields, "v4_float", field_type); field_type = tdesc_named_type (feature, "v2d"); - tdesc_add_field (type, "v2_double", field_type); + tdesc_add_field (type_with_fields, "v2_double", field_type); field_type = tdesc_named_type (feature, "v16i8"); - tdesc_add_field (type, "v16_int8", field_type); + tdesc_add_field (type_with_fields, "v16_int8", field_type); field_type = tdesc_named_type (feature, "v8i16"); - tdesc_add_field (type, "v8_int16", field_type); + tdesc_add_field (type_with_fields, "v8_int16", field_type); field_type = tdesc_named_type (feature, "v4i32"); - tdesc_add_field (type, "v4_int32", field_type); + tdesc_add_field (type_with_fields, "v4_int32", field_type); field_type = tdesc_named_type (feature, "v2i64"); - tdesc_add_field (type, "v2_int64", field_type); + tdesc_add_field (type_with_fields, "v2_int64", field_type); field_type = tdesc_named_type (feature, "uint128"); - tdesc_add_field (type, "uint128", field_type); + tdesc_add_field (type_with_fields, "uint128", field_type); tdesc_create_reg (feature, "v0l", 74, 1, NULL, 64, "uint64"); tdesc_create_reg (feature, "v1l", 75, 1, NULL, 64, "uint64"); diff --git a/gdb/features/s390x-vx-linux64.c b/gdb/features/s390x-vx-linux64.c index 120db53..1f24349 100644 --- a/gdb/features/s390x-vx-linux64.c +++ b/gdb/features/s390x-vx-linux64.c @@ -77,41 +77,42 @@ initialize_tdesc_s390x_vx_linux64 (void) tdesc_create_reg (feature, "system_call", 53, 1, "system", 32, "uint32"); feature = tdesc_create_feature (result, "org.gnu.gdb.s390.vx"); - struct tdesc_type *field_type; - field_type = tdesc_named_type (feature, "ieee_single"); - tdesc_create_vector (feature, "v4f", field_type, 4); + tdesc_type *element_type; + element_type = tdesc_named_type (feature, "ieee_single"); + tdesc_create_vector (feature, "v4f", element_type, 4); - field_type = tdesc_named_type (feature, "ieee_double"); - tdesc_create_vector (feature, "v2d", field_type, 2); + element_type = tdesc_named_type (feature, "ieee_double"); + tdesc_create_vector (feature, "v2d", element_type, 2); - field_type = tdesc_named_type (feature, "int8"); - tdesc_create_vector (feature, "v16i8", field_type, 16); + element_type = tdesc_named_type (feature, "int8"); + tdesc_create_vector (feature, "v16i8", element_type, 16); - field_type = tdesc_named_type (feature, "int16"); - tdesc_create_vector (feature, "v8i16", field_type, 8); + element_type = tdesc_named_type (feature, "int16"); + tdesc_create_vector (feature, "v8i16", element_type, 8); - field_type = tdesc_named_type (feature, "int32"); - tdesc_create_vector (feature, "v4i32", field_type, 4); + element_type = tdesc_named_type (feature, "int32"); + tdesc_create_vector (feature, "v4i32", element_type, 4); - field_type = tdesc_named_type (feature, "int64"); - tdesc_create_vector (feature, "v2i64", field_type, 2); + element_type = tdesc_named_type (feature, "int64"); + tdesc_create_vector (feature, "v2i64", element_type, 2); - struct tdesc_type *type; - type = tdesc_create_union (feature, "vec128"); + tdesc_type_with_fields *type_with_fields; + tdesc_type *field_type; + type_with_fields = tdesc_create_union (feature, "vec128"); field_type = tdesc_named_type (feature, "v4f"); - tdesc_add_field (type, "v4_float", field_type); + tdesc_add_field (type_with_fields, "v4_float", field_type); field_type = tdesc_named_type (feature, "v2d"); - tdesc_add_field (type, "v2_double", field_type); + tdesc_add_field (type_with_fields, "v2_double", field_type); field_type = tdesc_named_type (feature, "v16i8"); - tdesc_add_field (type, "v16_int8", field_type); + tdesc_add_field (type_with_fields, "v16_int8", field_type); field_type = tdesc_named_type (feature, "v8i16"); - tdesc_add_field (type, "v8_int16", field_type); + tdesc_add_field (type_with_fields, "v8_int16", field_type); field_type = tdesc_named_type (feature, "v4i32"); - tdesc_add_field (type, "v4_int32", field_type); + tdesc_add_field (type_with_fields, "v4_int32", field_type); field_type = tdesc_named_type (feature, "v2i64"); - tdesc_add_field (type, "v2_int64", field_type); + tdesc_add_field (type_with_fields, "v2_int64", field_type); field_type = tdesc_named_type (feature, "uint128"); - tdesc_add_field (type, "uint128", field_type); + tdesc_add_field (type_with_fields, "uint128", field_type); tdesc_create_reg (feature, "v0l", 54, 1, NULL, 64, "uint64"); tdesc_create_reg (feature, "v1l", 55, 1, NULL, 64, "uint64"); diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index 04c6f23..171bc53 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,3 +1,11 @@ +2017-12-05 Simon Marchi <simon.marchi@polymtl.ca> + + * tdesc.c (struct tdesc_type): Change return type. + (tdesc_add_flag): Change parameter type. + (tdesc_add_bitfield): Likewise. + (tdesc_add_field): Likewise. + (tdesc_set_struct_size): Likewise. + 2017-12-05 Simon Marchi <simon.marchi@ericsson.com> * regcache.c (registers_to_string): Remove unused variable. diff --git a/gdb/gdbserver/tdesc.c b/gdb/gdbserver/tdesc.c index e2c4288..5ea2341 100644 --- a/gdb/gdbserver/tdesc.c +++ b/gdb/gdbserver/tdesc.c @@ -146,7 +146,7 @@ tdesc_create_feature (struct target_desc *tdesc, const char *name, /* See arch/tdesc.h. */ -struct tdesc_type * +tdesc_type_with_fields * tdesc_create_flags (struct tdesc_feature *feature, const char *name, int size) { @@ -156,7 +156,7 @@ tdesc_create_flags (struct tdesc_feature *feature, const char *name, /* See arch/tdesc.h. */ void -tdesc_add_flag (struct tdesc_type *type, int start, +tdesc_add_flag (tdesc_type_with_fields *type, int start, const char *flag_name) {} @@ -170,7 +170,7 @@ tdesc_named_type (const struct tdesc_feature *feature, const char *id) /* See arch/tdesc.h. */ -struct tdesc_type * +tdesc_type_with_fields * tdesc_create_union (struct tdesc_feature *feature, const char *id) { return NULL; @@ -178,7 +178,7 @@ tdesc_create_union (struct tdesc_feature *feature, const char *id) /* See arch/tdesc.h. */ -struct tdesc_type * +tdesc_type_with_fields * tdesc_create_struct (struct tdesc_feature *feature, const char *id) { return NULL; @@ -222,20 +222,20 @@ tdesc_create_vector (struct tdesc_feature *feature, const char *name, } void -tdesc_add_bitfield (struct tdesc_type *type, const char *field_name, +tdesc_add_bitfield (tdesc_type_with_fields *type, const char *field_name, int start, int end) {} /* See arch/tdesc.h. */ void -tdesc_add_field (struct tdesc_type *type, const char *field_name, +tdesc_add_field (tdesc_type_with_fields *type, const char *field_name, struct tdesc_type *field_type) {} /* See arch/tdesc.h. */ void -tdesc_set_struct_size (struct tdesc_type *type, int size) +tdesc_set_struct_size (tdesc_type_with_fields *type, int size) { } diff --git a/gdb/target-descriptions.c b/gdb/target-descriptions.c index 0f47fee..12d72fa 100644 --- a/gdb/target-descriptions.c +++ b/gdb/target-descriptions.c @@ -49,7 +49,10 @@ public: virtual void visit_pre (const tdesc_feature *e) = 0; virtual void visit_post (const tdesc_feature *e) = 0; - virtual void visit (const tdesc_type *e) = 0; + virtual void visit (const tdesc_type_builtin *e) = 0; + virtual void visit (const tdesc_type_vector *e) = 0; + virtual void visit (const tdesc_type_with_fields *e) = 0; + virtual void visit (const tdesc_reg *e) = 0; }; @@ -200,82 +203,313 @@ struct tdesc_type : tdesc_element { tdesc_type (const std::string &name_, enum tdesc_type_kind kind_) : name (name_), kind (kind_) + {} + + virtual ~tdesc_type () = default; + + DISABLE_COPY_AND_ASSIGN (tdesc_type); + + /* The name of this type. */ + std::string name; + + /* Identify the kind of this type. */ + enum tdesc_type_kind kind; + + bool operator== (const tdesc_type &other) const { - memset (&u, 0, sizeof (u)); + return name == other.name && kind == other.kind; + } - switch (kind) - { - case TDESC_TYPE_STRUCT: - case TDESC_TYPE_UNION: - case TDESC_TYPE_FLAGS: - case TDESC_TYPE_ENUM: - u.u.fields = new std::vector<tdesc_type_field> (); - break; + bool operator!= (const tdesc_type &other) const + { + return !(*this == other); + } - default: - break; - } + /* Construct, if necessary, and return the GDB type implementing this + target type for architecture GDBARCH. */ + + virtual type *make_gdb_type (struct gdbarch *gdbarch) const = 0; +}; + +typedef std::unique_ptr<tdesc_type> tdesc_type_up; + +struct tdesc_type_builtin : tdesc_type +{ + tdesc_type_builtin (const std::string &name, enum tdesc_type_kind kind) + : tdesc_type (name, kind) + {} + + void accept (tdesc_element_visitor &v) const override + { + v.visit (this); } - virtual ~tdesc_type () + type *make_gdb_type (struct gdbarch *gdbarch) const override { - switch (kind) + switch (this->kind) { - case TDESC_TYPE_STRUCT: - case TDESC_TYPE_UNION: - case TDESC_TYPE_FLAGS: - case TDESC_TYPE_ENUM: - delete u.u.fields; - break; + /* Predefined types. */ + case TDESC_TYPE_BOOL: + return builtin_type (gdbarch)->builtin_bool; - default: - break; + case TDESC_TYPE_INT8: + return builtin_type (gdbarch)->builtin_int8; + + case TDESC_TYPE_INT16: + return builtin_type (gdbarch)->builtin_int16; + + case TDESC_TYPE_INT32: + return builtin_type (gdbarch)->builtin_int32; + + case TDESC_TYPE_INT64: + return builtin_type (gdbarch)->builtin_int64; + + case TDESC_TYPE_INT128: + return builtin_type (gdbarch)->builtin_int128; + + case TDESC_TYPE_UINT8: + return builtin_type (gdbarch)->builtin_uint8; + + case TDESC_TYPE_UINT16: + return builtin_type (gdbarch)->builtin_uint16; + + case TDESC_TYPE_UINT32: + return builtin_type (gdbarch)->builtin_uint32; + + case TDESC_TYPE_UINT64: + return builtin_type (gdbarch)->builtin_uint64; + + case TDESC_TYPE_UINT128: + return builtin_type (gdbarch)->builtin_uint128; + + case TDESC_TYPE_CODE_PTR: + return builtin_type (gdbarch)->builtin_func_ptr; + + case TDESC_TYPE_DATA_PTR: + return builtin_type (gdbarch)->builtin_data_ptr; + } + + type *gdb_type = tdesc_find_type (gdbarch, this->name.c_str ()); + if (gdb_type != NULL) + return gdb_type; + + switch (this->kind) + { + case TDESC_TYPE_IEEE_SINGLE: + return arch_float_type (gdbarch, -1, "builtin_type_ieee_single", + floatformats_ieee_single); + + case TDESC_TYPE_IEEE_DOUBLE: + return arch_float_type (gdbarch, -1, "builtin_type_ieee_double", + floatformats_ieee_double); + + case TDESC_TYPE_ARM_FPA_EXT: + return arch_float_type (gdbarch, -1, "builtin_type_arm_ext", + floatformats_arm_ext); + + case TDESC_TYPE_I387_EXT: + return arch_float_type (gdbarch, -1, "builtin_type_i387_ext", + floatformats_i387_ext); } + + internal_error (__FILE__, __LINE__, + "Type \"%s\" has an unknown kind %d", + this->name.c_str (), this->kind); + + return NULL; } +}; - DISABLE_COPY_AND_ASSIGN (tdesc_type); +/* tdesc_type for vector types. */ - /* The name of this type. */ - std::string name; +struct tdesc_type_vector : tdesc_type +{ + tdesc_type_vector (const std::string &name, tdesc_type *element_type_, int count_) + : tdesc_type (name, TDESC_TYPE_VECTOR), + element_type (element_type_), count (count_) + {} - /* Identify the kind of this type. */ - enum tdesc_type_kind kind; + void accept (tdesc_element_visitor &v) const override + { + v.visit (this); + } - /* Kind-specific data. */ - union + type *make_gdb_type (struct gdbarch *gdbarch) const override { - /* Vector type. */ - struct - { - struct tdesc_type *type; - int count; - } v; + type *vector_gdb_type = tdesc_find_type (gdbarch, this->name.c_str ()); + if (vector_gdb_type != NULL) + return vector_gdb_type; - /* Struct, union, flags, or enum type. */ - struct - { - std::vector<tdesc_type_field> *fields; - int size; - } u; - } u; + type *element_gdb_type = this->element_type->make_gdb_type (gdbarch); + vector_gdb_type = init_vector_type (element_gdb_type, this->count); + TYPE_NAME (vector_gdb_type) = xstrdup (this->name.c_str ()); + + return vector_gdb_type; + } + + struct tdesc_type *element_type; + int count; +}; + +/* tdesc_type for struct, union, flags, and enum types. */ + +struct tdesc_type_with_fields : tdesc_type +{ + tdesc_type_with_fields (const std::string &name, tdesc_type_kind kind, + int size_ = 0) + : tdesc_type (name, kind), size (size_) + {} void accept (tdesc_element_visitor &v) const override { v.visit (this); } - bool operator== (const tdesc_type &other) const + type *make_gdb_type_struct (struct gdbarch *gdbarch) const { - return name == other.name && kind == other.kind; + type *struct_gdb_type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT); + TYPE_NAME (struct_gdb_type) = xstrdup (this->name.c_str ()); + TYPE_TAG_NAME (struct_gdb_type) = TYPE_NAME (struct_gdb_type); + + for (const tdesc_type_field &f : this->fields) + { + if (f.start != -1 && f.end != -1) + { + /* Bitfield. */ + struct field *fld; + struct type *field_gdb_type; + int bitsize, total_size; + + /* This invariant should be preserved while creating types. */ + gdb_assert (this->size != 0); + if (f.type != NULL) + field_gdb_type = f.type->make_gdb_type (gdbarch); + else if (this->size > 4) + field_gdb_type = builtin_type (gdbarch)->builtin_uint64; + else + field_gdb_type = builtin_type (gdbarch)->builtin_uint32; + + fld = append_composite_type_field_raw + (struct_gdb_type, xstrdup (f.name.c_str ()), field_gdb_type); + + /* For little-endian, BITPOS counts from the LSB of + the structure and marks the LSB of the field. For + big-endian, BITPOS counts from the MSB of the + structure and marks the MSB of the field. Either + way, it is the number of bits to the "left" of the + field. To calculate this in big-endian, we need + the total size of the structure. */ + bitsize = f.end - f.start + 1; + total_size = this->size * TARGET_CHAR_BIT; + if (gdbarch_bits_big_endian (gdbarch)) + SET_FIELD_BITPOS (fld[0], total_size - f.start - bitsize); + else + SET_FIELD_BITPOS (fld[0], f.start); + FIELD_BITSIZE (fld[0]) = bitsize; + } + else + { + gdb_assert (f.start == -1 && f.end == -1); + type *field_gdb_type = f.type->make_gdb_type (gdbarch); + append_composite_type_field (struct_gdb_type, + xstrdup (f.name.c_str ()), + field_gdb_type); + } + } + + if (this->size != 0) + TYPE_LENGTH (struct_gdb_type) = this->size; + + return struct_gdb_type; } - bool operator!= (const tdesc_type &other) const + type *make_gdb_type_union (struct gdbarch *gdbarch) const { - return !(*this == other); + type *union_gdb_type = arch_composite_type (gdbarch, NULL, TYPE_CODE_UNION); + TYPE_NAME (union_gdb_type) = xstrdup (this->name.c_str ()); + + for (const tdesc_type_field &f : this->fields) + { + type* field_gdb_type = f.type->make_gdb_type (gdbarch); + append_composite_type_field (union_gdb_type, xstrdup (f.name.c_str ()), + field_gdb_type); + + /* If any of the children of a union are vectors, flag the + union as a vector also. This allows e.g. a union of two + vector types to show up automatically in "info vector". */ + if (TYPE_VECTOR (field_gdb_type)) + TYPE_VECTOR (union_gdb_type) = 1; + } + + return union_gdb_type; } -}; -typedef std::unique_ptr<tdesc_type> tdesc_type_up; + type *make_gdb_type_flags (struct gdbarch *gdbarch) const + { + type *flags_gdb_type = arch_flags_type (gdbarch, this->name.c_str (), + this->size * TARGET_CHAR_BIT); + + for (const tdesc_type_field &f : this->fields) + { + int bitsize = f.end - f.start + 1; + + gdb_assert (f.type != NULL); + type *field_gdb_type = f.type->make_gdb_type (gdbarch); + append_flags_type_field (flags_gdb_type, f.start, bitsize, + field_gdb_type, f.name.c_str ()); + } + + return flags_gdb_type; + } + + type *make_gdb_type_enum (struct gdbarch *gdbarch) const + { + type *enum_gdb_type = arch_type (gdbarch, TYPE_CODE_ENUM, + this->size * TARGET_CHAR_BIT, + this->name.c_str ()); + + TYPE_UNSIGNED (enum_gdb_type) = 1; + for (const tdesc_type_field &f : this->fields) + { + struct field *fld + = append_composite_type_field_raw (enum_gdb_type, + xstrdup (f.name.c_str ()), + NULL); + + SET_FIELD_BITPOS (fld[0], f.start); + } + + return enum_gdb_type; + } + + type *make_gdb_type (struct gdbarch *gdbarch) const override + { + type *gdb_type = tdesc_find_type (gdbarch, this->name.c_str ()); + if (gdb_type != NULL) + return gdb_type; + + switch (this->kind) + { + case TDESC_TYPE_STRUCT: + return make_gdb_type_struct (gdbarch); + case TDESC_TYPE_UNION: + return make_gdb_type_union (gdbarch); + case TDESC_TYPE_FLAGS: + return make_gdb_type_flags (gdbarch); + case TDESC_TYPE_ENUM: + return make_gdb_type_enum (gdbarch); + } + + internal_error (__FILE__, __LINE__, + "Type \"%s\" has an unknown kind %d", + this->name.c_str (), this->kind); + + return NULL; + } + + std::vector<tdesc_type_field> fields; + int size; +}; /* A feature from a target description. Each feature is a collection of other elements, e.g. registers and types. */ @@ -725,7 +959,7 @@ tdesc_feature_name (const struct tdesc_feature *feature) } /* Predefined types. */ -static struct tdesc_type tdesc_predefined_types[] = +static tdesc_type_builtin tdesc_predefined_types[] = { { "bool", TDESC_TYPE_BOOL }, { "int8", TDESC_TYPE_INT8 }, @@ -796,218 +1030,6 @@ tdesc_find_type (struct gdbarch *gdbarch, const char *id) return NULL; } -/* Construct, if necessary, and return the GDB type implementing target - type TDESC_TYPE for architecture GDBARCH. */ - -static struct type * -tdesc_gdb_type (struct gdbarch *gdbarch, struct tdesc_type *tdesc_type) -{ - struct type *type; - - switch (tdesc_type->kind) - { - /* Predefined types. */ - case TDESC_TYPE_BOOL: - return builtin_type (gdbarch)->builtin_bool; - - case TDESC_TYPE_INT8: - return builtin_type (gdbarch)->builtin_int8; - - case TDESC_TYPE_INT16: - return builtin_type (gdbarch)->builtin_int16; - - case TDESC_TYPE_INT32: - return builtin_type (gdbarch)->builtin_int32; - - case TDESC_TYPE_INT64: - return builtin_type (gdbarch)->builtin_int64; - - case TDESC_TYPE_INT128: - return builtin_type (gdbarch)->builtin_int128; - - case TDESC_TYPE_UINT8: - return builtin_type (gdbarch)->builtin_uint8; - - case TDESC_TYPE_UINT16: - return builtin_type (gdbarch)->builtin_uint16; - - case TDESC_TYPE_UINT32: - return builtin_type (gdbarch)->builtin_uint32; - - case TDESC_TYPE_UINT64: - return builtin_type (gdbarch)->builtin_uint64; - - case TDESC_TYPE_UINT128: - return builtin_type (gdbarch)->builtin_uint128; - - case TDESC_TYPE_CODE_PTR: - return builtin_type (gdbarch)->builtin_func_ptr; - - case TDESC_TYPE_DATA_PTR: - return builtin_type (gdbarch)->builtin_data_ptr; - - default: - break; - } - - type = tdesc_find_type (gdbarch, tdesc_type->name.c_str ()); - if (type) - return type; - - switch (tdesc_type->kind) - { - case TDESC_TYPE_IEEE_SINGLE: - return arch_float_type (gdbarch, -1, "builtin_type_ieee_single", - floatformats_ieee_single); - - case TDESC_TYPE_IEEE_DOUBLE: - return arch_float_type (gdbarch, -1, "builtin_type_ieee_double", - floatformats_ieee_double); - - case TDESC_TYPE_ARM_FPA_EXT: - return arch_float_type (gdbarch, -1, "builtin_type_arm_ext", - floatformats_arm_ext); - - case TDESC_TYPE_I387_EXT: - return arch_float_type (gdbarch, -1, "builtin_type_i387_ext", - floatformats_i387_ext); - - /* Types defined by a target feature. */ - case TDESC_TYPE_VECTOR: - { - struct type *type, *field_type; - - field_type = tdesc_gdb_type (gdbarch, tdesc_type->u.v.type); - type = init_vector_type (field_type, tdesc_type->u.v.count); - TYPE_NAME (type) = xstrdup (tdesc_type->name.c_str ()); - - return type; - } - - case TDESC_TYPE_STRUCT: - { - struct type *type, *field_type; - - type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT); - TYPE_NAME (type) = xstrdup (tdesc_type->name.c_str ()); - TYPE_TAG_NAME (type) = TYPE_NAME (type); - - for (const tdesc_type_field &f : *tdesc_type->u.u.fields) - { - if (f.start != -1 && f.end != -1) - { - /* Bitfield. */ - struct field *fld; - struct type *field_type; - int bitsize, total_size; - - /* This invariant should be preserved while creating types. */ - gdb_assert (tdesc_type->u.u.size != 0); - if (f.type != NULL) - field_type = tdesc_gdb_type (gdbarch, f.type); - else if (tdesc_type->u.u.size > 4) - field_type = builtin_type (gdbarch)->builtin_uint64; - else - field_type = builtin_type (gdbarch)->builtin_uint32; - - fld = append_composite_type_field_raw - (type, xstrdup (f.name.c_str ()), field_type); - - /* For little-endian, BITPOS counts from the LSB of - the structure and marks the LSB of the field. For - big-endian, BITPOS counts from the MSB of the - structure and marks the MSB of the field. Either - way, it is the number of bits to the "left" of the - field. To calculate this in big-endian, we need - the total size of the structure. */ - bitsize = f.end - f.start + 1; - total_size = tdesc_type->u.u.size * TARGET_CHAR_BIT; - if (gdbarch_bits_big_endian (gdbarch)) - SET_FIELD_BITPOS (fld[0], total_size - f.start - bitsize); - else - SET_FIELD_BITPOS (fld[0], f.start); - FIELD_BITSIZE (fld[0]) = bitsize; - } - else - { - gdb_assert (f.start == -1 && f.end == -1); - field_type = tdesc_gdb_type (gdbarch, f.type); - append_composite_type_field (type, xstrdup (f.name.c_str ()), - field_type); - } - } - - if (tdesc_type->u.u.size != 0) - TYPE_LENGTH (type) = tdesc_type->u.u.size; - return type; - } - - case TDESC_TYPE_UNION: - { - struct type *type, *field_type; - - type = arch_composite_type (gdbarch, NULL, TYPE_CODE_UNION); - TYPE_NAME (type) = xstrdup (tdesc_type->name.c_str ()); - - for (const tdesc_type_field &f : *tdesc_type->u.u.fields) - { - field_type = tdesc_gdb_type (gdbarch, f.type); - append_composite_type_field (type, xstrdup (f.name.c_str ()), - field_type); - - /* If any of the children of a union are vectors, flag the - union as a vector also. This allows e.g. a union of two - vector types to show up automatically in "info vector". */ - if (TYPE_VECTOR (field_type)) - TYPE_VECTOR (type) = 1; - } - return type; - } - - case TDESC_TYPE_FLAGS: - { - type = arch_flags_type (gdbarch, tdesc_type->name.c_str (), - tdesc_type->u.u.size * TARGET_CHAR_BIT); - for (const tdesc_type_field &f : *tdesc_type->u.u.fields) - { - struct type *field_type; - int bitsize = f.end - f.start + 1; - - gdb_assert (f.type != NULL); - field_type = tdesc_gdb_type (gdbarch, f.type); - append_flags_type_field (type, f.start, bitsize, - field_type, f.name.c_str ()); - } - - return type; - } - - case TDESC_TYPE_ENUM: - { - type = arch_type (gdbarch, TYPE_CODE_ENUM, - tdesc_type->u.u.size * TARGET_CHAR_BIT, - tdesc_type->name.c_str ()); - TYPE_UNSIGNED (type) = 1; - for (const tdesc_type_field &f : *tdesc_type->u.u.fields) - { - struct field *fld - = append_composite_type_field_raw (type, - xstrdup (f.name.c_str ()), - NULL); - - SET_FIELD_BITPOS (fld[0], f.start); - } - - return type; - } - } - - internal_error (__FILE__, __LINE__, - "Type \"%s\" has an unknown kind %d", - tdesc_type->name.c_str (), tdesc_type->kind); -} - - /* Support for registers from target descriptions. */ /* Construct the per-gdbarch data. */ @@ -1195,7 +1217,7 @@ tdesc_register_type (struct gdbarch *gdbarch, int regno) { /* First check for a predefined or target defined type. */ if (reg->tdesc_type) - arch_reg->type = tdesc_gdb_type (gdbarch, reg->tdesc_type); + arch_reg->type = reg->tdesc_type->make_gdb_type (gdbarch); /* Next try size-sensitive type shortcuts. */ else if (reg->type == "float") @@ -1455,81 +1477,78 @@ struct tdesc_type * tdesc_create_vector (struct tdesc_feature *feature, const char *name, struct tdesc_type *field_type, int count) { - struct tdesc_type *type = new tdesc_type (name, TDESC_TYPE_VECTOR); - - type->u.v.type = field_type; - type->u.v.count = count; - + tdesc_type_vector *type = new tdesc_type_vector (name, field_type, count); feature->types.emplace_back (type); + return type; } /* See arch/tdesc.h. */ -struct tdesc_type * +tdesc_type_with_fields * tdesc_create_struct (struct tdesc_feature *feature, const char *name) { - struct tdesc_type *type = new tdesc_type (name, TDESC_TYPE_STRUCT); - + tdesc_type_with_fields *type + = new tdesc_type_with_fields (name, TDESC_TYPE_STRUCT); feature->types.emplace_back (type); + return type; } /* See arch/tdesc.h. */ void -tdesc_set_struct_size (struct tdesc_type *type, int size) +tdesc_set_struct_size (tdesc_type_with_fields *type, int size) { gdb_assert (type->kind == TDESC_TYPE_STRUCT); gdb_assert (size > 0); - type->u.u.size = size; + type->size = size; } /* See arch/tdesc.h. */ -struct tdesc_type * +tdesc_type_with_fields * tdesc_create_union (struct tdesc_feature *feature, const char *name) { - struct tdesc_type *type = new tdesc_type (name, TDESC_TYPE_UNION); - + tdesc_type_with_fields *type + = new tdesc_type_with_fields (name, TDESC_TYPE_UNION); feature->types.emplace_back (type); + return type; } /* See arch/tdesc.h. */ -struct tdesc_type * +tdesc_type_with_fields * tdesc_create_flags (struct tdesc_feature *feature, const char *name, int size) { - struct tdesc_type *type = new tdesc_type (name, TDESC_TYPE_FLAGS); - gdb_assert (size > 0); - type->u.u.size = size; - + tdesc_type_with_fields *type + = new tdesc_type_with_fields (name, TDESC_TYPE_FLAGS, size); feature->types.emplace_back (type); + return type; } -struct tdesc_type * +tdesc_type_with_fields * tdesc_create_enum (struct tdesc_feature *feature, const char *name, int size) { - struct tdesc_type *type = new tdesc_type (name, TDESC_TYPE_ENUM); - gdb_assert (size > 0); - type->u.u.size = size; - + tdesc_type_with_fields *type + = new tdesc_type_with_fields (name, TDESC_TYPE_ENUM, size); feature->types.emplace_back (type); + return type; } /* See arch/tdesc.h. */ void -tdesc_add_field (struct tdesc_type *type, const char *field_name, +tdesc_add_field (tdesc_type_with_fields *type, const char *field_name, struct tdesc_type *field_type) { gdb_assert (type->kind == TDESC_TYPE_UNION @@ -1537,31 +1556,31 @@ tdesc_add_field (struct tdesc_type *type, const char *field_name, /* Initialize start and end so we know this is not a bit-field when we print-c-tdesc. */ - type->u.u.fields->emplace_back (field_name, field_type, -1, -1); + type->fields.emplace_back (field_name, field_type, -1, -1); } void -tdesc_add_typed_bitfield (struct tdesc_type *type, const char *field_name, +tdesc_add_typed_bitfield (tdesc_type_with_fields *type, const char *field_name, int start, int end, struct tdesc_type *field_type) { gdb_assert (type->kind == TDESC_TYPE_STRUCT || type->kind == TDESC_TYPE_FLAGS); gdb_assert (start >= 0 && end >= start); - type->u.u.fields->emplace_back (field_name, field_type, start, end); + type->fields.emplace_back (field_name, field_type, start, end); } /* See arch/tdesc.h. */ void -tdesc_add_bitfield (struct tdesc_type *type, const char *field_name, +tdesc_add_bitfield (tdesc_type_with_fields *type, const char *field_name, int start, int end) { struct tdesc_type *field_type; gdb_assert (start >= 0 && end >= start); - if (type->u.u.size > 4) + if (type->size > 4) field_type = tdesc_predefined_type (TDESC_TYPE_UINT64); else field_type = tdesc_predefined_type (TDESC_TYPE_UINT32); @@ -1572,26 +1591,25 @@ tdesc_add_bitfield (struct tdesc_type *type, const char *field_name, /* See arch/tdesc.h. */ void -tdesc_add_flag (struct tdesc_type *type, int start, +tdesc_add_flag (tdesc_type_with_fields *type, int start, const char *flag_name) { gdb_assert (type->kind == TDESC_TYPE_FLAGS || type->kind == TDESC_TYPE_STRUCT); - type->u.u.fields->emplace_back (flag_name, - tdesc_predefined_type (TDESC_TYPE_BOOL), - start, start); + type->fields.emplace_back (flag_name, + tdesc_predefined_type (TDESC_TYPE_BOOL), + start, start); } void -tdesc_add_enum_value (struct tdesc_type *type, int value, +tdesc_add_enum_value (tdesc_type_with_fields *type, int value, const char *name) { gdb_assert (type->kind == TDESC_TYPE_ENUM); - - type->u.u.fields->emplace_back (name, - tdesc_predefined_type (TDESC_TYPE_INT32), - value, -1); + type->fields.emplace_back (name, + tdesc_predefined_type (TDESC_TYPE_INT32), + value, -1); } /* See arch/tdesc.h. */ @@ -1845,57 +1863,64 @@ public: printf_unfiltered ("}\n"); } - void visit (const tdesc_type *type) override + void visit (const tdesc_type_builtin *type) override + { + error (_("C output is not supported type \"%s\"."), type->name.c_str ()); + } + + void visit (const tdesc_type_vector *type) override { - /* Now we do some "filtering" in order to know which variables to - declare. This is needed because otherwise we would declare unused - variables `field_type' and `type'. */ - if (!m_printed_field_type) + if (!m_printed_element_type) { - printf_unfiltered (" struct tdesc_type *field_type;\n"); - m_printed_field_type = true; + printf_unfiltered (" tdesc_type *element_type;\n"); + m_printed_element_type = true; } - if ((type->kind == TDESC_TYPE_UNION - || type->kind == TDESC_TYPE_STRUCT - || type->kind == TDESC_TYPE_FLAGS - || type->kind == TDESC_TYPE_ENUM) - && !type->u.u.fields->empty () - && !m_printed_type) + printf_unfiltered + (" element_type = tdesc_named_type (feature, \"%s\");\n", + type->element_type->name.c_str ()); + printf_unfiltered + (" tdesc_create_vector (feature, \"%s\", element_type, %d);\n", + type->name.c_str (), type->count); + + printf_unfiltered ("\n"); + } + + void visit (const tdesc_type_with_fields *type) override + { + if (!m_printed_type_with_fields) { - printf_unfiltered (" struct tdesc_type *type;\n"); - m_printed_type = true; + printf_unfiltered (" tdesc_type_with_fields *type_with_fields;\n"); + m_printed_type_with_fields = true; + } + + if (!type->fields.empty () + && !m_printed_field_type) + { + printf_unfiltered (" tdesc_type *field_type;\n"); + m_printed_field_type = true; } switch (type->kind) { - case TDESC_TYPE_VECTOR: - printf_unfiltered - (" field_type = tdesc_named_type (feature, \"%s\");\n", - type->u.v.type->name.c_str ()); - printf_unfiltered - (" tdesc_create_vector (feature, \"%s\", field_type, %d);\n", - type->name.c_str (), type->u.v.count); - break; case TDESC_TYPE_STRUCT: case TDESC_TYPE_FLAGS: if (type->kind == TDESC_TYPE_STRUCT) { printf_unfiltered - (" type = tdesc_create_struct (feature, \"%s\");\n", + (" type_with_fields = tdesc_create_struct (feature, \"%s\");\n", type->name.c_str ()); - if (type->u.u.size != 0) + if (type->size != 0) printf_unfiltered - (" tdesc_set_struct_size (type, %d);\n", - type->u.u.size); + (" tdesc_set_struct_size (type_with_fields, %d);\n", type->size); } else { printf_unfiltered - (" type = tdesc_create_flags (feature, \"%s\", %d);\n", - type->name.c_str (), type->u.u.size); + (" type_with_fields = tdesc_create_flags (feature, \"%s\", %d);\n", + type->name.c_str (), type->size); } - for (const tdesc_type_field &f : *type->u.u.fields) + for (const tdesc_type_field &f : type->fields) { const char *type_name; @@ -1911,26 +1936,24 @@ public: { gdb_assert (f.start == f.end); printf_unfiltered - (" tdesc_add_flag (type, %d, \"%s\");\n", + (" tdesc_add_flag (type_with_fields, %d, \"%s\");\n", f.start, f.name.c_str ()); } - else if ((type->u.u.size == 4 - && f.type->kind == TDESC_TYPE_UINT32) - || (type->u.u.size == 8 + else if ((type->size == 4 && f.type->kind == TDESC_TYPE_UINT32) + || (type->size == 8 && f.type->kind == TDESC_TYPE_UINT64)) { printf_unfiltered - (" tdesc_add_bitfield (type, \"%s\", %d, %d);\n", + (" tdesc_add_bitfield (type_with_fields, \"%s\", %d, %d);\n", f.name.c_str (), f.start, f.end); } else { printf_unfiltered - (" field_type = tdesc_named_type (feature," - " \"%s\");\n", + (" field_type = tdesc_named_type (feature, \"%s\");\n", type_name); printf_unfiltered - (" tdesc_add_typed_bitfield (type, \"%s\"," + (" tdesc_add_typed_bitfield (type_with_fields, \"%s\"," " %d, %d, field_type);\n", f.name.c_str (), f.start, f.end); } @@ -1944,37 +1967,38 @@ public: " \"%s\");\n", type_name); printf_unfiltered - (" tdesc_add_field (type, \"%s\", field_type);\n", + (" tdesc_add_field (type_with_fields, \"%s\", field_type);\n", f.name.c_str ()); } } break; case TDESC_TYPE_UNION: printf_unfiltered - (" type = tdesc_create_union (feature, \"%s\");\n", + (" type_with_fields = tdesc_create_union (feature, \"%s\");\n", type->name.c_str ()); - for (const tdesc_type_field &f : *type->u.u.fields) + for (const tdesc_type_field &f : type->fields) { printf_unfiltered (" field_type = tdesc_named_type (feature, \"%s\");\n", f.type->name.c_str ()); printf_unfiltered - (" tdesc_add_field (type, \"%s\", field_type);\n", + (" tdesc_add_field (type_with_fields, \"%s\", field_type);\n", f.name.c_str ()); } break; case TDESC_TYPE_ENUM: printf_unfiltered - (" type = tdesc_create_enum (feature, \"%s\", %d);\n", - type->name.c_str (), type->u.u.size); - for (const tdesc_type_field &f : *type->u.u.fields) + (" type_with_fields = tdesc_create_enum (feature, \"%s\", %d);\n", + type->name.c_str (), type->size); + for (const tdesc_type_field &f : type->fields) printf_unfiltered - (" tdesc_add_enum_value (type, %d, \"%s\");\n", + (" tdesc_add_enum_value (type_with_fields, %d, \"%s\");\n", f.start, f.name.c_str ()); break; default: error (_("C output is not supported type \"%s\"."), type->name.c_str ()); } + printf_unfiltered ("\n"); } @@ -1995,8 +2019,15 @@ protected: private: char *m_function; + + /* Did we print "struct tdesc_type *element_type;" yet? */ + bool m_printed_element_type = false; + + /* Did we print "struct tdesc_type_with_fields *element_type;" yet? */ + bool m_printed_type_with_fields = false; + + /* Did we print "struct tdesc_type *field_type;" yet? */ bool m_printed_field_type = false; - bool m_printed_type = false; }; /* Print target description feature in C. */ diff --git a/gdb/target-descriptions.h b/gdb/target-descriptions.h index e97a373..8465c9e 100644 --- a/gdb/target-descriptions.h +++ b/gdb/target-descriptions.h @@ -209,13 +209,13 @@ void set_tdesc_property (struct target_desc *, const char *key, const char *value); void tdesc_add_compatible (struct target_desc *, const struct bfd_arch_info *); -struct tdesc_type *tdesc_create_enum (struct tdesc_feature *feature, - const char *name, - int size); -void tdesc_add_typed_bitfield (struct tdesc_type *type, const char *field_name, +tdesc_type_with_fields *tdesc_create_enum (struct tdesc_feature *feature, + const char *name, + int size); +void tdesc_add_typed_bitfield (tdesc_type_with_fields *type, const char *field_name, int start, int end, struct tdesc_type *field_type); -void tdesc_add_enum_value (struct tdesc_type *type, int value, +void tdesc_add_enum_value (tdesc_type_with_fields *type, int value, const char *name); #if GDB_SELF_TEST diff --git a/gdb/xml-tdesc.c b/gdb/xml-tdesc.c index a50ac5e..ae689fd 100644 --- a/gdb/xml-tdesc.c +++ b/gdb/xml-tdesc.c @@ -83,7 +83,7 @@ struct tdesc_parsing_data int next_regnum; /* The struct or union we are currently parsing, or last parsed. */ - struct tdesc_type *current_type; + tdesc_type_with_fields *current_type; /* The byte size of the current struct/flags type, if specified. Zero if not specified. Flags values must specify a size. */ @@ -244,11 +244,11 @@ tdesc_start_struct (struct gdb_xml_parser *parser, { struct tdesc_parsing_data *data = (struct tdesc_parsing_data *) user_data; char *id = (char *) xml_find_attribute (attributes, "id")->value; - struct tdesc_type *type; struct gdb_xml_value *attr; - type = tdesc_create_struct (data->current_feature, id); - data->current_type = type; + tdesc_type_with_fields *type_with_fields + = tdesc_create_struct (data->current_feature, id); + data->current_type = type_with_fields; data->current_type_size = 0; attr = xml_find_attribute (attributes, "size"); @@ -262,7 +262,7 @@ tdesc_start_struct (struct gdb_xml_parser *parser, _("Struct size %s is larger than maximum (%d)"), pulongest (size), MAX_FIELD_SIZE); } - tdesc_set_struct_size (type, size); + tdesc_set_struct_size (type_with_fields, size); data->current_type_size = size; } } @@ -276,7 +276,6 @@ tdesc_start_flags (struct gdb_xml_parser *parser, char *id = (char *) xml_find_attribute (attributes, "id")->value; ULONGEST size = * (ULONGEST *) xml_find_attribute (attributes, "size")->value; - struct tdesc_type *type; if (size > MAX_FIELD_SIZE) { @@ -284,9 +283,8 @@ tdesc_start_flags (struct gdb_xml_parser *parser, _("Flags size %s is larger than maximum (%d)"), pulongest (size), MAX_FIELD_SIZE); } - type = tdesc_create_flags (data->current_feature, id, size); - data->current_type = type; + data->current_type = tdesc_create_flags (data->current_feature, id, size); data->current_type_size = size; } @@ -299,7 +297,6 @@ tdesc_start_enum (struct gdb_xml_parser *parser, char *id = (char *) xml_find_attribute (attributes, "id")->value; int size = * (ULONGEST *) xml_find_attribute (attributes, "size")->value; - struct tdesc_type *type; if (size > MAX_FIELD_SIZE) { @@ -307,9 +304,8 @@ tdesc_start_enum (struct gdb_xml_parser *parser, _("Enum size %s is larger than maximum (%d)"), pulongest (size), MAX_FIELD_SIZE); } - type = tdesc_create_enum (data->current_feature, id, size); - data->current_type = type; + data->current_type = tdesc_create_enum (data->current_feature, id, size); data->current_type_size = 0; } @@ -375,7 +371,7 @@ tdesc_start_field (struct gdb_xml_parser *parser, if (start != -1) { - struct tdesc_type *t = data->current_type; + tdesc_type_with_fields *t = data->current_type; /* Older versions of gdb can't handle elided end values. Stick with that for now, to help ensure backward compatibility. |