aboutsummaryrefslogtreecommitdiff
path: root/gdb/findvar.c
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2013-07-04 18:10:04 +0000
committerPedro Alves <palves@redhat.com>2013-07-04 18:10:04 +0000
commit7195e6f018c7928c8b7be37e56b4df2656402618 (patch)
treeb36ae6e79a2341a4e324110fe8b46527be55361e /gdb/findvar.c
parent58722cac5aa9ea0b18a8fe5e76031f62cea017bc (diff)
downloadgdb-7195e6f018c7928c8b7be37e56b4df2656402618.zip
gdb-7195e6f018c7928c8b7be37e56b4df2656402618.tar.gz
gdb-7195e6f018c7928c8b7be37e56b4df2656402618.tar.bz2
Use allocate_optimized_out_value instead of set_value_optimized_out.
Allocate the value as optimized out from the start rather than allocating a value with contents, and then marking it optimized out. gdb/ 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.
Diffstat (limited to 'gdb/findvar.c')
-rw-r--r--gdb/findvar.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/gdb/findvar.c b/gdb/findvar.c
index fdce436..f586ce2 100644
--- a/gdb/findvar.c
+++ b/gdb/findvar.c
@@ -266,6 +266,7 @@ value_of_register (int regnum, struct frame_info *frame)
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;
@@ -279,7 +280,11 @@ value_of_register (int regnum, struct frame_info *frame)
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,
@@ -291,7 +296,6 @@ value_of_register (int regnum, struct frame_info *frame)
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);