Re: Call stack context for user space trace points

Christophe Bédard via lttng-dev <[email protected]> Mon, 6 Oct 2025 10:22:34 -0700
Newsgroups org.lttng.lists.lttng-dev
Message-ID <CAAS9doZSjHghJAUechOyNxhwA0DnMJX+Rm=YdbqMPfsSn-u7VQ@mail.gmail.com>
--000000000000a69871064080b4d0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Hi,

The userspace callstack context is only available for the kernel domain.

There are potential workarounds and solutions; take a look at the
discussion in this mailing list thread from last year (hit "Next message"):
https://lists.lttng.org/pipermail/lttng-dev/2024-December/030881.html

Regards,

Christophe

On Mon, Oct 6, 2025 at 5:37=E2=80=AFAM Sunku, Sai via lttng-dev <
[email protected]> wrote:

> Hello,
>
>
>
> I have a complex, multithreaded benchmark that emits LTTng trace points a=
t
> various stages. I am trying to trace all malloc calls made by this
> benchmark. I'm specifically trying to get malloc trace points also throug=
h
> LTTng so that I can identify when the malloc call was made relative to
> other trace points from the benchmark. I also want to see the stack trace
> for each malloc call so that I can identify where in the benchmark the
> malloc call is coming from.
>
>
>
> If I preload the lttng libc wrapper with
> `LD_PRELOAD=3Dliblttng-ust-libc-wrapper.so`, I'm able to see the trace po=
ints
> from malloc calls.
>
>
>
> But when I try to add the callstack-user context with this command `lttng
> add-context --userspace --channel 1 --type callstack-user`, I get an erro=
r
> saying "Error: callstack-user: UST invalid context"
>
>
>
> I've successfully added user space stack traces for kernel trace points
> with a similar command `lttng add-context --kernel --type callstack-user`
>
>
>
> Is the callstack-user context only available for kernel trace points? Is
> there another way to get the call stack for malloc calls?
>
>
>
> Thank you,
>
> Sai Sunku
>
>
>

--000000000000a69871064080b4d0
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Hi,<div><br></div><div>The userspace callstack=C2=A0contex=
t is only available for the kernel domain.</div><div><br></div><div>There a=
re potential workarounds and solutions; take a look at the discussion in th=
is mailing list thread from last year (hit &quot;Next message&quot;):=C2=A0=
<a href=3D"https://lists.lttng.org/pipermail/lttng-dev/2024-December/030881=
.html">https://lists.lttng.org/pipermail/lttng-dev/2024-December/030881.htm=
l</a></div><div><br></div><div>Regards,</div><div><br></div><div>Christophe=
</div></div><br><div class=3D"gmail_quote gmail_quote_container"><div dir=
=3D"ltr" class=3D"gmail_attr">On Mon, Oct 6, 2025 at 5:37=E2=80=AFAM Sunku,=
 Sai via lttng-dev &lt;<a href=3D"mailto:[email protected]">lttng-d=
[email protected]</a>&gt; wrote:<br></div><blockquote class=3D"gmail_quote=
" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);=
padding-left:1ex"><div class=3D"msg6488481305085553015">





<div lang=3D"EN-US" style=3D"overflow-wrap: break-word;">
<div class=3D"m_6488481305085553015WordSection1">
<p class=3D"MsoNormal">Hello,<u></u><u></u></p>
<p class=3D"MsoNormal"><u></u>=C2=A0<u></u></p>
<p class=3D"MsoNormal">I have a complex, multithreaded benchmark that emits=
 LTTng trace points at various stages. I am trying to trace all malloc call=
s made by this benchmark. I&#39;m specifically trying to get malloc trace p=
oints also through LTTng so that I can
 identify when the malloc call was made relative to other trace points from=
 the benchmark. I also want to see the stack trace for each malloc call so =
that I can identify where in the benchmark the malloc call is coming from.<=
u></u><u></u></p>
<p class=3D"MsoNormal"><u></u>=C2=A0<u></u></p>
<p class=3D"MsoNormal">If I preload the lttng libc wrapper with `LD_PRELOAD=
=3Dliblttng-ust-libc-wrapper.so`, I&#39;m able to see the trace points from=
 malloc calls.<u></u><u></u></p>
<p class=3D"MsoNormal"><u></u>=C2=A0<u></u></p>
<p class=3D"MsoNormal">But when I try to add the callstack-user context wit=
h this command `lttng add-context --userspace --channel 1 --type callstack-=
user`, I get an error saying &quot;Error: callstack-user: UST invalid conte=
xt&quot;<u></u><u></u></p>
<p class=3D"MsoNormal"><u></u>=C2=A0<u></u></p>
<p class=3D"MsoNormal">I&#39;ve successfully added user space stack traces =
for kernel trace points with a similar command `lttng add-context --kernel =
--type callstack-user`<u></u><u></u></p>
<p class=3D"MsoNormal"><u></u>=C2=A0<u></u></p>
<p class=3D"MsoNormal">Is the callstack-user context only available for ker=
nel trace points? Is there another way to get the call stack for malloc cal=
ls?<u></u><u></u></p>
<p class=3D"MsoNormal"><u></u>=C2=A0<u></u></p>
<p class=3D"MsoNormal">Thank you,<u></u><u></u></p>
<p class=3D"MsoNormal">Sai Sunku<u></u><u></u></p>
<p class=3D"MsoNormal"><u></u>=C2=A0<u></u></p>
</div>
</div>

</div></blockquote></div>

--000000000000a69871064080b4d0--