unwind non-PC registers using elfutils

Mark Wielaard mark@klomp.org
Wed Nov 10 14:09:04 GMT 2021


Hi Jacob,

On Sun, 2021-10-03 at 09:38 -0700, Jacob Burkholder via Elfutils-devel wrote:
> Hi, I'm trying to figure out how to unwind registers other than the PC
> using elfutils.  I can use dwfl_module_register_names to get the register
> names, and then I'm trying to use dwarf_frame_register to get the register
> values for a given frame.  I looked at the code in __libdwfl_frame_unwind
> and there's another example in addrcfi.c.   dwarf_frame_register seems
> quite a low level dwarf API, I'm not sure how to use the ops that are
> returned, also the code used by __libdwfl_frame_unwind to evaluate the ops
> is all static or internal so not callable.  Any guidance?  Do I need to
> basically interpret the dwarf atoms in the ops returned by
> dwarf_frame_register?  Any plans to make code like
> frame_unwind.c:expr_eval() used by frame_unwind.c:handle_cfi externally
> accessible?

Sorry for the late reply. I missed this message earlier. As you
correctly observe the public API only supports unwinding of threads for
backtraces with just the PC. Internally most of the logic of unwinding
other registers is there, but we don't have a public API for it. We
really should. I filed:
https://sourceware.org/bugzilla/show_bug.cgi?id=28579

Could you add some requirements there?
The hard part is making sure the interface is actually useful.
What information do you have and what information do you want to get
out?

Thanks,

Mark


More information about the Elfutils-devel mailing list