summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog8
-rw-r--r--gdb/parse.c50
2 files changed, 45 insertions, 13 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 6acd36ad32b..5cdb1e91a90 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,11 @@
+Sun Feb 15 16:10:50 1998 Ron Unrau <runrau@cygnus.com>
+
+ * parse.c (write_dollar_variable): call new function
+ target_map_name_to_register to allow targets to define their own
+ register name aliases.
+ * infcmd.c (registers_info): use target_map_name_to_register so that
+ "print $reg" and "info reg $reg" use the same register name aliases.
+
Fri Feb 13 16:40:30 1998 Stan Shebs <shebs@andros.cygnus.com>
* config/i386/i386mk.mt (OBJFORMATS): Delete, no longer used.
diff --git a/gdb/parse.c b/gdb/parse.c
index 99f0b2719a6..f7f5d1d71b7 100644
--- a/gdb/parse.c
+++ b/gdb/parse.c
@@ -101,6 +101,40 @@ unsigned num_std_regs = (sizeof std_regs / sizeof std_regs[0]);
#endif
+/* The generic method for targets to specify how their registers are named.
+ The mapping can be derived from three sources: reg_names; std_regs; or
+ a target specific alias hook. */
+
+int
+target_map_name_to_register (str, len)
+ char *str;
+ int len;
+{
+ int i;
+
+ /* First search architectural register name space. */
+ for (i = 0; i < NUM_REGS; i++)
+ if (reg_names[i] && len == strlen (reg_names[i])
+ && STREQN (str, reg_names[i], len))
+ {
+ return i;
+ }
+
+ /* Try standard aliases */
+ for (i = 0; i < num_std_regs; i++)
+ if (std_regs[i].name && len == strlen (std_regs[i].name)
+ && STREQN (str, std_regs[i].name, len))
+ {
+ return std_regs[i].regnum;
+ }
+
+ /* Try target specific aliases */
+#ifdef REGISTER_NAME_ALIAS_HOOK
+ return REGISTER_NAME_ALIAS_HOOK (str, len);
+#endif
+
+ return -1;
+}
/* Begin counting arguments for a function call,
saving the data about any containing call. */
@@ -455,19 +489,9 @@ write_dollar_variable (str)
/* Handle tokens that refer to machine registers:
$ followed by a register name. */
- for (i = 0; i < NUM_REGS; i++)
- if (reg_names[i] && str.length - 1 == strlen (reg_names[i])
- && STREQN (str.ptr + 1, reg_names[i], str.length - 1))
- {
- goto handle_register;
- }
- for (i = 0; i < num_std_regs; i++)
- if (std_regs[i].name && str.length - 1 == strlen (std_regs[i].name)
- && STREQN (str.ptr + 1, std_regs[i].name, str.length - 1))
- {
- i = std_regs[i].regnum;
- goto handle_register;
- }
+ i = target_map_name_to_register( str.ptr + 1, str.length - 1 );
+ if( i >= 0 )
+ goto handle_register;
/* Any other names starting in $ are debugger internal variables. */