184 typedef const struct bfd_arch_info *
arch_p;
192 const struct bfd_arch_info *
arch;
199 VEC(arch_p) *compatible;
281 return info != NULL && info->
filename != NULL;
302 if (tdesc_info != NULL)
311 #define target_desc_fetched \
312 get_tdesc_info (current_inferior ())->fetched
313 #define current_target_desc \
314 get_tdesc_info (current_inferior ())->tdesc
315 #define target_description_filename \
316 get_tdesc_info (current_inferior ())->filename
366 warning (
_(
"Architecture rejected target-supplied description"));
373 && data->arch_regs == NULL)
374 warning (
_(
"Target-supplied registers are not supported "
375 "by the current architecture"));
401 _(
"Could not remove target-supplied description"));
422 const struct bfd_arch_info *
arch)
424 const struct bfd_arch_info *compat;
427 for (ix = 0;
VEC_iterate (arch_p, target_desc->compatible, ix, compat);
431 || arch->compatible (arch, compat)
432 || compat->compatible (compat, arch))
453 if (strcmp (prop->
key, key) == 0)
462 const struct bfd_arch_info *
465 return target_desc->
arch;
474 return target_desc->
osabi;
487 if (target_desc == NULL)
512 if (strcmp (feature->
name, name) == 0)
523 return feature->
name;
558 if (strcmp (type->
name,
id) == 0)
562 for (ix = 0; ix < ARRAY_SIZE (tdesc_predefined_types); ix++)
563 if (strcmp (tdesc_predefined_types[ix].
name,
id) == 0)
564 return &tdesc_predefined_types[ix];
580 for (i = 0; i < num_regs; i++)
601 switch (tdesc_type->
kind)
648 switch (tdesc_type->
kind)
669 struct type *
type, *field_type;
680 struct type *
type, *field_type;
696 struct type *field_type;
697 int bitsize, total_size;
702 if (tdesc_type->
u.u.size > 4)
733 if (tdesc_type->
u.u.size != 0)
740 struct type *
type, *field_type;
769 tdesc_type->
u.f.size);
784 "Type \"%s\" has an unknown kind %d",
785 tdesc_type->
name, tdesc_type->
kind);
836 if (strcasecmp (reg->
name, name) == 0)
847 int regno,
const char *
name)
885 int regno,
const char *
const names[])
889 for (i = 0; names[i] != NULL; i++)
928 return reg? reg->
reg : NULL;
944 if (regno >= num_regs && regno < num_regs + num_pseudo_regs)
948 gdb_assert (data->pseudo_register_name != NULL);
949 return data->pseudo_register_name (gdbarch, regno);
963 if (reg == NULL && regno >= num_regs && regno < num_regs + num_pseudo_regs)
967 gdb_assert (data->pseudo_register_type != NULL);
968 return data->pseudo_register_type (gdbarch, regno);
975 if (arch_reg->
type == NULL)
982 else if (strcmp (reg->
type,
"float") == 0)
992 warning (
_(
"Register \"%s\" has an unsupported size (%d bits)"),
997 else if (strcmp (reg->
type,
"int") == 0)
1014 warning (
_(
"Register \"%s\" has an unsupported size (%d bits)"),
1020 if (arch_reg->
type == NULL)
1022 "Register \"%s\" has an unknown type \"%s\"",
1026 return arch_reg->
type;
1061 if (reg != NULL && reg->
group != NULL)
1063 int general_p = 0, float_p = 0, vector_p = 0;
1065 if (strcmp (reg->
group,
"general") == 0)
1067 else if (strcmp (reg->
group,
"float") == 0)
1069 else if (strcmp (reg->
group,
"vector") == 0)
1101 if (regno >= num_regs && regno < num_regs + num_pseudo_regs)
1105 if (data->pseudo_register_reggroup_p != NULL)
1106 return data->pseudo_register_reggroup_p (gdbarch, regno, reggroup);
1126 data->pseudo_register_name = pseudo_name;
1135 data->pseudo_register_type = pseudo_type;
1140 (
struct gdbarch *gdbarch,
1145 data->pseudo_register_reggroup_p = pseudo_reggroup_p;
1170 data->arch_regs = early_data->arch_regs;
1176 reg_hash = htab_create (37, htab_hash_pointer, htab_eq_pointer, NULL);
1184 void **slot = htab_find_slot (reg_hash, reg, INSERT);
1195 htab_remove_elt (reg_hash, arch_reg->
reg);
1211 if (htab_find (reg_hash, reg) != NULL)
1218 htab_delete (reg_hash);
1243 int regnum,
int save_restore,
const char *group,
1244 int bitsize,
const char *
type)
1248 reg->
name = xstrdup (name);
1251 reg->
group = group ? xstrdup (group) : NULL;
1253 reg->
type = type ? xstrdup (type) : xstrdup (
"<unknown>");
1310 type->
name = xstrdup (name);
1312 type->
u.v.type = field_type;
1324 type->
name = xstrdup (name);
1339 type->
u.u.size =
size;
1347 type->
name = xstrdup (name);
1360 type->
name = xstrdup (name);
1362 type->
u.f.size =
size;
1381 f.
name = xstrdup (field_name);
1382 f.
type = field_type;
1397 f.
name = xstrdup (field_name);
1406 const char *flag_name)
1412 f.
name = xstrdup (flag_name);
1442 new_feature->
name = xstrdup (name);
1477 VEC_free (arch_p, target_desc->compatible);
1479 xfree (target_desc);
1490 const struct bfd_arch_info *compatible)
1492 const struct bfd_arch_info *compat;
1498 if (compatible == NULL)
1501 for (ix = 0;
VEC_iterate (arch_p, target_desc->compatible, ix, compat);
1503 if (compat == compatible)
1505 _(
"Attempted to add duplicate "
1506 "compatible architecture \"%s\""),
1507 compatible->printable_name);
1509 VEC_safe_push (arch_p, target_desc->compatible, compatible);
1514 const char *key,
const char *
value)
1523 if (strcmp (prop->
key, key) == 0)
1525 _(
"Attempted to add duplicate property \"%s\""),
key);
1527 new_prop.
key = xstrdup (key);
1528 new_prop.
value = xstrdup (value);
1534 const struct bfd_arch_info *arch)
1536 target_desc->
arch = arch;
1542 target_desc->
osabi = osabi;
1587 if (value != NULL && *value !=
'\0')
1592 "read from the target.\n"));
1608 const struct bfd_arch_info *compatible;
1609 const char *filename, *inp;
1610 char *
function, *outp;
1618 int printed_field_type = 0;
1626 error (
_(
"There is no target description to print."));
1629 error (
_(
"The current target description did not come from an XML file."));
1632 function = alloca (strlen (filename) + 1);
1633 for (inp = filename, outp =
function; *inp !=
'\0'; inp++)
1636 else if (*inp ==
'-')
1644 "-*- buffer-read-only: t -*- vi"
1657 (
" struct target_desc *result = allocate_target_description ();\n");
1667 int printed_desc_type = 0;
1673 if (!printed_field_type)
1676 printed_field_type = 1;
1684 printed_desc_type = 1;
1689 if (printed_desc_type)
1698 (
" set_tdesc_architecture (result, bfd_scan_arch (\"%s\"));\n",
1707 (
" set_tdesc_osabi (result, osabi_from_tdesc_string (\"%s\"));\n",
1712 for (ix = 0;
VEC_iterate (arch_p, tdesc->compatible, ix, compatible);
1716 (
" tdesc_add_compatible (result, bfd_scan_arch (\"%s\"));\n",
1717 compatible->printable_name);
1734 feature = tdesc_create_feature (result, \"%s\");\n",
1745 (
" field_type = tdesc_named_type (feature, \"%s\");\n",
1746 type->
u.v.type->name);
1748 (
" tdesc_create_vector (feature, \"%s\", field_type, %d);\n",
1749 type->
name, type->
u.v.count);
1753 (
" type = tdesc_create_struct (feature, \"%s\");\n",
1755 if (type->
u.u.size != 0)
1757 (
" tdesc_set_struct_size (type, %s);\n",
1766 if (f->
type != NULL)
1769 (
" field_type = tdesc_named_type (feature, \"%s\");\n",
1772 (
" tdesc_add_field (type, \"%s\", field_type);\n",
1777 (
" tdesc_add_bitfield (type, \"%s\", %d, %d);\n",
1783 (
" type = tdesc_create_union (feature, \"%s\");\n",
1790 (
" field_type = tdesc_named_type (feature, \"%s\");\n",
1793 (
" tdesc_add_field (type, \"%s\", field_type);\n",
1799 (
" field_type = tdesc_create_flags (feature, \"%s\", %d);\n",
1800 type->
name, (
int) type->
u.f.size);
1806 (
" tdesc_add_flag (field_type, %d, \"%s\");\n",
1810 error (
_(
"C output is not supported type \"%s\"."), type->
name);
1844 Set target description specific variables."),
1845 &tdesc_set_cmdlist,
"set tdesc ",
1848 Show target description specific variables."),
1849 &tdesc_show_cmdlist,
"show tdesc ",
1852 Unset target description specific variables."),
1853 &tdesc_unset_cmdlist,
"unset tdesc ",
1857 &tdesc_filename_cmd_string,
1859 Set the file to read for an XML target description"),
_(
"\
1860 Show the file to read for an XML target description"),
_(
"\
1861 When set, GDB will read the target description from a local\n\
1862 file instead of querying the remote target."),
1865 &tdesc_set_cmdlist, &tdesc_show_cmdlist);
1868 Unset the file to read for an XML target description. When unset,\n\
1869 GDB will read the description from the target."),
1870 &tdesc_unset_cmdlist);
1873 Print the current target description as a C source file."),
struct tdesc_feature * tdesc_create_feature(struct target_desc *tdesc, const char *name)
struct gdbarch * target_gdbarch(void)
void set_gdbarch_num_regs(struct gdbarch *gdbarch, int num_regs)
static struct tdesc_reg * tdesc_find_register(struct gdbarch *gdbarch, int regno)
struct tdesc_type * tdesc_create_vector(struct tdesc_feature *feature, const char *name, struct tdesc_type *field_type, int count)
struct cmd_list_element * add_prefix_cmd(const char *name, enum command_class theclass, cmd_cfunc_ftype *fun, const char *doc, struct cmd_list_element **prefixlist, const char *prefixname, int allow_unknown, struct cmd_list_element **list)
int tdesc_register_in_reggroup_p(struct gdbarch *gdbarch, int regno, struct reggroup *reggroup)
struct tdesc_type * tdesc_create_union(struct tdesc_feature *feature, const char *name)
struct type * builtin_func_ptr
#define VEC_replace(T, V, I, O)
void set_tdesc_pseudo_register_name(struct gdbarch *gdbarch, gdbarch_register_name_ftype *pseudo_name)
static int tdesc_register_reggroup_p(struct gdbarch *gdbarch, int regno, struct reggroup *reggroup)
struct type * builtin_long_double
struct tdesc_type::@162::@165 f
struct target_desc_info * tdesc_info
const struct floatformat * floatformats_ieee_double[BFD_ENDIAN_UNKNOWN]
void copy_inferior_target_desc_info(struct inferior *destinf, struct inferior *srcinf)
int gdbarch_int_bit(struct gdbarch *gdbarch)
static void show_tdesc_filename_cmd(struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
struct type * arch_flags_type(struct gdbarch *gdbarch, char *name, int length)
void set_tdesc_pseudo_register_type(struct gdbarch *gdbarch, gdbarch_register_type_ftype *pseudo_type)
void warning(const char *fmt,...)
int target_desc_info_from_user_p(struct target_desc_info *info)
int tdesc_compatible_p(const struct target_desc *target_desc, const struct bfd_arch_info *arch)
#define TYPE_NAME(thistype)
int gdbarch_ptr_bit(struct gdbarch *gdbarch)
struct type * arch_float_type(struct gdbarch *gdbarch, int bit, char *name, const struct floatformat **floatformats)
char * plongest(LONGEST l)
void * gdbarch_data(struct gdbarch *gdbarch, struct gdbarch_data *data)
struct tdesc_type * tdesc_type
struct ui_file * gdb_stdout
const struct builtin_type * builtin_type(struct gdbarch *gdbarch)
void internal_error(const char *file, int line, const char *fmt,...)
int gdbarch_update_p(struct gdbarch_info info)
const char * tdesc_register_name(struct gdbarch *gdbarch, int regno)
void append_flags_type_flag(struct type *type, int bitpos, char *name)
struct type * builtin_uint8
static struct tdesc_reg * tdesc_find_register_early(const struct tdesc_feature *feature, const char *name)
int tdesc_register_size(const struct tdesc_feature *feature, const char *name)
struct type * builtin_uint16
void set_gdbarch_register_reggroup_p(struct gdbarch *gdbarch, gdbarch_register_reggroup_p_ftype register_reggroup_p)
static struct cmd_list_element * tdesc_show_cmdlist
int gdbarch_long_bit(struct gdbarch *gdbarch)
struct type * arch_composite_type(struct gdbarch *gdbarch, char *name, enum type_code code)
#define VEC_safe_push(T, V, O)
struct reggroup *const restore_reggroup
struct gdbarch_data * gdbarch_data_register_pre_init(gdbarch_data_pre_init_ftype *pre_init)
static int tdesc_remote_register_number(struct gdbarch *gdbarch, int regno)
int gdbarch_num_regs(struct gdbarch *gdbarch)
#define SET_FIELD_BITPOS(thisfld, bitpos)
static struct type * tdesc_gdb_type(struct gdbarch *gdbarch, struct tdesc_type *tdesc_type)
struct property property_s
void tdesc_data_cleanup(void *data_untyped)
static void set_tdesc_cmd(char *args, int from_tty)
const char * tdesc_feature_name(const struct tdesc_feature *feature)
struct type * builtin_int32
static void unset_tdesc_filename_cmd(char *args, int from_tty)
static void unset_tdesc_cmd(char *args, int from_tty)
struct type * builtin_short
void printf_filtered(const char *format,...)
static struct cmd_list_element * tdesc_unset_cmdlist
mach_port_t kern_return_t mach_port_t msgports mach_port_t kern_return_t pid_t pid mach_port_t kern_return_t mach_port_t task mach_port_t kern_return_t int flags
int gdbarch_num_pseudo_regs(struct gdbarch *gdbarch)
struct reggroup *const float_reggroup
void tdesc_add_field(struct tdesc_type *type, const char *field_name, struct tdesc_type *field_type)
int tdesc_numbered_register(const struct tdesc_feature *feature, struct tdesc_arch_data *data, int regno, const char *name)
struct cmd_list_element * setlist
struct type * builtin_int128
const char *( gdbarch_register_name_ftype)(struct gdbarch *gdbarch, int regnr)
struct cleanup * make_cleanup_free_target_description(struct target_desc *target_desc)
#define VEC_iterate(T, V, I, P)
void set_gdbarch_register_type(struct gdbarch *gdbarch, gdbarch_register_type_ftype register_type)
struct reggroup *const general_reggroup
int tdesc_numbered_register_choices(const struct tdesc_feature *feature, struct tdesc_arch_data *data, int regno, const char *const names[])
const struct target_desc * target_read_description(struct target_ops *target)
struct tdesc_type * tdesc_create_struct(struct tdesc_feature *feature, const char *name)
struct target_ops current_target
void initialize_file_ftype(void)
#define target_desc_fetched
void target_clear_description(void)
void tdesc_create_reg(struct tdesc_feature *feature, const char *name, int regnum, int save_restore, const char *group, int bitsize, const char *type)
struct tdesc_type * tdesc_create_flags(struct tdesc_feature *feature, const char *name, LONGEST size)
struct field * append_composite_type_field_raw(struct type *t, char *name, struct type *field)
struct cmd_list_element * showlist
static void free_target_description(void *arg)
struct type * builtin_int16
struct cmd_list_element * add_cmd(const char *name, enum command_class theclass, cmd_cfunc_ftype *fun, const char *doc, struct cmd_list_element **list)
struct tdesc_feature * tdesc_feature_p
void tdesc_add_bitfield(struct tdesc_type *type, const char *field_name, int start, int end)
struct cleanup * make_cleanup(make_cleanup_ftype *function, void *arg)
struct cmd_list_element * unsetlist
#define target_description_filename
int( gdbarch_register_reggroup_p_ftype)(struct gdbarch *gdbarch, int regnum, struct reggroup *reggroup)
struct target_desc * allocate_target_description(void)
struct type *( gdbarch_register_type_ftype)(struct gdbarch *gdbarch, int reg_nr)
struct type * init_vector_type(struct type *elt_type, int n)
struct tdesc_type_field tdesc_type_field
struct type * builtin_int0
#define VEC_index(T, V, I)
struct type * builtin_uint32
struct type * tdesc_find_type(struct gdbarch *gdbarch, const char *id)
const struct target_desc * tdesc
static void tdesc_free_type(struct tdesc_type *type)
struct tdesc_arch_reg tdesc_arch_reg
int gdbarch_double_bit(struct gdbarch *gdbarch)
struct type * builtin_long
static struct target_desc_info * get_tdesc_info(struct inferior *inf)
struct tdesc_type::@162::@164 u
void printf_unfiltered(const char *format,...)
const struct bfd_arch_info * arch
struct reggroup *const vector_reggroup
#define FIELD_BITSIZE(thisfld)
static void show_tdesc_cmd(char *args, int from_tty)
enum tdesc_type_kind kind
void set_tdesc_property(struct target_desc *target_desc, const char *key, const char *value)
struct type * builtin_uint128
struct cmd_list_element * maintenanceprintlist
void target_desc_info_free(struct target_desc_info *tdesc_info)
const struct target_desc * target_current_description(void)
void cmd_show_list(struct cmd_list_element *list, int from_tty, const char *prefix)
void tdesc_add_flag(struct tdesc_type *type, int start, const char *flag_name)
const struct target_desc * target_desc
#define current_target_desc
static void tdesc_free_feature(struct tdesc_feature *feature)
const struct target_desc * file_read_description_xml(const char *filename)
const struct floatformat * floatformats_ieee_single[BFD_ENDIAN_UNKNOWN]
const struct bfd_arch_info * arch_p
static struct tdesc_arch_reg * tdesc_find_arch_register(struct gdbarch *gdbarch, int regno)
static void tdesc_free_reg(struct tdesc_reg *reg)
void tdesc_use_registers(struct gdbarch *gdbarch, const struct target_desc *target_desc, struct tdesc_arch_data *early_data)
void append_composite_type_field(struct type *t, char *name, struct type *field)
void help_list(struct cmd_list_element *list, const char *cmdtype, enum command_class theclass, struct ui_file *stream)
const struct floatformat * floatformats_i387_ext[BFD_ENDIAN_UNKNOWN]
struct type * builtin_char
struct tdesc_type * tdesc_named_type(const struct tdesc_feature *feature, const char *id)
struct type * builtin_double
const struct target_desc * target_read_description_xml(struct target_ops *ops)
enum gdb_osabi tdesc_osabi(const struct target_desc *target_desc)
void gdbarch_info_init(struct gdbarch_info *info)
struct type * builtin_data_ptr
int gdbarch_long_long_bit(struct gdbarch *gdbarch)
struct type * tdesc_register_type(struct gdbarch *gdbarch, int regno)
int gdbarch_float_bit(struct gdbarch *gdbarch)
initialize_file_ftype _initialize_target_descriptions
struct tdesc_type::@162::@163 v
void add_setshow_filename_cmd(const char *name, enum command_class theclass, char **var, const char *set_doc, const char *show_doc, const char *help_doc, cmd_sfunc_ftype *set_func, show_value_ftype *show_func, struct cmd_list_element **set_list, struct cmd_list_element **show_list)
const struct bfd_arch_info * tdesc_architecture(const struct target_desc *target_desc)
static void * tdesc_data_init(struct obstack *obstack)
#define TYPE_TAG_NAME(type)
static void set_tdesc_filename_cmd(char *args, int from_tty, struct cmd_list_element *c)
struct tdesc_arch_data * tdesc_data_alloc(void)
const char * gdbarch_osabi_name(enum gdb_osabi osabi)
int gdbarch_bits_big_endian(struct gdbarch *gdbarch)
struct type * builtin_long_long
static PyObject * field_name(struct type *type, int field)
void tdesc_set_struct_size(struct tdesc_type *type, LONGEST size)
const struct tdesc_feature * tdesc_find_feature(const struct target_desc *target_desc, const char *name)
void set_tdesc_osabi(struct target_desc *target_desc, enum gdb_osabi osabi)
struct type * builtin_int64
struct tdesc_reg * tdesc_reg_p
void set_gdbarch_remote_register_number(struct gdbarch *gdbarch, gdbarch_remote_register_number_ftype remote_register_number)
void set_tdesc_pseudo_register_reggroup_p(struct gdbarch *gdbarch, gdbarch_register_reggroup_p_ftype *pseudo_reggroup_p)
static char * tdesc_filename_cmd_string
int default_register_reggroup_p(struct gdbarch *gdbarch, int regnum, struct reggroup *group)
struct reggroup *const save_reggroup
#define OBSTACK_ZALLOC(OBSTACK, TYPE)
#define TYPE_LENGTH(thistype)
void set_tdesc_architecture(struct target_desc *target_desc, const struct bfd_arch_info *arch)
struct type * builtin_uint64
struct tdesc_type * tdesc_type_p
void tdesc_add_compatible(struct target_desc *target_desc, const struct bfd_arch_info *compatible)
int gdbarch_long_double_bit(struct gdbarch *gdbarch)
struct tdesc_type_flag tdesc_type_flag
struct type * builtin_int8
void target_find_description(void)
const struct floatformat * floatformats_arm_ext[BFD_ENDIAN_UNKNOWN]
static struct gdbarch_data * tdesc_data
int gdbarch_short_bit(struct gdbarch *gdbarch)
int tdesc_has_registers(const struct target_desc *target_desc)
static void maint_print_c_tdesc_cmd(char *args, int from_tty)
void set_gdbarch_register_name(struct gdbarch *gdbarch, gdbarch_register_name_ftype register_name)
void error(const char *fmt,...)
static struct cmd_list_element * tdesc_set_cmdlist
int tdesc_unnumbered_register(const struct tdesc_feature *feature, const char *name)
const char * tdesc_property(const struct target_desc *target_desc, const char *key)
struct type * builtin_float
const struct target_desc * gdbarch_target_desc(struct gdbarch *gdbarch)
struct type * builtin_int