summaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2003-12-06 22:58:27 +0000
committerAndrew Cagney <cagney@redhat.com>2003-12-06 22:58:27 +0000
commit5f947da1c201d62d872ffaea81cd7733ea5fae92 (patch)
treecf91438b07eef54b36429ae722a88a66d69c4173 /gdb
parent8bcaed292a794c807986194ce7ff02cca9625752 (diff)
downloadgdb-5f947da1c201d62d872ffaea81cd7733ea5fae92.tar.gz
2003-12-06 Andrew Cagney <cagney@redhat.com>
* remote.c (remote_fetch_registers): For short packets, explicitly supply a zero value. Use regcache_raw_supply. Fix suggested by Jonathan Larmour.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/remote.c20
2 files changed, 23 insertions, 3 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 1e747bc26c1..c1d9b4e552f 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+2003-12-06 Andrew Cagney <cagney@redhat.com>
+
+ * remote.c (remote_fetch_registers): For short packets, explicitly
+ supply a zero value. Use regcache_raw_supply. Fix suggested by
+ Jonathan Larmour.
+
2003-12-05 Jeff Johnston <jjohnstn@redhat.com>
* ia64-tdep.c (ia64_gdbarch_init): Set up the gdbarch long double
diff --git a/gdb/remote.c b/gdb/remote.c
index d6df76adb91..e44b932d9c0 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -3558,9 +3558,23 @@ remote_fetch_registers (int regnum)
struct packet_reg *r = &rs->regs[i];
if (r->in_g_packet)
{
- supply_register (r->regnum, regs + r->offset);
- if (buf[r->offset * 2] == 'x')
- set_register_cached (i, -1);
+ if (r->offset * 2 >= strlen (buf))
+ /* A short packet that didn't include the register's
+ value, this implies that the register is zero (and
+ not that the register is unavailable). Supply that
+ zero value. */
+ regcache_raw_supply (current_regcache, r->regnum, NULL);
+ else if (buf[r->offset * 2] == 'x')
+ {
+ gdb_assert (r->offset * 2 < strlen (buf));
+ /* The register isn't available, mark it as such (at
+ the same time setting the value to zero). */
+ regcache_raw_supply (current_regcache, r->regnum, NULL);
+ set_register_cached (i, -1);
+ }
+ else
+ regcache_raw_supply (current_regcache, r->regnum,
+ regs + r->offset);
}
}
}