diff options
author | Ron Unrau <runrau@cygnus> | 1998-02-15 21:30:02 +0000 |
---|---|---|
committer | Ron Unrau <runrau@cygnus> | 1998-02-15 21:30:02 +0000 |
commit | 678fa7ffe38b1ad0df779ed1129c1eae3d8f3c5e (patch) | |
tree | 79a1df2267639ce19f419e3efd9822bdfa7b518d /gdb/parse.c | |
parent | 486c714a2602be686f657933992a4a4fb376041e (diff) | |
download | fsf-binutils-gdb-678fa7ffe38b1ad0df779ed1129c1eae3d8f3c5e.zip fsf-binutils-gdb-678fa7ffe38b1ad0df779ed1129c1eae3d8f3c5e.tar.gz fsf-binutils-gdb-678fa7ffe38b1ad0df779ed1129c1eae3d8f3c5e.tar.bz2 |
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.
Diffstat (limited to 'gdb/parse.c')
-rw-r--r-- | gdb/parse.c | 50 |
1 files changed, 37 insertions, 13 deletions
diff --git a/gdb/parse.c b/gdb/parse.c index 99f0b27..f7f5d1d 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. */ |