2003-12-04 Andrew Cagney * remote.c (remote_fetch_registers): For short packets, explicitly supply a zero value. Use regcache_raw_supply. Fix suggested by Jonathan Larmour. Index: remote.c =================================================================== RCS file: /cvs/src/src/gdb/remote.c,v retrieving revision 1.122 diff -u -r1.122 remote.c --- remote.c 10 Nov 2003 21:20:44 -0000 1.122 +++ remote.c 4 Dec 2003 15:05:49 -0000 @@ -3558,9 +3558,23 @@ 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); } } }