diff options
author | Pedro Alves <palves@redhat.com> | 2013-07-04 18:10:04 +0000 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2013-07-04 18:10:04 +0000 |
commit | 7195e6f018c7928c8b7be37e56b4df2656402618 (patch) | |
tree | b36ae6e79a2341a4e324110fe8b46527be55361e /gdb | |
parent | 58722cac5aa9ea0b18a8fe5e76031f62cea017bc (diff) | |
download | gdb-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')
-rw-r--r-- | gdb/ChangeLog | 8 | ||||
-rw-r--r-- | gdb/findvar.c | 8 | ||||
-rw-r--r-- | gdb/frame-unwind.c | 6 |
3 files changed, 16 insertions, 6 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 2353e71..eb0eb4b 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,13 @@ 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, or doesn't have a check_validity hook, assume the value is entirely valid. 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); diff --git a/gdb/frame-unwind.c b/gdb/frame-unwind.c index b66febf..ce2f6da 100644 --- a/gdb/frame-unwind.c +++ b/gdb/frame-unwind.c @@ -162,11 +162,9 @@ struct value * 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 |