]> 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>
Fri, 25 Apr 2025 14:55:46 +0000 (10:55 -0400)
committerAaron Merey <amerey@redhat.com>
Fri, 25 Apr 2025 15:54:31 +0000 (11:54 -0400)
commit3ad7277b4163756f9d3fccd66df9576e3a5f8016
treea7d972adfd4c20251ff989fd2a490e11960b3a7e
parentacb79d8a697bd572219d3aad1b12469b1c3e22a8
libdwfl_stacktrace [4/12]: intro library, add dwflst_perf_sample_preferred_regs_mask

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.

Signed-off-by: Serhei Makarov <serhei@serhei.io>
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]