diff options
author | Simon Marchi <simon.marchi@polymtl.ca> | 2021-06-29 12:05:03 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@polymtl.ca> | 2021-06-29 12:05:03 -0400 |
commit | a154d838a70e96d888620c072e2d6ea8bdf044ca (patch) | |
tree | e6e92b666415df522f365f6673357193c0e50f12 /gdb/frame-unwind.c | |
parent | a05a883fbaba69d0f80806e46a9457727fcbe74c (diff) | |
download | gdb-a154d838a70e96d888620c072e2d6ea8bdf044ca.zip gdb-a154d838a70e96d888620c072e2d6ea8bdf044ca.tar.gz gdb-a154d838a70e96d888620c072e2d6ea8bdf044ca.tar.bz2 |
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) <name>: 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
Diffstat (limited to 'gdb/frame-unwind.c')
-rw-r--r-- | gdb/frame-unwind.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/gdb/frame-unwind.c b/gdb/frame-unwind.c index b19e95d..0fef2c1 100644 --- a/gdb/frame-unwind.c +++ b/gdb/frame-unwind.c @@ -127,10 +127,13 @@ frame_unwind_try_unwinder (struct frame_info *this_frame, void **this_cache, try { + frame_debug_printf ("trying unwinder \"%s\"", unwinder->name); res = unwinder->sniffer (unwinder, this_frame, this_cache); } catch (const gdb_exception &ex) { + frame_debug_printf ("caught exception: %s", ex.message->c_str ()); + /* Catch all exceptions, caused by either interrupt or error. Reset *THIS_CACHE, unless something reinitialized the frame cache meanwhile, in which case THIS_FRAME/THIS_CACHE are now @@ -153,9 +156,13 @@ frame_unwind_try_unwinder (struct frame_info *this_frame, void **this_cache, } if (res) - return 1; + { + frame_debug_printf ("yes"); + return 1; + } else { + frame_debug_printf ("no"); /* Don't set *THIS_CACHE to NULL here, because sniffer has to do so. */ frame_cleanup_after_sniffer (this_frame); @@ -171,6 +178,8 @@ 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_debug_printf ("this_frame=%d", frame_relative_level (this_frame)); + struct gdbarch *gdbarch = get_frame_arch (this_frame); struct frame_unwind_table *table = (struct frame_unwind_table *) gdbarch_data (gdbarch, frame_unwind_data); |