X-Git-Url: https://git.liburcu.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng%2Fcommands%2Fenable_events.c;h=18a958d321e6101d1de0c2c6ff00f75fae9e06bd;hb=6a240cd997676bd36ad7c8f7446191664409633a;hp=57837eb7dcadd3828110b7a7f386460ad491a570;hpb=de044b7a0613db6d16151ac9f7b7be404c0bb493;p=lttng-tools.git diff --git a/src/bin/lttng/commands/enable_events.c b/src/bin/lttng/commands/enable_events.c index 57837eb7d..18a958d32 100644 --- a/src/bin/lttng/commands/enable_events.c +++ b/src/bin/lttng/commands/enable_events.c @@ -113,11 +113,11 @@ static void usage(FILE *ofp) fprintf(ofp, " e.g.:\n"); fprintf(ofp, " \"*\"\n"); fprintf(ofp, " \"app_component:na*\"\n"); - fprintf(ofp, " --probe [addr | symbol | symbol+offset]\n"); + fprintf(ofp, " --probe (addr | symbol | symbol+offset)\n"); fprintf(ofp, " Dynamic probe.\n"); fprintf(ofp, " Addr and offset can be octal (0NNN...),\n"); fprintf(ofp, " decimal (NNN...) or hexadecimal (0xNNN...)\n"); - fprintf(ofp, " --function [addr | symbol | symbol+offset]\n"); + fprintf(ofp, " --function (addr | symbol | symbol+offset)\n"); fprintf(ofp, " Dynamic function entry/return probe.\n"); fprintf(ofp, " Addr and offset can be octal (0NNN...),\n"); fprintf(ofp, " decimal (NNN...) or hexadecimal (0xNNN...)\n"); @@ -168,7 +168,7 @@ static void usage(FILE *ofp) fprintf(ofp, " Expression examples:.\n"); fprintf(ofp, " \n"); fprintf(ofp, " 'intfield > 500 && intfield < 503'\n"); - fprintf(ofp, " '(stringfield == \"test\" || intfield != 10) && intfield > 33'\n"); + fprintf(ofp, " '(strfield == \"test\" || intfield != 10) && intfield > 33'\n"); fprintf(ofp, " 'doublefield > 1.1 && intfield < 5.3'\n"); fprintf(ofp, " \n"); fprintf(ofp, " Wildcards are allowed at the end of strings:\n"); @@ -268,7 +268,11 @@ int loglevel_str_to_value(const char *inputstr) int i = 0; char str[LTTNG_SYMBOL_NAME_LEN]; - while (i < LTTNG_SYMBOL_NAME_LEN && inputstr[i] != '\0') { + /* + * Loop up to LTTNG_SYMBOL_NAME_LEN minus one because the NULL bytes is + * added at the end of the loop so a the upper bound we avoid the overflow. + */ + while (i < (LTTNG_SYMBOL_NAME_LEN - 1) && inputstr[i] != '\0') { str[i] = toupper(inputstr[i]); i++; } @@ -336,7 +340,7 @@ static int enable_events(char *session_name) } else if (opt_userspace) { dom.type = LTTNG_DOMAIN_UST; /* Default. */ - dom.buf_type = LTTNG_BUFFER_PER_PID; + dom.buf_type = LTTNG_BUFFER_PER_UID; } else { ERR("Please specify a tracer (-k/--kernel or -u/--userspace)"); ret = CMD_ERROR; @@ -438,7 +442,6 @@ static int enable_events(char *session_name) ret = lttng_enable_event_with_filter(handle, &ev, channel_name, opt_filter); if (ret < 0) { - fprintf(stderr, "Ret filter: %d\n", ret); switch (-ret) { case LTTNG_ERR_FILTER_EXIST: WARN("Filter on events is already enabled" @@ -447,9 +450,8 @@ static int enable_events(char *session_name) break; case LTTNG_ERR_FILTER_INVAL: case LTTNG_ERR_FILTER_NOMEM: - ERR("%s", lttng_strerror(ret)); default: - ERR("Setting filter: '%s'", opt_filter); + ERR("%s", lttng_strerror(ret)); break; } goto error;