diff options
author | Andrew Cagney <cagney@redhat.com> | 2003-06-07 16:23:12 +0000 |
---|---|---|
committer | Andrew Cagney <cagney@redhat.com> | 2003-06-07 16:23:12 +0000 |
commit | cde9ea48081fcfec378c5b6e22e3d4b41fa3e2ad (patch) | |
tree | 24e4d2d6b34cd315e91db8e9b382e74eb279a1aa /gdb/regcache.c | |
parent | 9a90a78063be817c7fa1b4548ca8fd4c7ca8e843 (diff) | |
download | gdb-cde9ea48081fcfec378c5b6e22e3d4b41fa3e2ad.zip gdb-cde9ea48081fcfec378c5b6e22e3d4b41fa3e2ad.tar.gz gdb-cde9ea48081fcfec378c5b6e22e3d4b41fa3e2ad.tar.bz2 |
2003-06-07 Andrew Cagney <cagney@redhat.com>
* gdbarch.sh (TARGET_READ_PC): Add predicate, remove default.
* gdbarch.h, gdbarch.c: Re-generate.
* regcache.c: Update comments on read_pc et.al.
(generic_target_read_pc): Delete function.
(read_pc_pid): Try TARGET_READ_PC and PC_REGNUM for a PC register.
* inferior.h (generic_target_read_pc): Delete declaration.
* frv-tdep.c (frv_gdbarch_init): Do not set read_pc to
generic_target_read_pc.
* sparc-tdep.c (sparc_gdbarch_init): Ditto.
* sh-tdep.c (sh_gdbarch_init): Ditto.
* rs6000-tdep.c (rs6000_gdbarch_init): Ditto.
* m68hc11-tdep.c (m68hc11_gdbarch_init): Ditto.
Diffstat (limited to 'gdb/regcache.c')
-rw-r--r-- | gdb/regcache.c | 61 |
1 files changed, 26 insertions, 35 deletions
diff --git a/gdb/regcache.c b/gdb/regcache.c index 09b48f0..6493fbb 100644 --- a/gdb/regcache.c +++ b/gdb/regcache.c @@ -1267,41 +1267,22 @@ regcache_collect (int regnum, void *buf) /* read_pc, write_pc, read_sp, deprecated_read_fp, etc. Special handling for registers PC, SP, and FP. */ -/* NOTE: cagney/2001-02-18: The functions generic_target_read_pc(), - read_pc_pid(), read_pc(), generic_target_write_pc(), - write_pc_pid(), write_pc(), generic_target_read_sp(), read_sp(), - generic_target_write_sp(), and deprecated_read_fp(), will - eventually be moved out of the reg-cache into either frame.[hc] or - to the multi-arch framework. The are not part of the raw register - cache. */ - -/* This routine is getting awfully cluttered with #if's. It's probably - time to turn this into READ_PC and define it in the tm.h file. - Ditto for write_pc. - - 1999-06-08: The following were re-written so that it assumes the - existence of a TARGET_READ_PC et.al. macro. A default generic - version of that macro is made available where needed. - - Since the ``TARGET_READ_PC'' et.al. macro is going to be controlled - by the multi-arch framework, it will eventually be possible to - eliminate the intermediate read_pc_pid(). The client would call - TARGET_READ_PC directly. (cagney). */ +/* NOTE: cagney/2001-02-18: The functions read_pc_pid(), read_pc(), + read_sp(), and deprecated_read_fp(), will eventually be replaced by + per-frame methods. Instead of relying on the global INFERIOR_PTID, + they will use the contextual information provided by the FRAME. + These functions do not belong in the register cache. */ -CORE_ADDR -generic_target_read_pc (ptid_t ptid) -{ -#ifdef PC_REGNUM - if (PC_REGNUM >= 0) - { - CORE_ADDR pc_val = ADDR_BITS_REMOVE ((CORE_ADDR) read_register_pid (PC_REGNUM, ptid)); - return pc_val; - } -#endif - internal_error (__FILE__, __LINE__, - "generic_target_read_pc"); - return 0; -} +/* NOTE: cagney/2003-06-07: The function generic_target_read_sp() + should be deleted. */ + +/* NOTE: cagney/2003-06-07: The function generic_target_write_sp() + should be deleted. */ + +/* NOTE: cagney/2003-06-07: The functions generic_target_write_pc(), + write_pc_pid(), write_pc(), and deprecated_read_fp(), all need to + be replaced by something that does not rely on global state. But + what? */ CORE_ADDR read_pc_pid (ptid_t ptid) @@ -1313,7 +1294,17 @@ read_pc_pid (ptid_t ptid) saved_inferior_ptid = inferior_ptid; inferior_ptid = ptid; - pc_val = TARGET_READ_PC (ptid); + if (TARGET_READ_PC_P ()) + pc_val = TARGET_READ_PC (ptid); + /* Else use per-frame method on get_current_frame. */ + else if (PC_REGNUM >= 0) + { + CORE_ADDR raw_val = read_register_pid (PC_REGNUM, ptid); + CORE_ADDR pc_val = ADDR_BITS_REMOVE (raw_val); + return pc_val; + } + else + internal_error (__FILE__, __LINE__, "read_pc_pid: Unable to find PC"); inferior_ptid = saved_inferior_ptid; return pc_val; |