From 88c914274032d1dd1e51bbb4b5cf67e8217fe533 Mon Sep 17 00:00:00 2001 From: Francis Deslauriers Date: Fri, 17 Jan 2020 12:45:51 -0500 Subject: [PATCH] Fix: lttng: placing probe on symbol starting with `_` MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Issue ===== The lttng CLI tool does not parse `--probe` symbol name properly if the name has an underscore at the beginning. For example, the following command fails lttng enable-event -k --probe _do_fork my_do_fork_event This happens because the `parse_probe_opts()` function looks if the first character of the symbol field is an alphabetic character to determine if a symbol was provided. The problem is that some kernel symbols such as `_do_fork` start with an underscore. Solution ======== check if the first character is an alphabetic character OR an underscore. Signed-off-by: Francis Deslauriers Change-Id: I3ee6c26641ceee508ee78e895d372c6b09fe90fb Signed-off-by: Jérémie Galarneau --- src/bin/lttng/commands/enable_events.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bin/lttng/commands/enable_events.c b/src/bin/lttng/commands/enable_events.c index 6889b63d7..84bcb2081 100644 --- a/src/bin/lttng/commands/enable_events.c +++ b/src/bin/lttng/commands/enable_events.c @@ -143,7 +143,7 @@ static int parse_probe_opts(struct lttng_event *ev, char *opt) } /* Check for symbol */ - if (isalpha(name[0])) { + if (isalpha(name[0]) || name[0] == '_') { match = sscanf(opt, "%" LTTNG_SYMBOL_NAME_LEN_SCANF_IS_A_BROKEN_API "s", name); if (match == 1) { -- 2.34.1