From: Omar Sandoval <osan...@fb.com> Hello,
While using the libdwfl stack unwinding interface for my debugger [1], I found that it works great for getting the program counter at each stack frame, but it's hard to do anything beyond that. This is an attempt to expand the functionality by adding two main features: attaching to/detaching from threads at will, and evaluating DWARF expressions. This functionality already exists within libdwfl, so it's just a matter of defining the interface. Patches 1 and 2 are cleanups in preparation for the rest of the series. Patch 3 adds dwfl_attach_thread and dwfl_detach_thread so that it's possible to attach to threads at will and save stack frames so that they can be inspected later. Patch 4 adds dwfl_frame_module and dwfl_frame_dwarf_frame to avoid redundant lookups internally and in clients of libdwfl. Patch 5 adds dwfl_frame_eval_expr for evaluating DWARF expressions in the context of a stack frame. Please let me know what you think. Thanks! 1: https://drgn.readthedocs.io/en/latest/ Omar Sandoval (5): libdwfl: don't bother freeing frames outside of dwfl_thread_getframes libdwfl: only use thread->unwound for initial frame libdwfl: add interface for attaching to/detaching from threads libdwfl: cache Dwfl_Module and Dwarf_Frame for Dwfl_Frame libdwfl: add interface for evaluating DWARF expressions in a frame libdw/ChangeLog | 9 ++ libdw/libdw.map | 8 ++ libdwfl/ChangeLog | 31 +++++++ libdwfl/dwfl_frame.c | 190 ++++++++++++++++++++++++----------------- libdwfl/frame_unwind.c | 37 +++++++- libdwfl/libdwfl.h | 28 ++++++ libdwfl/libdwflP.h | 9 +- 7 files changed, 228 insertions(+), 84 deletions(-) -- 2.23.0