diff options
Diffstat (limited to 'gdb/findvar.c')
-rw-r--r-- | gdb/findvar.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/gdb/findvar.c b/gdb/findvar.c index 6463342..809a99e 100644 --- a/gdb/findvar.c +++ b/gdb/findvar.c @@ -265,6 +265,7 @@ value_of_register (int regnum, struct frame_info *frame) struct gdbarch *gdbarch = get_frame_arch (frame); CORE_ADDR addr; int optim; + int unavail; struct value *reg_val; int realnum; gdb_byte raw_buffer[MAX_REGISTER_SIZE]; @@ -276,16 +277,24 @@ value_of_register (int regnum, struct frame_info *frame) + gdbarch_num_pseudo_regs (gdbarch)) return value_of_user_reg (regnum, frame); - frame_register (frame, regnum, &optim, &lval, &addr, &realnum, raw_buffer); + frame_register (frame, regnum, &optim, &unavail, + &lval, &addr, &realnum, raw_buffer); reg_val = allocate_value (register_type (gdbarch, regnum)); - memcpy (value_contents_raw (reg_val), raw_buffer, - register_size (gdbarch, regnum)); + if (!optim && !unavail) + memcpy (value_contents_raw (reg_val), raw_buffer, + register_size (gdbarch, regnum)); + else + memset (value_contents_raw (reg_val), 0, + register_size (gdbarch, regnum)); + VALUE_LVAL (reg_val) = lval; set_value_address (reg_val, addr); VALUE_REGNUM (reg_val) = regnum; set_value_optimized_out (reg_val, optim); + if (unavail) + mark_value_bytes_unavailable (reg_val, 0, register_size (gdbarch, regnum)); VALUE_FRAME_ID (reg_val) = get_frame_id (frame); return reg_val; } |