aboutsummaryrefslogtreecommitdiff
path: root/gdb/xml-tdesc.c
diff options
context:
space:
mode:
authorUlrich Weigand <uweigand@de.ibm.com>2009-06-23 16:59:47 +0000
committerUlrich Weigand <uweigand@de.ibm.com>2009-06-23 16:59:47 +0000
commitad068eabda988774e168b3f9b410306b40f5c191 (patch)
tree4c110731642c5b8169ef8c97e44eae51ad9ea98b /gdb/xml-tdesc.c
parent8ac055f84919d6e341f50150fca1a9e40079ff5f (diff)
downloadgdb-ad068eabda988774e168b3f9b410306b40f5c191.zip
gdb-ad068eabda988774e168b3f9b410306b40f5c191.tar.gz
gdb-ad068eabda988774e168b3f9b410306b40f5c191.tar.bz2
* target-descriptions.h (struct type): Do not declare.
(struct tdesc_type): Declare. (tdesc_named_type): Change return type to struct tdesc_type *. (tdesc_record_type): Remove. (tdesc_create_vector): Add prototype. (tdesc_create_union): Likewise. (tdesc_add_field): Likewise. * target-descriptions.c (struct tdesc_reg): Replace gdb_type member by tdesc_type member. (struct tdesc_type_field, tdesc_type_field): Add type and vector def. (struct tdesc_type, tdesc_type_p): Likewise. (struct tdesc_arch_reg, tdesc_arch_reg): Likewise. (struct tdesc_feature): Change type of "types" to VEC(tdesc_type_p). (struct tdesc_arch_data): Replace registers member by arch_regs. (tdesc_predefined_types): Change to array of pre-defined struct tdesc_type structures. Add "code_ptr" and "data_ptr". (tdesc_named_type): Return struct tdesc_type * instead of GDB type. (tdesc_gdb_type): New function. (target_find_description): Update for data structure changes. (tdesc_data_cleanup): Likewise. (tdesc_numbered_register): Likewise. (tdesc_use_registers): Likewise. (tdesc_create_reg): Likewise. (tdesc_find_arch_register): New function. (tdesc_find_register): Use it. (tdesc_register_type): Use tdesc_gdb_type to generate GDB type from tdesc_type on demand; cache generated types in tdesc_arch_reg. (tdesc_free_type): New function. (tdesc_free_feature): Call it. (tdesc_create_vector): New function. (tdesc_create_union): Likewise. (tdesc_add_field): Likewise. (tdesc_record_type): Remove. (tdesc_type_id): Remove. (maint_print_c_tdesc_cmd): Update for data structure changes. Update generated code to create tdesc_type structures instead of GDB types. * xml-tdesc.c: Do not include "gdbtypes.h". (struct tdesc_parsing_data): Change type of current_union to struct tdesc_type *. (tdesc_start_reg): Do not special-case "code_ptr" or "data_ptr". (tdesc_start_union): Call tdesc_create_union. (tdesc_start_field): Call tdesc_add_field. (tdesc_start_vector): Call tdesc_create_vector. (tdesc_end_union): Remove. (feature_children): Remove reference to tdesc_end_union. * features/arm-with-iwmmxt.c: Regenerate. * features/mips-linux.c: Regenerate. * features/mips64-linux.c: Regenerate. * features/rs6000/powerpc-32.c: Regenerate. * features/rs6000/powerpc-32l.c: Regenerate. * features/rs6000/powerpc-403.c: Regenerate. * features/rs6000/powerpc-403gc.c: Regenerate. * features/rs6000/powerpc-505.c: Regenerate. * features/rs6000/powerpc-601.c: Regenerate. * features/rs6000/powerpc-602.c: Regenerate. * features/rs6000/powerpc-603.c: Regenerate. * features/rs6000/powerpc-604.c: Regenerate. * features/rs6000/powerpc-64.c: Regenerate. * features/rs6000/powerpc-64l.c: Regenerate. * features/rs6000/powerpc-7400.c: Regenerate. * features/rs6000/powerpc-750.c: Regenerate. * features/rs6000/powerpc-860.c: Regenerate. * features/rs6000/powerpc-altivec32.c: Regenerate. * features/rs6000/powerpc-altivec32l.c: Regenerate. * features/rs6000/powerpc-altivec64.c: Regenerate. * features/rs6000/powerpc-altivec64l.c: Regenerate. * features/rs6000/powerpc-e500.c: Regenerate. * features/rs6000/powerpc-e500l.c: Regenerate. * features/rs6000/powerpc-isa205-32l.c: Regenerate. * features/rs6000/powerpc-isa205-64l.c: Regenerate. * features/rs6000/powerpc-isa205-altivec32l.c: Regenerate. * features/rs6000/powerpc-isa205-altivec64l.c: Regenerate. * features/rs6000/powerpc-isa205-vsx32l.c: Regenerate. * features/rs6000/powerpc-isa205-vsx64l.c: Regenerate. * features/rs6000/powerpc-vsx32.c: Regenerate. * features/rs6000/powerpc-vsx32l.c: Regenerate. * features/rs6000/powerpc-vsx64.c: Regenerate. * features/rs6000/powerpc-vsx64l.c: Regenerate. * features/rs6000/rs6000.c: Regenerate.
Diffstat (limited to 'gdb/xml-tdesc.c')
-rw-r--r--gdb/xml-tdesc.c46
1 files changed, 7 insertions, 39 deletions
diff --git a/gdb/xml-tdesc.c b/gdb/xml-tdesc.c
index 1d4e12c..6987bee 100644
--- a/gdb/xml-tdesc.c
+++ b/gdb/xml-tdesc.c
@@ -20,7 +20,6 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "defs.h"
-#include "gdbtypes.h"
#include "target.h"
#include "target-descriptions.h"
#include "xml-support.h"
@@ -86,7 +85,7 @@ struct tdesc_parsing_data
int next_regnum;
/* The union we are currently parsing, or last parsed. */
- struct type *current_union;
+ struct tdesc_type *current_union;
};
/* Handle the end of an <architecture> element and its value. */
@@ -176,8 +175,6 @@ tdesc_start_reg (struct gdb_xml_parser *parser,
if (strcmp (type, "int") != 0
&& strcmp (type, "float") != 0
- && strcmp (type, "code_ptr") != 0
- && strcmp (type, "data_ptr") != 0
&& tdesc_named_type (data->current_feature, type) == NULL)
gdb_xml_error (parser, _("Register \"%s\" has unknown type \"%s\""),
name, type);
@@ -198,33 +195,8 @@ tdesc_start_union (struct gdb_xml_parser *parser,
{
struct tdesc_parsing_data *data = user_data;
char *id = VEC_index (gdb_xml_value_s, attributes, 0)->value;
- struct type *type;
- type = init_composite_type (NULL, TYPE_CODE_UNION);
- TYPE_NAME (type) = xstrdup (id);
- tdesc_record_type (data->current_feature, type);
- data->current_union = type;
-}
-
-/* Handle the end of a <union> element. */
-
-static void
-tdesc_end_union (struct gdb_xml_parser *parser,
- const struct gdb_xml_element *element,
- void *user_data, const char *body_text)
-{
- struct tdesc_parsing_data *data = user_data;
- int i;
-
- /* If any of the children of this 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". */
- for (i = 0; i < TYPE_NFIELDS (data->current_union); i++)
- if (TYPE_VECTOR (TYPE_FIELD_TYPE (data->current_union, i)))
- {
- TYPE_VECTOR (data->current_union) = 1;
- break;
- }
+ data->current_union = tdesc_create_union (data->current_feature, id);
}
/* Handle the start of a <field> element. Attach the field to the
@@ -237,7 +209,7 @@ tdesc_start_field (struct gdb_xml_parser *parser,
{
struct tdesc_parsing_data *data = user_data;
struct gdb_xml_value *attrs = VEC_address (gdb_xml_value_s, attributes);
- struct type *type, *field_type;
+ struct tdesc_type *field_type;
char *field_name, *field_type_id;
field_name = attrs[0].value;
@@ -249,8 +221,7 @@ tdesc_start_field (struct gdb_xml_parser *parser,
"type \"%s\""),
field_name, field_type_id);
- append_composite_type_field (data->current_union, xstrdup (field_name),
- field_type);
+ tdesc_add_field (data->current_union, field_name, field_type);
}
/* Handle the start of a <vector> element. Initialize the type and
@@ -263,7 +234,7 @@ tdesc_start_vector (struct gdb_xml_parser *parser,
{
struct tdesc_parsing_data *data = user_data;
struct gdb_xml_value *attrs = VEC_address (gdb_xml_value_s, attributes);
- struct type *type, *field_type, *range_type;
+ struct tdesc_type *field_type;
char *id, *field_type_id;
int count;
@@ -276,10 +247,7 @@ tdesc_start_vector (struct gdb_xml_parser *parser,
gdb_xml_error (parser, _("Vector \"%s\" references undefined type \"%s\""),
id, field_type_id);
- type = init_vector_type (field_type, count);
- TYPE_NAME (type) = xstrdup (id);
-
- tdesc_record_type (data->current_feature, type);
+ tdesc_create_vector (data->current_feature, id, field_type, count);
}
/* The elements and attributes of an XML target description. */
@@ -330,7 +298,7 @@ static const struct gdb_xml_element feature_children[] = {
tdesc_start_reg, NULL },
{ "union", union_attributes, union_children,
GDB_XML_EF_OPTIONAL | GDB_XML_EF_REPEATABLE,
- tdesc_start_union, tdesc_end_union },
+ tdesc_start_union, NULL },
{ "vector", vector_attributes, NULL,
GDB_XML_EF_OPTIONAL | GDB_XML_EF_REPEATABLE,
tdesc_start_vector, NULL },