On Tue, May 6, 2025, at 11:24 AM, Aaron Merey wrote:
> So if the arch is not x86_64 or i386, then PERF_FRAME_REGISTERS_* will
> be 0 and this signals to the backend to skip any unwinding. LGTM.
Yep, will expand the #ifdef as more architectures are added.
Committed.
--
All the best,
Serhei
asm/perf_regs.h is an arch-specific linux include, not present on
architectures like hppa and m68k that lack perf_events support.
Only one place we need to fix; others already guard the include by
architecture, or use architecture-independent headers (e.g.
linux/perf_events.h).
* backends/libebl_
On Thu, Mar 20, 2025, at 10:28 AM, Serhei Makarov wrote:
> On Tue, Dec 10, 2024, at 4:42 PM, Serhei Makarov wrote:
>> This email sketches an 'unwinder cache' interface for libdwfl, derived
>> from recent eu-stacktrace code [1] and based on Christian Hergert's
>
On Fri, Apr 25, 2025, at 12:02 PM, Aaron Merey wrote:
>> First patch of a series that reworks eu-stacktrace functionality
>> into a library interface for other profiling tools.
>
> Thanks I've approved and merged this series with two changes:
> Signed-off-by added to each commit message and a rw
Changes for v6:
- Minor fixes as requested.
Changes for v2:
- Merged commit 11 into commit 1 (both sample_base_addr/sample_pc and
set_initial_registers_sample make sense to introduce in the same
commit).
- Added i386 backend and factored out common code.
* * *
First patch of a series that
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
Changes for v4:
- Separate out libdwfl_stacktrace, as requested.
Changes for v3:
- Fix initialization of elf in sysprof_init_dwfl
(previously triggered -Wmaybe-uninitialized).
* * *
Remove the code from src/stacktrace.c that is now covered by
libdwfl_stacktrace/dwflst_perf_frame.c and
dwflst
Changes for v6:
- Minor fixes as requested.
Changes for v4:
- Separate out libdwfl_stacktrace, as requested.
Changes for v3:
- use const void *stack, not void *, to allow users
to pass a const stack sample
Changes for v2:
- use renamed __libdwfl_set_initial_registers_thread
- oops, should
Changes for v6:
- Minor fixes as requested.
Changes for v4:
- Separate out libdwfl_stacktrace, as requested.
* * *
Initial minimal change to ensure dwflst_tracker_find_pid is
tested. For now, we keep the additional dwfltab implementation in
stacktrace.c, since it's being used to track statisti
Changes for v6:
- Minor fixes as requested.
Changes for v4:
- Separate out libdwfl_stacktrace, as requested.
Changes for v3:
- Handle dwfl->process == NULL case in __libdwfl_remove_dwfl_from_tracker.
* * *
The Dwflst_Process_Tracker also includes a dynamicsizehash cache which
maps process id
Changes for v6:
- Minor fixes as requested.
Changes for v5:
- Bugfixes in dwflst_tracker_find_elf.c.
Changes for v4:
- Separate out libdwfl_stacktrace, as requested.
- dwfl_module_getdwarf.c now uses the dwflst_tracker_cache_elf()
interface instead of editing the elftab directly.
Changes f
Changes for v4:
- Since __libdwfl_set_initial_registers_thread is now private to
libdwfl, the modified code in this patch has been disabled.
* * *
Dummy commit to show how the sample_set_initial_registers callback in
eu-stacktrace would use the proper libebl
ebl_set_initial_registers_sample fu
Changes for v4:
- Separate out libdwfl_stacktrace, as requested.
* * *
* src/Makefile.am (AM_CPPFLAGS): Include headers from
../libdwfl_stacktrace.
* src/stacktrace.c (tracker): New global variable.
(sample_callbacks): Use dwflst_tracker_linux_proc_find_elf for
caching.
(sysprof_init_dwf
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
Changes for v6:
- Minor fixes as requested.
Changes for v4:
- Separate out libdwfl_stacktrace, as requested.
Changes for v2:
- Add locking for dwfltab.
* * *
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 t
Changes for v6:
- Minor fixes as requested.
Changes for v2:
- No longer exposing this in public libdwfl.h api.
* * *
Renaming pid_set_initial_registers to
__libdwfl_set_initial_registers_thread and adding to libdwflP.h.
This callback was private to one file, but now we need to access it
from
On Fri, Apr 25, 2025, at 1:57 AM, Aaron Merey wrote:
> Also if you haven't done so already, please run any manual tests under
> valgrind memcheck (and helgrind if you are able to test this with
> multithreading).
Ran eu-stacktrace through valgrind; the content of the cache is marked as
'leaked'
On Fri, Apr 25, 2025, at 1:54 AM, Aaron Merey wrote:
> This commit could probably be merged with 2 or 12 with the
> sample_set_initial_registers design decisions explained in the commit
> message. But this patch as-is is harmless so if you prefer to keep it
> this way that's ok with me.
I'm incl
Changes for v4:
- Separate out libdwfl_stacktrace, as requested.
Changes for v3:
- use const void *stack, not void *, to allow users
to pass a const stack sample
Changes for v2:
- use renamed __libdwfl_set_initial_registers_thread
- oops, should use provided sample_arg->perf_regs_mask
in
On Thu, Apr 24, 2025, at 5:47 PM, Serhei Makarov wrote:
> Changes
Sorry, this one (with 07/14 in the title) was accidentally mixed in with the v5
submission. It's from a draft copy generated with an earlier git send-email
command, please ignore.
Changes for v4:
- Separate out libdwfl_stacktrace, as requested.
Changes for v3:
- Fix initialization of elf in sysprof_init_dwfl
(previously triggered -Wmaybe-uninitialized).
* * *
Remove the code from src/stacktrace.c that is now covered by
libdwfl_stacktrace/dwflst_perf_frame.c and
dwflst
Changes for v4:
- Separate out libdwfl_stacktrace, as requested.
Changes for v3:
- Handle dwfl->process == NULL case in __libdwfl_remove_dwfl_from_tracker.
* * *
The Dwflst_Process_Tracker also includes a dynamicsizehash cache which
maps process ids to Dwfl * (or rather, dwflst_tracker_dwfl_in
Changes for v5:
- Bugfixes in dwflst_tracker_find_elf.c.
Changes for v4:
- Separate out libdwfl_stacktrace, as requested.
- dwfl_module_getdwarf.c now uses the dwflst_tracker_cache_elf()
interface instead of editing the elftab directly.
Changes for v3:
- Reworked elftab to incorporate dev/i
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
Changes for v4:
- Separate out libdwfl_stacktrace, as requested.
* * *
* src/Makefile.am (AM_CPPFLAGS): Include headers from
../libdwfl_stacktrace.
* src/stacktrace.c (tracker): New global variable.
(sample_callbacks): Use dwflst_tracker_linux_proc_find_elf for
caching.
(sysprof_init_dwf
Changes for v4:
- Separate out libdwfl_stacktrace, as requested.
Changes for v2:
- Add locking for dwfltab.
* * *
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
v
Changes for v4:
- Separate out libdwfl_stacktrace, as requested.
* * *
Initial minimal change to ensure dwflst_tracker_find_pid is
tested. For now, we keep the additional dwfltab implementation in
stacktrace.c, since it's being used to track statistics.
In future follow-ups, it will be good to
Changes
Changes for v4:
- Separate out libdwfl_stacktrace, as requested.
- dwfl_module_getdwarf.c now uses the dwflst_tracker_cache_elf()
interface instead of editing the elftab directly.
Changes for v3:
- Reworked elftab to incorporate dev/ino into the caching key
(to allow caching module
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
Changes for v2:
- No longer exposing this in public libdwfl.h api.
* * *
Renaming pid_set_initial_registers to
__libdwfl_set_initial_registers_thread and adding to libdwflP.h.
This callback was private to one file, but now we need to access it
from the perf_events sampling code as well.
* libd
Changes for v4:
- Since __libdwfl_set_initial_registers_thread is now private to
libdwfl, the modified code in this patch has been disabled.
* * *
Dummy commit to show how the sample_set_initial_registers callback in
eu-stacktrace would use the proper libebl
ebl_set_initial_registers_sample fu
Changes for v2:
- Merged commit 11 into commit 1 (both sample_base_addr/sample_pc and
set_initial_registers_sample make sense to introduce in the same
commit).
- Added i386 backend and factored out common code.
* * *
First patch of a series that reworks eu-stacktrace functionality
into a li
Changes for v4:
- Separate out libdwfl_stacktrace, as requested.
- dwfl_module_getdwarf.c now uses the dwflst_tracker_cache_elf()
interface instead of editing the elftab directly.
Changes for v3:
- Reworked elftab to incorporate dev/ino into the caching key
(to allow caching modules from di
Changes for v2:
- No longer exposing this in public libdwfl.h api.
* * *
Renaming pid_set_initial_registers to
__libdwfl_set_initial_registers_thread and adding to libdwflP.h.
This callback was private to one file, but now we need to access it
from the perf_events sampling code as well.
* libd
Changes for v4:
- Separate out libdwfl_stacktrace, as requested.
* * *
Initial minimal change to ensure dwflst_tracker_find_pid is
tested. For now, we keep the additional dwfltab implementation in
stacktrace.c, since it's being used to track statistics.
In future follow-ups, it will be good to
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
Changes for v2:
- Merged commit 11 into commit 1 (both sample_base_addr/sample_pc and
set_initial_registers_sample make sense to introduce in the same
commit).
- Added i386 backend and factored out common code.
* * *
First patch of a series that reworks eu-stacktrace functionality
into a li
Changes for v4:
- Separate out libdwfl_stacktrace, as requested.
Changes for v3:
- Fix initialization of elf in sysprof_init_dwfl
(previously triggered -Wmaybe-uninitialized).
* * *
Remove the code from src/stacktrace.c that is now covered by
libdwfl_stacktrace/dwflst_perf_frame.c and
dwflst
Changes for v4:
- Separate out libdwfl_stacktrace, as requested.
Changes for v3:
- use const void *stack, not void *, to allow users
to pass a const stack sample
Changes for v2:
- use renamed __libdwfl_set_initial_registers_thread
- oops, should use provided sample_arg->perf_regs_mask
in
Changes for v4:
- Separate out libdwfl_stacktrace, as requested.
* * *
* src/Makefile.am (AM_CPPFLAGS): Include headers from
../libdwfl_stacktrace.
* src/stacktrace.c (tracker): New global variable.
(sample_callbacks): Use dwflst_tracker_linux_proc_find_elf for
caching.
(sysprof_init_dwf
Changes for v4:
- Separate out libdwfl_stacktrace, as requested.
Changes for v2:
- Add locking for dwfltab.
* * *
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
v
Changes for v4:
- Separate out libdwfl_stacktrace, as requested.
Changes for v3:
- Handle dwfl->process == NULL case in __libdwfl_remove_dwfl_from_tracker.
* * *
The Dwflst_Process_Tracker also includes a dynamicsizehash cache which
maps process ids to Dwfl * (or rather, dwflst_tracker_dwfl_in
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
Changes for v4:
- Since __libdwfl_set_initial_registers_thread is now private to
libdwfl, the modified code in this patch has been disabled.
* * *
Dummy commit to show how the sample_set_initial_registers callback in
eu-stacktrace would use the proper libebl
ebl_set_initial_registers_sample fu
On Tue, Apr 22, 2025, at 6:26 PM, Frank Ch. Eigler wrote:
> Hi -
>
>> CCLD libdw.so
>> /usr/bin/ld: ../libdwfl/libdwfl_pic.a(dwfl_module_getdwarf.os): in function
>> `open_elf':
>> Calling a public function across the library boundary should be no problem,
>> but we run into this -- circu
On Tue, Apr 22, 2025, at 10:17 AM, Aaron Merey wrote:
> dwfl_st or dwflst prefixes work for me. I think I slightly prefer
> dwfl_st. As for where to define Dwfl_Process_tracker let's try to keep
> it to the new dwfl_stacktraceP.h and if possible use forward
> declarations to avoid circular depen
On Tue, Apr 22, 2025, at 10:17 AM, Aaron Merey wrote:
>> One question this raises re: the Dwfl_Process_Tracker structure and where
>> its implementation should be located. In the patches, the Dwfl struct
>> implementation includes a pointer to a Dwfl_Process_Tracker. I’m not sure if
>> elfuti
On Tue, Apr 22, 2025, at 9:45 AM, Aaron Merey wrote:
> Hi Serhei,
>
> On Tue, Apr 22, 2025 at 9:27 AM Serhei Makarov wrote:
>>
>> On Mon, Apr 21, 2025, at 12:29 AM, Aaron Merey wrote:.
>> >
>> > I know we're close to the next release and I do want th
On Mon, Apr 21, 2025, at 12:29 AM, Aaron Merey wrote:.
>
> I know we're close to the next release and I do want this work to be
> included. My proposal is to move the current API out of libdwfl and
> into a new library, as-is but clearly marked as experimental and
> subject to possible API/ABI
Changes for v3:
- Handle dwfl->process == NULL case in __libdwfl_remove_dwfl_from_tracker.
* * *
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 t
On Tue, Apr 15, 2025, at 3:32 PM, Serhei Makarov wrote:
> it should not necessary to duplicate the FD on the Sysprof side,
> unless Sysprof wants to use the FD for its own purposes independently
> of what Elfutils is doing with it.
Updated the Sysprof side of the code again to match
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
Changes for v3:
- Fix initialization of elf in sysprof_init_dwfl
(previously triggered -Wmaybe-uninitialized).
* * *
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 verbo
Changes for v3:
- Reworked elftab to incorporate dev/ino into the caching key
(to allow caching modules from different filesystems
e.g. a main filesystem and a container filesystem)
and guard more carefully against collisions.
- Add external API for implementing a custom
find_elf callback
* 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
Changes for v3:
- use const void *stack, not void *, to allow users
to pass a const stack sample
Changes for v2:
- use renamed __libdwfl_set_initial_registers_thread
- oops, should use provided sample_arg->perf_regs_mask
in sample_set_initial registers
* * *
This is a new interface for un
Changes for v2:
- guard the linux/perf_events.h include properly with an #if defined __linux__
* * *
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 se
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
Changes for v2:
- Add locking for dwfltab.
* * *
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_fi
Changes for v2:
- No longer exposing this in public libdwfl.h api.
* * *
Renaming pid_set_initial_registers to
__libdwfl_set_initial_registers_thread and adding to libdwflP.h.
This callback was private to one file, but now we need to access it
from the perf_events sampling code as well.
* libd
Changes for v2:
- Merged commit 11 into commit 1 (both sample_base_addr/sample_pc and
set_initial_registers_sample make sense to introduce in the same
commit).
- Added i386 backend and factored out common code.
* * *
First patch of a series that reworks eu-stacktrace functionality
into a li
On Tue, Apr 15, 2025, at 2:15 PM, Christian Hergert wrote:
> On 4/15/25 09:12, Serhei Makarov wrote:
>> Option 2: expose one function, treat file_name and fd as optional input
>> parameters.
>>
>> // normal use case
>> module_name = "/usr/lib/whatever.
On Fri, Apr 4, 2025, at 5:04 PM, Serhei Makarov wrote:
> Changes for v2:
>
> - Add locking for elftab. This is needed in addition to the
> intrinsic locking in dynamicsizehash_concurrent to avoid
> having cache_elf expose an incomplete dwfltracker_elf_info*
> entry to o
On Tue, Dec 10, 2024, at 4:42 PM, Serhei Makarov wrote:
> This email sketches an 'unwinder cache' interface for libdwfl, derived
> from recent eu-stacktrace code [1] and based on Christian Hergert's
> adaptation of eu-stacktrace as sysprof-live-unwinder [2]. The intent
On Thu, Mar 20, 2025, at 8:01 AM, Mark Wielaard wrote:
> Hi Serhei,
>
> On Sun, 2025-03-16 at 19:14 -0400, Serhei Makarov wrote:
> I am wondering whether this isn't too abstract. libdwfl Dwfl's are
> already super abstract so they can be used for running processes and
&
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
Changes for v2:
- use renamed __libdwfl_set_initial_registers_thread
- oops, should use provided sample_arg->perf_regs_mask
in sample_set_initial registers
* * *
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.
Changes for v2:
- Add locking for elftab. This is needed in addition to the
intrinsic locking in dynamicsizehash_concurrent to avoid
having cache_elf expose an incomplete dwfltracker_elf_info*
entry to other threads while its data is being populated /
replaced.
- Tidy dwfl_process_tracker
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_
* 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
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
Changes for v2:
- guard the linux/perf_events.h include properly with an #if defined __linux__
* * *
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 se
Changes for v2:
- Add locking for dwfltab.
* * *
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_fi
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
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
Changes for v2:
- No longer exposing this in public libdwfl.h api.
* * *
Renaming pid_set_initial_registers to
__libdwfl_set_initial_registers_thread and adding to libdwflP.h.
This callback was private to one file, but now we need to access it
from the perf_events sampling code as well.
* libd
Changes for v2:
- Merged commit 11 into commit 1 (both sample_base_addr/sample_pc and
set_initial_registers_sample make sense to introduce in the same
commit).
- Added i386 backend and factored out common code.
* * *
First patch of a series that reworks eu-stacktrace functionality
into a li
On Thu, Apr 3, 2025, at 1:19 PM, Serhei Makarov wrote:
> On Sun, Mar 16, 2025, at 7:15 PM, Serhei Makarov wrote:
>> +/* The same callback, except this first attempts to look up a cached
>> + Elf* and fd from the Dwfl_Module's Dwfl_Process_Tracker (if any).
>> +
On Sun, Mar 16, 2025, at 7:15 PM, Serhei Makarov wrote:
> +/* The same callback, except this first attempts to look up a cached
> + Elf* and fd from the Dwfl_Module's Dwfl_Process_Tracker (if any).
> + If a new Elf* has to be created, this saves it to the cache. */
On Wed, Mar 19, 2025, at 11:53 AM, Mark Wielaard wrote:
> Also the libebl interface is very verbose for this mask.
> Clearly copied from how frame_nregs is done.
> So fine for now. But we might want to look into something simpler for
> both of these. Both fetching frame_nregs and perf_frame_regs
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 handli
On Tue, Mar 18, 2025, at 10:04 AM, Mark Wielaard wrote:
> In some other situations that is "solved" with marking the function
> arguments with __attribute__ ((unused)) (which isn't true for x86_64,
> but the compiler is fine with that).
The other hack (that I'd go with, if there's no style objec
On Sun, Mar 16, 2025, at 7:12 PM, Serhei Makarov wrote:
> +bool
> +x86_64_set_initial_registers_sample (const Dwarf_Word *regs, uint32_t
> n_regs,
> + uint64_t regs_mask, uint32_t abi,
> + ebl_tid_regis
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
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
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
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
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
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_
* 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
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
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
On Wed, Dec 11, 2024, at 6:24 AM, Milian Wolff wrote:
> On Dienstag, 10. Dezember 2024 22:42:25 Mitteleuropäische Normalzeit Serhei
> Makarov wrote:
>> This email sketches an 'unwinder cache' interface for libdwfl, derived from
>> recent eu-stacktrace code [1] and
On Wed, Dec 11, 2024, at 9:46 AM, William Cohen wrote:
> Hi Serhei,
>
> The dwfl_report_proc_map() will handle when things are added to the
> memory map. Is there anything to handle the inverse event when memory
> is removed from the process memory map, such as a dlcose()?
>
Interestingly, li
This email sketches an 'unwinder cache' interface for libdwfl, derived from
recent eu-stacktrace code [1] and based on Christian Hergert's adaptation of
eu-stacktrace as sysprof-live-unwinder [2]. The intent is to remove the need
for a lot of boilerplate code that would be identical among profil
1 - 100 of 122 matches
Mail list logo