]> git.ipfire.org Git - thirdparty/elfutils.git/commit
libdwfl_stacktrace [5/12]: introduce Dwflst_Process_Tracker
authorSerhei Makarov <serhei@serhei.io>
Mon, 20 Jan 2025 21:38:42 +0000 (16:38 -0500)
committerSerhei Makarov <serhei@serhei.io>
Fri, 25 Apr 2025 14:09:58 +0000 (10:09 -0400)
commit3dc8d7cc21bcb70e6ea049e621da22b546992429
tree7caeee8f633f4f6de22f234251b5187159e4941d
parent13ee49e7ecf3512254d5c512a6576da9730beb26
libdwfl_stacktrace [5/12]: introduce Dwflst_Process_Tracker

Changes for v4:

- Separate out libdwfl_stacktrace, as requested.

* * *

New data structure to coordinate caching Elf data among multiple Dwfl
structs attached to different processes. Meant to reduce the overhead
for profilers that use elfutils for unwinding.

The caching is well-justified, as the prior approach (e.g. in
eu-stacktrace, sysprof-live-unwinder) of creating a separate Dwfl per
process was wildly redundant, opening ~hundreds of file descriptors
just for each common library such as libc.so and leaking the data.

Initial patch just introduces the struct, to be filled in by the rest
of the patch series.

* libdwfl_stacktrace/libdwfl_stacktrace.h
  (Dwflst_Process_Tracker): New struct.
  (dwflst_tracker_begin): New function.
  (dwflst_tracker_dwfl_begin): New function.
  (dwflst_tracker_end): New function.
* libdw/libdw.map: Add new functions.
* libdwfl_stacktrace/libdwfl_stacktraceP.h
  (struct Dwflst_Process_Tracker): New struct.
* libdwfl/libdwflP.h (Dwflst_Process_Tracker): Typedef forward decl.
  (struct Dwfl): Add 'tracker' field.
* libdwfl_stacktrace/Makefile.am (libdwfl_stacktrace_a_SOURCES):
  Add dwflst_process_tracker.c.
* libdwfl_stacktrace/dwflst_process_tracker.c: New file.
  (dwflst_tracker_begin): Initialize the tracker.
  (dwflst_tracker_dwfl_begin): Initialize Dwfl * with specified tracker.
  (dwflst_tracker_end): Deallocate the tracker.
libdw/libdw.map
libdwfl/libdwflP.h
libdwfl_stacktrace/Makefile.am
libdwfl_stacktrace/dwflst_process_tracker.c [new file with mode: 0644]
libdwfl_stacktrace/libdwfl_stacktrace.h
libdwfl_stacktrace/libdwfl_stacktraceP.h