aboutsummaryrefslogtreecommitdiff
path: root/gdb/regcache.c
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2011-03-24 11:22:03 +0000
committerPedro Alves <palves@redhat.com>2011-03-24 11:22:03 +0000
commit788c8b10e36cc1f18faae28c743d7c3d029608c2 (patch)
treedf79517e26fa9f47cca7fddefc589db8cbf0ca59 /gdb/regcache.c
parent29b2c556d2655b11483d07468d1eaf2dff1395ce (diff)
downloadgdb-788c8b10e36cc1f18faae28c743d7c3d029608c2.zip
gdb-788c8b10e36cc1f18faae28c743d7c3d029608c2.tar.gz
gdb-788c8b10e36cc1f18faae28c743d7c3d029608c2.tar.bz2
* regcache.c (regcache_raw_read): If the target didn't supply a
given raw register, mark it as unavailable.
Diffstat (limited to 'gdb/regcache.c')
-rw-r--r--gdb/regcache.c29
1 files changed, 12 insertions, 17 deletions
diff --git a/gdb/regcache.c b/gdb/regcache.c
index b984bc1..fbdeccc 100644
--- a/gdb/regcache.c
+++ b/gdb/regcache.c
@@ -586,25 +586,20 @@ regcache_raw_read (struct regcache *regcache, int regnum, gdb_byte *buf)
to the current thread. This switching shouldn't be necessary
only there is still only one target side register cache. Sigh!
On the bright side, at least there is a regcache object. */
- if (!regcache->readonly_p)
+ if (!regcache->readonly_p
+ && regcache_register_status (regcache, regnum) == REG_UNKNOWN)
{
- if (regcache_register_status (regcache, regnum) == REG_UNKNOWN)
- {
- struct cleanup *old_chain = save_inferior_ptid ();
+ struct cleanup *old_chain = save_inferior_ptid ();
- inferior_ptid = regcache->ptid;
- target_fetch_registers (regcache, regnum);
- do_cleanups (old_chain);
- }
-#if 0
- /* FIXME: cagney/2004-08-07: At present a number of targets
- forget (or didn't know that they needed) to set this leading to
- panics. Also is the problem that targets need to indicate
- that a register is in one of the possible states: valid,
- undefined, unknown. The last of which isn't yet
- possible. */
- gdb_assert (regcache_register_status (regcache, regnum) == REG_VALID);
-#endif
+ inferior_ptid = regcache->ptid;
+ target_fetch_registers (regcache, regnum);
+ do_cleanups (old_chain);
+
+ /* A number of targets can't access the whole set of raw
+ registers (because the debug API provides no means to get at
+ them). */
+ if (regcache->register_status[regnum] == REG_UNKNOWN)
+ regcache->register_status[regnum] = REG_UNAVAILABLE;
}
if (regcache->register_status[regnum] != REG_VALID)