[PATCH 4/5] libdwfl: cache Dwfl_Module and Dwarf_Frame for Dwfl_Frame

Mark Wielaard mark@klomp.org
Wed Oct 30 13:04:00 GMT 2019

Hi Omar,

On Mon, 2019-10-07 at 02:05 -0700, Omar Sandoval wrote:
> The next change will need to have the Dwarf_Frame readily available, so
> rather than finding it again every time, let's cache it for reuse. The
> CFI frame can also be useful to clients of libdwfl, so add
> dwfl_frame_dwarf_frame to get it. Similarly, the Dwfl_Module is also
> frequently needed in conjunction with the frame, so cache it and add
> dwfl_frame_module.

I can see how this is useful. But it seems the Dwarf_Frame is only
cached when __libdwfl_frame_unwind is called. Which I believe isn't
done for the initial frame. Also it isn't clear how to propagate any
errors when NULL is returned. Maybe dwfl_frame_dwarf_frame () should
check first to see if frame is NULL and then call lookup the CFI and
call dwarf_cfi_addrframe if not?



More information about the Elfutils-devel mailing list