diff options
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 8 | ||||
-rw-r--r-- | gdb/frame-unwind.c | 1 | ||||
-rw-r--r-- | gdb/frame.c | 21 | ||||
-rw-r--r-- | gdb/frame.h | 6 | ||||
-rw-r--r-- | gdb/testsuite/gdb.dwarf2/dw2-reg-undefined.exp | 4 |
5 files changed, 29 insertions, 11 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index db55c09..699bf6f 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,13 @@ 2021-06-29 Simon Marchi <simon.marchi@polymtl.ca> + * frame.h (FRAME_SCOPED_DEBUG_ENTER_EXIT): New. + * frame.c (compute_frame_id, get_prev_frame_always_1, + get_prev_frame): Use FRAME_SCOPED_DEBUG_ENTER_EXIT. + * frame-unwind.c (frame_unwind_find_by_frame): Likewise. + (frame_unwind_register_value): Likewise. + +2021-06-29 Simon Marchi <simon.marchi@polymtl.ca> + * frame-unwind.h (struct frame_unwind) <name>: New. Update instances everywhere to include this field. * frame-unwind.c (frame_unwind_try_unwinder, diff --git a/gdb/frame-unwind.c b/gdb/frame-unwind.c index 0fef2c1..3dc303a 100644 --- a/gdb/frame-unwind.c +++ b/gdb/frame-unwind.c @@ -178,6 +178,7 @@ frame_unwind_try_unwinder (struct frame_info *this_frame, void **this_cache, void frame_unwind_find_by_frame (struct frame_info *this_frame, void **this_cache) { + FRAME_SCOPED_DEBUG_ENTER_EXIT; frame_debug_printf ("this_frame=%d", frame_relative_level (this_frame)); struct gdbarch *gdbarch = get_frame_arch (this_frame); diff --git a/gdb/frame.c b/gdb/frame.c index 7b45968..3f2d270 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -560,6 +560,8 @@ skip_tailcall_frames (struct frame_info *frame) static void compute_frame_id (struct frame_info *fi) { + FRAME_SCOPED_DEBUG_ENTER_EXIT; + gdb_assert (fi->this_id.p == frame_id_status::NOT_COMPUTED); unsigned int entry_generation = get_frame_cache_generation (); @@ -1215,12 +1217,10 @@ get_frame_register (struct frame_info *frame, struct value * frame_unwind_register_value (frame_info *next_frame, int regnum) { - struct gdbarch *gdbarch; - struct value *value; + FRAME_SCOPED_DEBUG_ENTER_EXIT; gdb_assert (next_frame != NULL); - gdbarch = frame_unwind_arch (next_frame); - + gdbarch *gdbarch = frame_unwind_arch (next_frame); frame_debug_printf ("frame=%d, regnum=%d(%s)", next_frame->level, regnum, user_reg_map_regnum_to_name (gdbarch, regnum)); @@ -1230,9 +1230,9 @@ frame_unwind_register_value (frame_info *next_frame, int regnum) frame_unwind_find_by_frame (next_frame, &next_frame->prologue_cache); /* Ask this frame to unwind its register. */ - value = next_frame->unwind->prev_register (next_frame, - &next_frame->prologue_cache, - regnum); + value *value = next_frame->unwind->prev_register (next_frame, + &next_frame->prologue_cache, + regnum); if (frame_debug) { @@ -2104,10 +2104,9 @@ get_prev_frame_if_no_cycle (struct frame_info *this_frame) static struct frame_info * get_prev_frame_always_1 (struct frame_info *this_frame) { - struct gdbarch *gdbarch; + FRAME_SCOPED_DEBUG_ENTER_EXIT; gdb_assert (this_frame != NULL); - gdbarch = get_frame_arch (this_frame); if (frame_debug) { @@ -2117,6 +2116,8 @@ get_prev_frame_always_1 (struct frame_info *this_frame) frame_debug_printf ("this_frame=nullptr"); } + struct gdbarch *gdbarch = get_frame_arch (this_frame); + /* Only try to do the unwind once. */ if (this_frame->prev_p) { @@ -2419,6 +2420,8 @@ inside_entry_func (frame_info *this_frame) struct frame_info * get_prev_frame (struct frame_info *this_frame) { + FRAME_SCOPED_DEBUG_ENTER_EXIT; + CORE_ADDR frame_pc; int frame_pc_p; diff --git a/gdb/frame.h b/gdb/frame.h index f8314ad..0d2bc08 100644 --- a/gdb/frame.h +++ b/gdb/frame.h @@ -71,6 +71,7 @@ #include "language.h" #include "cli/cli-option.h" +#include "gdbsupport/common-debug.h" struct symtab_and_line; struct frame_unwind; @@ -221,6 +222,11 @@ extern bool frame_debug; #define frame_debug_printf(fmt, ...) \ debug_prefixed_printf_cond (frame_debug, "frame", fmt, ##__VA_ARGS__) +/* Print "frame" enter/exit debug statements. */ + +#define FRAME_SCOPED_DEBUG_ENTER_EXIT \ + scoped_debug_enter_exit (frame_debug, "frame") + /* Construct a frame ID. The first parameter is the frame's constant stack address (typically the outer-bound), and the second the frame's constant code address (typically the entry point). diff --git a/gdb/testsuite/gdb.dwarf2/dw2-reg-undefined.exp b/gdb/testsuite/gdb.dwarf2/dw2-reg-undefined.exp index 2473a41..b1c28b2 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-reg-undefined.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-reg-undefined.exp @@ -79,8 +79,8 @@ for {set f 0} {$f < 3} {incr f} { # "not saved" and not "optimized out". gdb_test "set debug frame 1" gdb_test {print $rax} [multi_line \ - {\[frame\] frame_unwind_register_value: frame=0, regnum=0\(rax\)} \ - {\[frame\] frame_unwind_register_value: -> <not saved>} \ + { \[frame\] frame_unwind_register_value: frame=0, regnum=0\(rax\)} \ + { \[frame\] frame_unwind_register_value: -> <not saved>} \ {.*}] gdb_test "set debug frame 0" |