diff options
author | Daniel Jacobowitz <drow@false.org> | 2006-11-28 22:14:31 +0000 |
---|---|---|
committer | Daniel Jacobowitz <drow@false.org> | 2006-11-28 22:14:31 +0000 |
commit | 29709017e835906e3e95bc230d393331636234e1 (patch) | |
tree | 0c60f098cfaeadad329383e1447ee9fbf2e1c375 /gdb/target-descriptions.c | |
parent | 424163ea1524c5823612a24284cb900cd70e2e2b (diff) | |
download | gdb-29709017e835906e3e95bc230d393331636234e1.zip gdb-29709017e835906e3e95bc230d393331636234e1.tar.gz gdb-29709017e835906e3e95bc230d393331636234e1.tar.bz2 |
* Makefile.in (mips-tdep.o, target-descriptions.o): Update.
* target-descriptions.c (struct property): New.
(struct target_desc): Add properties member.
(tdesc_property, set_tdesc_property): New.
* target-descriptions.h (tdesc_property, set_tdesc_property):
Declare.
* mips-tdep.c (PROPERTY_GP32, PROPERTY_GP64): New constants.
(struct gdbarch_tdep): Add register_size_valid_p and register_size.
(mips_isa_regsize): Use them.
(mips_register_g_packet_guesses): New.
(mips_gdbarch_init): Call it. If a target description is supplied,
check for internal properties. Check for register size mismatches.
* remote.c (send_g_packet, process_g_packet): New functions, split
out from fetch_registers_using_g.
(fetch_registers_using_g): Use them.
(struct remote_g_packet_guess, remote_g_packet_guess_s)
(struct remote_g_packet_data, remote_g_packet_data_handle)
(remote_g_packet_data_init, register_remote_g_packet_guess)
(remote_read_description): New.
(init_remote_ops, init_remote_async_ops): Set to_read_description.
(_initialize_remote): Register remote_g_packet_data_handle.
* remote.h (register_remote_g_packet_guess): Declare.
Diffstat (limited to 'gdb/target-descriptions.c')
-rw-r--r-- | gdb/target-descriptions.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/gdb/target-descriptions.c b/gdb/target-descriptions.c index 041d72b..ffee104 100644 --- a/gdb/target-descriptions.c +++ b/gdb/target-descriptions.c @@ -26,13 +26,23 @@ #include "arch-utils.h" #include "target.h" #include "target-descriptions.h" +#include "vec.h" #include "gdb_assert.h" /* Types. */ +typedef struct property +{ + const char *key; + const char *value; +} property_s; +DEF_VEC_O(property_s); + struct target_desc { + /* Any architecture-specific properties specified by the target. */ + VEC(property_s) *properties; }; /* Global state. These variables are associated with the current @@ -122,6 +132,23 @@ target_current_description (void) return NULL; } +/* Return the string value of a property named KEY, or NULL if the + property was not specified. */ + +const char * +tdesc_property (const struct target_desc *target_desc, const char *key) +{ + struct property *prop; + int ix; + + for (ix = 0; VEC_iterate (property_s, target_desc->properties, ix, prop); + ix++) + if (strcmp (prop->key, key) == 0) + return prop->value; + + return NULL; +} + /* Methods for constructing a target description. */ struct target_desc * @@ -129,3 +156,23 @@ allocate_target_description (void) { return XZALLOC (struct target_desc); } + +void +set_tdesc_property (struct target_desc *target_desc, + const char *key, const char *value) +{ + struct property *prop, new_prop; + int ix; + + gdb_assert (key != NULL && value != NULL); + + for (ix = 0; VEC_iterate (property_s, target_desc->properties, ix, prop); + ix++) + if (strcmp (prop->key, key) == 0) + internal_error (__FILE__, __LINE__, + _("Attempted to add duplicate property \"%s\""), key); + + new_prop.key = key; + new_prop.value = value; + VEC_safe_push (property_s, target_desc->properties, &new_prop); +} |