From 678fa7ffe38b1ad0df779ed1129c1eae3d8f3c5e Mon Sep 17 00:00:00 2001 From: Ron Unrau Date: Sun, 15 Feb 1998 21:30:02 +0000 Subject: [PATCH] parse.c (write_dollar_variable): call new function target_map_name_to_register so that targets can define their own register name aliases. infcmd.c (registers_info): call target_map_name_to_register so that "print $reg" and "info reg $reg" share the same register alias set. mips-tdep.c: separate MIPS_R5900_REGS from NUM_REGS so that sky registers can be printed separately. txvu-tdep.c: print registers according to current CPU context. tm-txvu.h: define SKY registers and conditionalize register interpretation macros. txvu.mt: Don't bother building remote-mips.o for sky target. --- gdb/ChangeLog | 8 ++++++++ gdb/parse.c | 50 +++++++++++++++++++++++++++++++++++++------------- 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 + + * 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 * 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. */ -- 2.30.2