diff options
author | Andrew Cagney <cagney@redhat.com> | 2002-09-25 20:30:38 +0000 |
---|---|---|
committer | Andrew Cagney <cagney@redhat.com> | 2002-09-25 20:30:38 +0000 |
commit | 7faf367052958a5fbbdfd8545494329761f98597 (patch) | |
tree | 7e260a0eb078e45034a44110af26e08b95420d37 /gdb/frame.c | |
parent | 4c12ab110410720d00b9b526de4c259cc7699165 (diff) | |
download | gdb-7faf367052958a5fbbdfd8545494329761f98597.tar.gz |
2002-09-25 Andrew Cagney <cagney@redhat.com>
* frame.c: Include "gdb_string.h" and "builtin-regs.h".
(frame_map_regnum_to_name): New function.
(frame_map_name_to_regnum): New function.
* frame.h (frame_map_name_to_regnum): Declare.
(frame_map_regnum_to_name): Declare.
* builtin-regs.c (builtin_reg_map_regnum_to_name): New function.
* builtin-regs.h (builtin_reg_map_regnum_to_name): Declare.
* parse.c: Do not include "builtin-regs.h".
(target_map_name_to_register): Delete function.
(write_dollar_variable): Use frame_map_name_to_regnum.
* parser-defs.h (target_map_name_to_register): Delete declaration.
* expprint.c: Include "frame.h".
(print_subexp): Use frame_map_regnum_to_name.
* eval.c (evaluate_subexp_standard): Use frame_map_regnum_to_name.
* infcmd.c (registers_info): Use frame_map_name_to_regnum.
2002-09-25 Andrew Cagney <cagney@redhat.com>
* gdb.base/pc-fp.exp, gdb.base/pc-fp.c: New test.
Diffstat (limited to 'gdb/frame.c')
-rw-r--r-- | gdb/frame.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/gdb/frame.c b/gdb/frame.c index 82754ef1ce5..1ad3b09f3bd 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -27,6 +27,8 @@ #include "inferior.h" /* for inferior_ptid */ #include "regcache.h" #include "gdb_assert.h" +#include "gdb_string.h" +#include "builtin-regs.h" /* Return a frame uniq ID that can be used to, later re-find the frame. */ @@ -233,3 +235,44 @@ frame_register_read (struct frame_info *frame, int regnum, void *myaddr) return !optim; } + + +/* Map between a frame register number and its name. A frame register + space is a superset of the cooked register space --- it also + includes builtin registers. */ + +int +frame_map_name_to_regnum (const char *name, int len) +{ + int i; + + /* Search register name space. */ + for (i = 0; i < NUM_REGS + NUM_PSEUDO_REGS; i++) + if (REGISTER_NAME (i) && len == strlen (REGISTER_NAME (i)) + && strncmp (name, REGISTER_NAME (i), len) == 0) + { + return i; + } + + /* Try builtin registers. */ + i = builtin_reg_map_name_to_regnum (name, len); + if (i >= 0) + { + /* A builtin register doesn't fall into the architecture's + register range. */ + gdb_assert (i >= NUM_REGS + NUM_PSEUDO_REGS); + return i; + } + + return -1; +} + +const char * +frame_map_regnum_to_name (int regnum) +{ + if (regnum < 0) + return NULL; + if (regnum < NUM_REGS + NUM_PSEUDO_REGS) + return REGISTER_NAME (regnum); + return builtin_reg_map_regnum_to_name (regnum); +} |