From a154d838a70e96d888620c072e2d6ea8bdf044ca Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Tue, 29 Jun 2021 12:05:03 -0400 Subject: gdb: add names to unwinders, add debug messages when looking for unwinder I wrote this while debugging a problem where the expected unwinder for a frame wasn't used. It adds messages to show which unwinders are considered for a frame, why they are not selected (if an exception is thrown), and finally which unwinder is selected in the end. To be able to show a meaningful, human-readable name for the unwinders, add a "name" field to struct frame_unwind, and update all instances to include a name. Here's an example of the output: [frame] frame_unwind_find_by_frame: this_frame=0 [frame] frame_unwind_try_unwinder: trying unwinder "dummy" [frame] frame_unwind_try_unwinder: no [frame] frame_unwind_try_unwinder: trying unwinder "dwarf2 tailcall" [frame] frame_unwind_try_unwinder: no [frame] frame_unwind_try_unwinder: trying unwinder "inline" [frame] frame_unwind_try_unwinder: no [frame] frame_unwind_try_unwinder: trying unwinder "jit" [frame] frame_unwind_try_unwinder: no [frame] frame_unwind_try_unwinder: trying unwinder "python" [frame] frame_unwind_try_unwinder: no [frame] frame_unwind_try_unwinder: trying unwinder "amd64 epilogue" [frame] frame_unwind_try_unwinder: no [frame] frame_unwind_try_unwinder: trying unwinder "i386 epilogue" [frame] frame_unwind_try_unwinder: no [frame] frame_unwind_try_unwinder: trying unwinder "dwarf2" [frame] frame_unwind_try_unwinder: yes gdb/ChangeLog: * frame-unwind.h (struct frame_unwind) : New. Update instances everywhere to include this field. * frame-unwind.c (frame_unwind_try_unwinder, frame_unwind_find_by_frame): Add debug messages. Change-Id: I813f17777422425f0d08b22499817b23922e8ddb --- gdb/amd64-tdep.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'gdb/amd64-tdep.c') diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c index 3afac3c..c028e1b 100644 --- a/gdb/amd64-tdep.c +++ b/gdb/amd64-tdep.c @@ -2702,6 +2702,7 @@ amd64_frame_prev_register (struct frame_info *this_frame, void **this_cache, static const struct frame_unwind amd64_frame_unwind = { + "amd64 prologue", NORMAL_FRAME, amd64_frame_unwind_stop_reason, amd64_frame_this_id, @@ -2846,6 +2847,7 @@ amd64_sigtramp_frame_sniffer (const struct frame_unwind *self, static const struct frame_unwind amd64_sigtramp_frame_unwind = { + "amd64 sigtramp", SIGTRAMP_FRAME, amd64_sigtramp_frame_unwind_stop_reason, amd64_sigtramp_frame_this_id, @@ -2981,6 +2983,7 @@ amd64_epilogue_frame_this_id (struct frame_info *this_frame, static const struct frame_unwind amd64_epilogue_frame_unwind = { + "amd64 epilogue", NORMAL_FRAME, amd64_epilogue_frame_unwind_stop_reason, amd64_epilogue_frame_this_id, -- cgit v1.1