]> git.ipfire.org Git - thirdparty/elfutils.git/commit
libdwfl_stacktrace [4/12]: intro library, add dwflst_perf_sample_preferred_regs_mask
authorSerhei Makarov <serhei@serhei.io>
Wed, 2 Apr 2025 20:50:59 +0000 (16:50 -0400)
committerSerhei Makarov <serhei@serhei.io>
Fri, 25 Apr 2025 14:09:58 +0000 (10:09 -0400)
commit13ee49e7ecf3512254d5c512a6576da9730beb26
treea7d972adfd4c20251ff989fd2a490e11960b3a7e
parent547b3686fb7e7ed5f39749505bd3c5a1b4157101
libdwfl_stacktrace [4/12]: intro library, add dwflst_perf_sample_preferred_regs_mask

Changes for v5:

- Separate ELFUTILS_0.193_EXPERIMENTAL namespace, mark library experimental.

Changes for v4:

- Separate out libdwfl_stacktrace, as requested.

Changes for v2:

- guard the linux/perf_events.h include properly with an #if defined __linux__

* * *

Subsequent patches in the series introduce a new library for
tracking/caching Elf structs across multiple processes and wrapping
the libebl perf register handling (since libebl is a private
interface).

In this patch, add the library and an interface to access the set of
registers that libdwfl needs to allow proper unwinding of stack sample
data.  (Unwinding with a smaller set of registers can be attempted,
but will yield a truncated call chain in most cases.)

(Accessing the set of registers feels like an implementation detail,
but the profiler invoking perf_event_open and elfutils unwinding code
need to agree on the exact set of registers being requested.  So it's
best for the profiler to ask elfutils for this detail.)

* libdwfl_stacktrace/Makefile.am: New file.
* libdwfl_stacktrace/libdwfl_stacktrace.h: New file, library for
  tracking/caching Elf structs and unwinding across multiple
  processes.
* libdwfl_stacktrace/libdwfl_stacktraceP.h: New file.
* libdwfl_stacktrace/dwflst_perf_frame.c: New file.
  (dwflst_perf_sample_preferred_regs_mask): New function.
* libdw/libdw.map: Add dwflst_perf_sample_preferred_regs_mask.
* NEWS: Add NEWS item about libdwfl_stacktrace.
* configure.ac: Add libdwfl_stacktrace/Makefile.
* Makefile.am (SUBDIRS): Add libdwfl_stacktrace.
* libdw/Makefile.am (libdw_so_LIBS): Add libdwfl_stacktrace.
  (libdwfl_stacktrace_objects): Add libdwfl_stacktrace.manifest.
  (libdw_a_LIBADD): Add libdwfl_stacktrace_objects.
* config/elfutils.spec.in (%files devel): Add libdwfl_stacktrace.h.
Makefile.am
NEWS
config/elfutils.spec.in
configure.ac
libdw/Makefile.am
libdw/libdw.map
libdwfl_stacktrace/Makefile.am [new file with mode: 0644]
libdwfl_stacktrace/dwflst_perf_frame.c [new file with mode: 0644]
libdwfl_stacktrace/libdwfl_stacktrace.h [new file with mode: 0644]
libdwfl_stacktrace/libdwfl_stacktraceP.h [new file with mode: 0644]