On Wed, Mar 19, 2025, at 5:36 PM, Mark Wielaard wrote:
> Hi Serhei,
>
> On Sun, Mar 16, 2025 at 07:14:11PM -0400, Serhei Makarov wrote:
>> Since libebl is a private interface, subsequent patches in the series
>> introduce another api wrapping the libebl perf register handling. In
>> this patch, add an interface to access the preferred set of registers
>> that libdwfl would like to see to allow proper unwinding of stack
>> sample data.
>>
>> * libdwfl/libdwfl.h (dwfl_perf_sample_preferred_regs_mask):
>> New function.
>> * libdwfl/dwfl_perf_frame.c: New file.
>> (dwfl_perf_sample_preferred_regs_mask): New function.
>> * libdw/libdw.map: Add dwfl_perf_sample_preferred_regs_mask.
>> * libdwfl/Makefile.am: Add dwfl_perf_frame.c.
>
> I probably need to read the rest of the patch series first. On its own
> I am not a fan, it feels very much an implementation detail that
> should be abstracted away.
Yeah, the trouble is that it's an implementation detail that needs to be agreed
on between elfutils (which does unwinding) and the profiler (which calls
perf_event_open and provides regs_mask). So there are two ways to do that.
Either the profiler decides which regs_mask to use, or the profiler asks
elfutils for a regs_mask. The function in this patch is meant to support the
latter scenario, which gives the profiler confidence that it's picking a set of
registers elfutils can work with.