First patch of a series that reworks eu-stacktrace functionality
into a library interface for other profiling tools.
* * *
As it happens, Linux perf_events and DWARF can prescribe completely
different layouts for the register file, requiring non-obvious code
for translation. This makes sense to p
Renaming to dwfl_set_initial_registers_thread.
This callback was private to one file, but now that other
tools (eu-stacktrace, sysprof via the dwfl_perf_sample_getframes) are
invoking the ebl set_initial_registers_sample api, we need to expose
it. Otherwise, clients would need to reimplement this
* src/stacktrace.c (tracker): New global variable.
(sample_callbacks): Use dwfl_process_tracker_find_elf for caching.
(sysprof_init_dwfl): Use dwfl_begin_with_tracker.
(main): Initialize and clean up tracker.
---
src/stacktrace.c | 11 ---
1 file changed, 8 insertions(+), 3 deletions
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
The Dwfl_Process_Tracker also includes a dynamicsizehash cache which
maps process ids to Dwfl * (or rather, dwfltracker_dwfl_info *
allowing the table entry to be replaced). Dwfls created from
the tracker are automatically added to it, and removed on dwfl_end().
* libdwfl/libdwflP.h (dwfltracker_
New function that retrieves the Dwfl for a particular PID, or,
if the Dwfl is absent, creates it via a provided callback
and adds it to the table later, when the PID is confirmed
via dwfl_attach_state.
* libdwfl/libdwfl.h (dwfl_process_tracker_find_pid): New function.
* libdwfl/dwfl_process_tracke
Remove the code from src/stacktrace.c that is now covered by
libdwfl/dwfl_perf_frame.c and dwfl_perf_sample_getframes.
* src/stacktrace.c (show_memory_reads): Remove this verbose option as
the relevant code is inside libdwfl now.
(struct __sample_arg): Remove, handled by libdwfl/dwfl_perf_fram
This is a new interface for unwinding that doesn't require the Dwfl to
be attached to a live process (via ptrace) or via corefile. Instead,
data from a perf_events stack sample is provided along with an Elf
struct used to identify the architecture. Based on code from
eu-stacktrace.
* libdwfl/libdw
These additional libebl hooks are needed to extract the location of
the stack frame in-memory from the perf_events register sample,
when dwfl_perf_sample_getframes is implemented in the next patch.
Implementing x86_64 for now, just as with the earlier ebl patches.
* libebl/libebl.h (ebl_sample_ba
Initial minimal change to ensure dwfl_process_tracker_find_pid is
tested. For now, we keep the additional dwfltab code in stacktrace.c,
since it's used to track statistics.
In future follow-ups, it will be good to switch to storing
eu-stacktrace statistics in dwfl->process->callbacks_arg. This
req
Change the sample_set_initial_registers callback in eu-stacktrace to
use the proper libebl ebl_set_initial_registers_sample function.
* src/Makefile.am (stacktrace_LDADD): Add libebl.
* src/stacktrace.c (sample_registers_cb): New function,
though identical to pid_thread_state_registers_cb.
(sa
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
* libdw/dwarf_begin_elf.c (dwarf_begin_elf): Init macro_lock.
* libdw/dwarf_end.c (cu_free): Free src_lock.
(dwarf_end): Free macro_lock.
* libdw/dwarf_getsrcfiles.c (dwarf_getsrcfiles): Use src_lock.
* libdw/dwarf_getsrclines.c (dwarf_getsrclines): Ditto.
The Dwfl_Process_Tracker includes a dynamicsizehash cache which maps
file paths to Elf * (or rather, dwfl_tracker_elf_info * storing fd and
Elf *). We provide a dwfl_process_tracker_find_elf callback which
checks the cache for an already-loaded Elf * and, if missing,
populates the cache with the f
14 matches
Mail list logo