2003-12-06 Andrew Cagney <cagney@redhat.com>
authorAndrew Cagney <cagney@redhat.com>
Sat, 6 Dec 2003 22:58:27 +0000 (22:58 +0000)
committerAndrew Cagney <cagney@redhat.com>
Sat, 6 Dec 2003 22:58:27 +0000 (22:58 +0000)
* remote.c (remote_fetch_registers): For short packets, explicitly
supply a zero value.  Use regcache_raw_supply.  Fix suggested by
Jonathan Larmour.

gdb/ChangeLog
gdb/remote.c

index 1e747bc26c1eeaa7566a1c3f12af0e35dc012813..c1d9b4e552f70d89d53b9138a5a31b98947a6f69 100644 (file)
@@ -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
index d6df76adb91f702dd9cde9bc26b535f16ff2d6ad..e44b932d9c07714da6548048d8ab853ed7e17476 100644 (file)
@@ -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);
          }
       }
   }
This page took 0.044477 seconds and 4 git commands to generate.