[lttng-dev] What is DEFINE_LTTNG_UST_SIGBUS_STATE for and other beginner questions

Christopher Harvey chris at cwharvey.ca
Wed Oct 4 12:56:31 EDT 2023

Hi all,

I'm just getting started with lttng and have a couple of questions. My target is getting userspace tracepoints to work in a c++ application I control. I don't need kernel or system tracing. The target is running in a docker container I have control over as well. Running with --privileged is possible in my setup. I could run lttng inside the target container, outside on the host, or in another container on the same host. It's all the same to me. I don't know which setup is best, or if it even matters given that I don't need system or kernel traces.

I am using:
lttng-tools-2.13.11/      and       lttng-ust-2.13.6/
with userspace-rcu-0.14.0/

There is a slight version mismatch there, I just downloaded the "-lastest" from the links in the guide.

Here is my tracepoint provider header:

#define LTTNG_UST_TRACEPOINT_INCLUDE "./myLttngUstProvider.hpp"

#define _TP_H

#include "lttng/tracepoint.h"

    /* Tracepoint provider name */

    /* Tracepoint name */

    /* Input arguments */
        int, arg1

    /* Output event fields */
        lttng_ust_field_integer(int, arg1, arg1)

#endif /* _TP_H */

#include "lttng/tracepoint-event.h"

and the cpp:

#include "myLttngUstProvider.hpp"
#include "lttng/ust-sigbus.h"


I'm suspicious of a couple of things in my setup.

First, if I omit the DEFINE_LTTNG_UST_SIGBUS_STATE(); line, my program fails to compile with the following error:
liblttng-ust-ctl.so: undefined reference to `lttng_ust_sigbus_state'

The getting started guide doesn't say anything about needing DEFINE_LTTNG_UST_SIGBUS_STATE so it makes me wonder if I have done something else wrong somewhere else. I ran a find *.so | xargs nm -D | grep lttng_ust_sigbus_state and nothing in lttng-ust provides that symbol, so it looks like the target application has to define it. Is that normal?

If I leave DEFINE_LTTNG_UST_SIGBUS_STATE in then my program compiles. If I run lttng-sessiond in the target container, then run lttng list --userspace I see no tracepoints in the list.

I tried looking at the lttng source code but there is a lot there. I'm looking for some next steps for debugging this setup. What are some things I could check to make sure the lttng daemon is running properly? What is the mechanism for advertising tracepoints to the lttng daemon? Is it possible that docker has somehow interfered with the lttng ipc mechanism? It would be a tiny bit more convenient for me to simply deploy lttng-tools as a separate container, can I consider doing that instead? I'm not running anything as root, just a normal user.

I appreciate any and all guidance. Looking forward to using this neat looking tool.


More information about the lttng-dev mailing list