+2013-07-04 Pedro Alves <palves@redhat.com>
+
+ * findvar.c (value_of_register): Use allocate_optimized_out_value
+ if the register has been optimized out, instead of
+ set_value_optimized_out.
+ * frame-unwind.c (frame_unwind_got_optimized): Use
+ allocate_optimized_out_value.
+
2013-07-04 Pedro Alves <palves@redhat.com>
* value.c (value_bits_valid): If the value is not lval_computed,
int optim;
int unavail;
struct value *reg_val;
+ struct type *reg_type;
int realnum;
gdb_byte raw_buffer[MAX_REGISTER_SIZE];
enum lval_type lval;
frame_register (frame, regnum, &optim, &unavail,
&lval, &addr, &realnum, raw_buffer);
- reg_val = allocate_value (register_type (gdbarch, regnum));
+ reg_type = register_type (gdbarch, regnum);
+ if (optim)
+ reg_val = allocate_optimized_out_value (reg_type);
+ else
+ reg_val = allocate_value (reg_type);
if (!optim && !unavail)
memcpy (value_contents_raw (reg_val), raw_buffer,
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);
frame_unwind_got_optimized (struct frame_info *frame, int regnum)
{
struct gdbarch *gdbarch = frame_unwind_arch (frame);
- struct value *reg_val;
+ struct type *reg_type = register_type (gdbarch, regnum);
- reg_val = value_zero (register_type (gdbarch, regnum), not_lval);
- set_value_optimized_out (reg_val, 1);
- return reg_val;
+ return allocate_optimized_out_value (reg_type);
}
/* Return a value which indicates that FRAME copied REGNUM into