Hi Serhei, On Thu, 2024-10-17 at 13:13 -0400, Serhei Makarov wrote: > On Thu, Oct 17, 2024, at 1:00 PM, Mark Wielaard wrote: > > This part looks a little iffy IMHO. > > It feels like a layering violation. > > The meaning of DWFL_UNWOUND_INLINE is also different from the others. > > There is no worst/best ordering here. > > They are not connected to frames. > > > > Is there a way to move the printing of this into stack.c? > > For example make print_frame take a decorator argument that is a const > > char * instead of an unwound_source argument. > > Ok, just to be clear that I understand what you want. > > The unwound_source arguments (in print_frame+print_inline_frames) > changed to const char *. The print_frames() function > invokes unwound_source_str() to supply that argument.
I think (but haven't tried) only print_frame has to have a char * argument, print_inline_frames and print_frames can still pass around an Dwfl_Unwound_Source. Both print_frames and print_inline_frames can then call print_frame with the string argument from unwound_source_str (or the static string "inline" in the print_inline_frames case for the "bottom" frame). > struct frame still stores Dwfl_Unwound_Source, not char *. Yep. > In print_inline_frames the print_frame invocation is changed to > > print_frame (..., i > 1 ? "inline" : unwound_source) The second call, yes. But with "inline" : unwound_source_str(unwound_source). The first call to print_frame would just use unwound_source_str(unwound_source) directly. > DWFL_UNWOUND_INLINE removed from the enum, > making the enum a straightforward sequence of unwind methods. > > I can do that. Great. Thanks, Mark