diff options
author | Ulrich Weigand <uweigand@de.ibm.com> | 2007-05-06 19:37:31 +0000 |
---|---|---|
committer | Ulrich Weigand <uweigand@de.ibm.com> | 2007-05-06 19:37:31 +0000 |
commit | 9c5ea4d96566b651eb32f59813b392d5c74b6b65 (patch) | |
tree | 8ee860ed8d4022b9572d6fa126b2e15eb13dcd64 /gdb/regcache.c | |
parent | 316f20603ac3da3e7037cd20fd9580d6d77d71c5 (diff) | |
download | gdb-9c5ea4d96566b651eb32f59813b392d5c74b6b65.zip gdb-9c5ea4d96566b651eb32f59813b392d5c74b6b65.tar.gz gdb-9c5ea4d96566b651eb32f59813b392d5c74b6b65.tar.bz2 |
* regcache.c (regcache_invalidate): New function.
(register_cached): Remove.
(set_register_cached): Remove.
(deprecated_registers_fetched): Remove.
(registers_changed): Use regcache_invalidate instead
of set_register_cached.
(regcache_raw_read): Update comment.
* regcache.h (regcache_invalidate): Add prototype.
(register_cached): Remove.
(set_register_cached): Remove.
(deprecated_registers_fetched): Remove.
* findvar.c (value_of_register): Do not call register_cached.
* frame.c (frame_register): Likewise.
* tui/tui-regs.c (tui_get_register): Likewise.
* remote.c (fetch_register_using_p): Do not call set_register_cached.
(process_g_packet): Likewise.
(remote_fetch_registers): Likewise.
* remote-sim.c (gdbsim_fetch_register): Likewise.
* mt-tdep.c (mt_select_coprocessor): Replace set_register_cached call
by regcache_invalidate.
(mt_pseudo_register_write): Likewise.
* sh-tdep.c (sh_pseudo_register_write): Likewise.
* corelow.c (get_core_registers): Replace deprecated_registers_fetched
call by loop over regcache_raw_supply (..., NULL).
Diffstat (limited to 'gdb/regcache.c')
-rw-r--r-- | gdb/regcache.c | 61 |
1 files changed, 13 insertions, 48 deletions
diff --git a/gdb/regcache.c b/gdb/regcache.c index c54585c..daa412f 100644 --- a/gdb/regcache.c +++ b/gdb/regcache.c @@ -393,6 +393,17 @@ regcache_valid_p (const struct regcache *regcache, int regnum) return regcache->register_valid_p[regnum]; } +void +regcache_invalidate (struct regcache *regcache, int regnum) +{ + gdb_assert (regcache != NULL); + gdb_assert (regnum >= 0); + gdb_assert (!regcache->readonly_p); + gdb_assert (regnum < regcache->descr->nr_raw_registers); + regcache->register_valid_p[regnum] = 0; +} + + /* Global structure containing the current regcache. */ /* FIXME: cagney/2002-05-11: The two global arrays registers[] and deprecated_register_valid[] currently point into this structure. */ @@ -407,33 +418,6 @@ struct regcache *current_regcache; static ptid_t registers_ptid; -/* - * FUNCTIONS: - */ - -/* REGISTER_CACHED() - - Returns 0 if the value is not in the cache (needs fetch). - >0 if the value is in the cache. - <0 if the value is permanently unavailable (don't ask again). */ - -int -register_cached (int regnum) -{ - return current_regcache->register_valid_p[regnum]; -} - -/* Record that REGNUM's value is cached if STATE is >0, uncached but - fetchable if STATE is 0, and uncached and unfetchable if STATE is <0. */ - -void -set_register_cached (int regnum, int state) -{ - gdb_assert (regnum >= 0); - gdb_assert (regnum < current_regcache->descr->nr_raw_registers); - current_regcache->register_valid_p[regnum] = state; -} - /* Observer for the target_changed event. */ void @@ -468,28 +452,9 @@ registers_changed (void) alloca (0); for (i = 0; i < current_regcache->descr->nr_raw_registers; i++) - set_register_cached (i, 0); + regcache_invalidate (current_regcache, i); } -/* DEPRECATED_REGISTERS_FETCHED () - - Indicate that all registers have been fetched, so mark them all valid. */ - -/* FIXME: cagney/2001-12-04: This function is DEPRECATED. The target - code was blatting the registers[] array and then calling this. - Since targets should only be using regcache_raw_supply() the need for - this function/hack is eliminated. */ - -void -deprecated_registers_fetched (void) -{ - int i; - - for (i = 0; i < NUM_REGS; i++) - set_register_cached (i, 1); - /* Do not assume that the pseudo-regs have also been fetched. - Fetching all real regs NEVER accounts for pseudo-regs. */ -} void regcache_raw_read (struct regcache *regcache, int regnum, gdb_byte *buf) @@ -517,7 +482,7 @@ regcache_raw_read (struct regcache *regcache, int regnum, gdb_byte *buf) that a register is in one of the possible states: valid, undefined, unknown. The last of which isn't yet possible. */ - gdb_assert (register_cached (regnum)); + gdb_assert (regcache_valid_p (regcache, regnum)); #endif } /* Copy the value directly into the register cache. */ |