AW: [lttng-dev] Record stacktraces at userspace tracing domain

Alexander Krabler Alexander.Krabler at kuka.com
Wed Dec 11 05:32:24 EST 2024


Hi Christophe and Kienan,


Internal
On 12/2/24 4:17 PM, Christophe Bédard via lttng-dev wrote:
> I did the same thing a while ago, i.e., trigger tracepoints on
> malloc/free/etc. using liblttng-ust-libc-wrapper and collect userspace
> callstack information (so that the indirect calls to malloc/free can be
> removed from an application).
> ...
Thank you for the information and links!
I have looked into it, seems promising.


On 12/10/24 11:41 AM, Kienan Stewart via lttng-dev wrote:
> Depending on the type of information you require, it could be possible
> to use the instruction-pointer (ip) context[1], the statedump[2] and/or
> lttng-ust-dl[3] for base addresses, and the symbol table in-order to
> resolve ip -> symbol name in the offline analysis phase with the help of
> babeltrace's debug-info plugin[4]. While a bit more work for the
> analysis, this process reduces the impact of the tracing on the program
> at run-time.
Thanks for the hints.
This would be possible, but that would give me only the instruction pointer of the top-level stack frame.
If malloc and free calls are wrapped inside of functions (e.g. think about std::string, std::unique/shared_ptr for C++),
I would only see that it's called from that specific type.
But, for me, it's important to see the context, too, where the string/smart pointer is used.
Therefore I want to record the instruction pointer of every stackframe (or at least the top N ones in order to be able to locate the "problem").

As stacktraces are only wanted/needed for specific events, I also consider adding new tracepoints
like lttng_ust_libc:malloc_stacktrace to lttng-ust-libc-wrapper directly
recording the desired information into the trace buffer as an alternative solution.

Best regards,
Alexander


More information about the lttng-dev mailing list