Hi,

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).

There is a userspace callstack context implementation here for lttng-ust 2.10, see the last 3 commits: https://github.com/tahini/lttng-ust-1/commits/ust-callstack-2.10/. Here's the corresponding lttng-tools 2.10 branch needed to enable the userspace callstack context: https://github.com/tahini/lttng-tools/commits/ust-context-callstack/.

I've rebased it on 2.11 here: https://github.com/ApexAI/lttng-ust/commits/ust-callstack-2.11/. lttng-tools: https://github.com/ApexAI/lttng-tools/commits/ust-callstack-2.11/. It shouldn't be too hard to rebase it all on a newer version.

Hope that helps,

Christophe

On Mon, Dec 2, 2024 at 8:32 AM Alexander Krabler via lttng-dev <lttng-dev@lists.lttng.org> wrote:
Hello,

we want to record stacktraces at specific userspace events like e.g. calls to malloc and free using liblttng-ust-libc-wrapper.so.
There is the callstack-user context to achieve this in general, however, it seems like tracing of userspace stacktraces is only available in the kernel tracing domain.

Is there already a solution to achieve this goal?
If not, what would need to be done to achieve this?

Thanks,
Alexander