diff options
-rw-r--r-- | gdb/ChangeLog | 7 | ||||
-rw-r--r-- | gdb/frame-unwind.c | 14 | ||||
-rw-r--r-- | gdb/frame-unwind.h | 3 | ||||
-rw-r--r-- | gdb/frame.c | 2 | ||||
-rw-r--r-- | gdb/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/testsuite/gdb.dwarf2/dw2-reg-undefined.exp | 12 |
6 files changed, 31 insertions, 13 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 8cb475d..a982d91 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,12 @@ 2020-08-31 Simon Marchi <simon.marchi@efficios.com> + * frame-unwind.c (frame_unwind_got_optimized): Don't set + regnum/frame in value. Call allocate_value_lazy. + * frame.c (frame_unwind_register_value): Use + val_print_not_saved. + +2020-08-31 Simon Marchi <simon.marchi@efficios.com> + * gdbtypes.h (NULL_TYPE): Remove, change all uses to nullptr. 2020-08-29 Pedro Alves <pedro@palves.net> diff --git a/gdb/frame-unwind.c b/gdb/frame-unwind.c index 064f6eb..32124c5 100644 --- a/gdb/frame-unwind.c +++ b/gdb/frame-unwind.c @@ -251,18 +251,8 @@ frame_unwind_got_optimized (struct frame_info *frame, int regnum) { struct gdbarch *gdbarch = frame_unwind_arch (frame); struct type *type = register_type (gdbarch, regnum); - struct value *val; - - /* Return an lval_register value, so that we print it as - "<not saved>". */ - val = allocate_value_lazy (type); - set_value_lazy (val, 0); - mark_value_bytes_optimized_out (val, 0, TYPE_LENGTH (type)); - VALUE_LVAL (val) = lval_register; - VALUE_REGNUM (val) = regnum; - VALUE_NEXT_FRAME_ID (val) - = get_frame_id (get_next_frame_sentinel_okay (frame)); - return val; + + return allocate_optimized_out_value (type); } /* Return a value which indicates that FRAME copied REGNUM into diff --git a/gdb/frame-unwind.h b/gdb/frame-unwind.h index c80ddc8..25a601c 100644 --- a/gdb/frame-unwind.h +++ b/gdb/frame-unwind.h @@ -133,6 +133,9 @@ typedef void (frame_this_id_ftype) (struct frame_info *this_frame, may be a lazy reference to memory, a lazy reference to the value of a register in THIS frame, or a non-lvalue. + If the previous frame's register was not saved by THIS_FRAME and is + therefore undefined, return a not_lval wholly optimized-out value. + THIS_PROLOGUE_CACHE can be used to share any prolog analysis data with the other unwind methods. Memory for that cache should be allocated using FRAME_OBSTACK_ZALLOC(). */ diff --git a/gdb/frame.c b/gdb/frame.c index 7ab3cdc..ccaf97d 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -1295,7 +1295,7 @@ frame_unwind_register_value (frame_info *next_frame, int regnum) if (value_optimized_out (value)) { fprintf_unfiltered (gdb_stdlog, " "); - val_print_optimized_out (value, gdb_stdlog); + val_print_not_saved (gdb_stdlog); } else { diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 24da6ad..db0296d 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2020-08-31 Simon Marchi <simon.marchi@efficios.com> + + * gdb.dwarf2/dw2-reg-undefined.exp: Test "set debug frame 1" + output, printing a "not saved" value from history and printing a + convenience variable created from a "not saved" value. + 2020-08-31 Tom de Vries <tdevries@suse.de> * gdb.base/eh_return.exp: Use nopie. diff --git a/gdb/testsuite/gdb.dwarf2/dw2-reg-undefined.exp b/gdb/testsuite/gdb.dwarf2/dw2-reg-undefined.exp index a3e6f28..4ab7e2db 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-reg-undefined.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-reg-undefined.exp @@ -74,3 +74,15 @@ for {set f 0} {$f < 3} {incr f} { "r9\\s+${pattern_r8_r9_info}\\s*"] \ "Check values of rax, rbx, rcx, r8, r9 in frame ${f}" } + +# Test that the debug log statement in frame_unwind_register_value produces +# "not saved" and not# "optimized out". +gdb_test "set debug frame 1" +gdb_test {print $rax} {frame_unwind_register_value[^\r\n]+rax[^\r\n]+not saved.*} +gdb_test "set debug frame 0" + +# Test that history values show "not saved" and not "optimized out". +gdb_test "print" " = <not saved>" + +# Test that convenience variables _don't_ show "not saved". +gdb_test {print $foo = $rax} " = <optimized out>" |