- gdb_assert (priv->registers);
- value = priv->registers[reg];
- if (value && value->defined)
- return frame_unwind_got_bytes (this_frame, reg, value->value);
+ gdbarch = get_regcache_arch (priv->regcache);
+ if (reg < gdbarch_num_regs (gdbarch))
+ {
+ gdb_byte *buf = (gdb_byte *) alloca (register_size (gdbarch, reg));
+ enum register_status status;
+
+ status = regcache_raw_read (priv->regcache, reg, buf);
+ if (status == REG_VALID)
+ return frame_unwind_got_bytes (this_frame, reg, buf);
+ else
+ return frame_unwind_got_optimized (this_frame, reg);
+ }