diff options
author | Andrew Cagney <cagney@redhat.com> | 2003-12-06 22:58:27 +0000 |
---|---|---|
committer | Andrew Cagney <cagney@redhat.com> | 2003-12-06 22:58:27 +0000 |
commit | 8ccc1287392468cb4832ecc94c9446a64224563e (patch) | |
tree | 96c0ccd4bbd7d6cd23dcebc2e142ffc3bba4a37f /gdb/remote.c | |
parent | 5266b69c16cec86dc13f343aaccd481db29e78da (diff) | |
download | gdb-8ccc1287392468cb4832ecc94c9446a64224563e.zip gdb-8ccc1287392468cb4832ecc94c9446a64224563e.tar.gz gdb-8ccc1287392468cb4832ecc94c9446a64224563e.tar.bz2 |
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/remote.c')
-rw-r--r-- | gdb/remote.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/gdb/remote.c b/gdb/remote.c index d6df76a..e44b932 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); } } } |