Re: [lttng-dev] Trying to understand use of lttng enable-event --kernel --userspace-probe=

Brian Hutchinson via lttng-dev <[email protected]>
Newsgroups org.lttng.lists.lttng-dev
Message-ID <CAFZh4h8rZU7Nd-6FptvsibgMXURu0EHKXeouRzNg0mLbTr9t+Q@mail.gmail.com>
On Thu, May 18, 2023 at 10:45 AM Mathieu Desnoyers
<[email protected]> wrote:
>
> On 2023-05-18 10:10, Brian Hutchinson wrote:
> [...]
> > I updated my hello world to have a function I'd like to use the
> > --userspace-probe method on with the very original name of
> > 'probe_function':
> >
> > #include <stdio.h>
> > #include <lttng/tracef.h>
> >
> > void probe_function(int i);
> >
> > int main(int argc, char *argv[])
> > {
> >     unsigned int i;
> >     puts("Hello, World!\nPress Enter to continue...");
> >     /*
> >      * The following getchar() call only exists for the purpose of this
> >      * demonstration, to pause the application in order for you to have
> >      * time to list its tracepoints. You don't need it otherwise.
> >      */
> >     getchar();
> >
> >     lttng_ust_tracef("Number %d, string %s", 23, "hi there!");
> >     printf("Number %d, string %s", 23, "hi there!");
> >
> >     for (i = 0; i < argc; i++) {
> >         lttng_ust_tracef("Number %d, argv %s", i, argv[i]);
> >         printf("Number %d, argv %s", i, argv[i]);
> >     }
> >
> >     puts("Quitting now!");
> >
> >     probe_function(i);
> >
> >     return 0;
> > }
> >
> > void probe_function(int i) {
> >
> >     lttng_ust_tracef("Number %d, string %s", i * i, "i^2");
> >     printf("Number %d, string %s", i * i, "i^2");
> >
> > }
> >
> > ... and I get the same error as before when I try to enable the probe:
> > # lttng enable-event --kernel
> > --userspace-probe=/usr/local/bin/hello:probe_function
> > Error: Missing event name(s).
>
> As the error states, you are missing the event name. See
>
> man 1 lttng-enable-event
>
>         lttng [GENERAL OPTIONS] enable-event --kernel
>               [--probe=SOURCE | --function=SOURCE | --syscall |
>                --userspace-probe=SOURCE]
>               [--filter=EXPR] [--session=SESSION]
>               [--channel=CHANNEL] EVENT[,EVENT]...
>
>
> You will want something like:
>
> lttng enable-event --kernel --userspace-probe=/usr/local/bin/hello:probe_function my_probe_function
>
> Where "my_probe_function" is the event name that will appear in the collected traces.

Wow!  I must not have woken up this morning ha, ha.  Thanks for that!
The event is enabled now.  Hope to actually get tracing data now.

Regards,

Brian

>
> Thanks,
>
> Mathieu
>
> --
> Mathieu Desnoyers
> EfficiOS Inc.
> https://www.efficios.com
>
_______________________________________________
lttng-dev mailing list
[email protected]
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.