Add --userspace-probe kernel event type
authorFrancis Deslauriers <francis.deslauriers@efficios.com>
Fri, 29 Jun 2018 19:22:36 +0000 (15:22 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 24 Aug 2018 20:06:50 +0000 (16:06 -0400)
commitdcabc1905756b2999886313ec33705f7571a3fb9
tree43d8dd096a4326af41da778878737f44336b7055
parentdbc478f3152cf3b4c695eb5c5c28930d03d78f69
Add --userspace-probe kernel event type

This commit wires up all the elements necessary to use the
userspace-probe feature.

This event type is defined by the user with --userspace-probe option. At
the moment, probing location can be specified by the user using two
location types: ELF function and STD probe.

It's important to note that userspace-probes are traced by the kernel
tracer and the generated events will thus be recorded in the kernel
trace. This is due to the fact that this feature uses the uprobe kernel
interface to instrument binaries. A root session daemon is needed to
load the kernel modules necessary to use this feature.

To ensure that the file pointed by the provided path does not change
while processing the user command, we use a fd-passing scheme. It
consist of calling open of the executable path early on in the
enable-event command and passing that file descriptor to the sessiond
for ELF parsing and the kernel to do the instrumentation. This ensures
that the inode backing that file is not reused for another file in the
case of a file deletion-and-reuse race.

Command syntax:
* The syntax to enable an ELF function userspace probe is the following:
  `--userspace-probe=elf:/path/to/executable:my_target_symbol`

  Omitting the first element of the colon-separated list would also work
  as the ELF function location is the default location type.

  Here are two equivalent usage examples of this location type:
    lttng enable-enable --kernel --userspace-probe=/path/to/executable:my_symbol event_name
    lttng enable-enable --kernel --userspace-probe=elf:/path/to/executable:my_symbol event_name

* SDT probes are DTrace-style tracepoint distributed in multiple
  libraries and applications. This implementation supports tracing of
  SDT probes that are NOT guarded by semaphore.

  The syntax to enable an SDT tracepoint userspace probe is the following:
  `--userspace-probe=sdt:/path/to/executable:provider:probe`
  Here is an usage example:
    lttng enable-enable --kernel --userspace-probe=sdt:/path/to/executable:provider:probe event_name

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng-sessiond/cmd.c
src/bin/lttng-sessiond/kernel.c
src/bin/lttng-sessiond/main.c
src/bin/lttng-sessiond/trace-kernel.c
src/bin/lttng/commands/enable_events.c
tests/unit/Makefile.am
This page took 0.027203 seconds and 5 git commands to generate.