Revert "Update loglevel ABI"
authorDavid Goulet <dgoulet@efficios.com>
Wed, 1 Feb 2012 18:43:05 +0000 (13:43 -0500)
committerDavid Goulet <dgoulet@efficios.com>
Wed, 1 Feb 2012 18:43:05 +0000 (13:43 -0500)
Segfault on lttng enable-event when no loglevel is specified.

UST tests failed.

This implementation forces a loglevel to each event which is fine
however the default level is never set when no loglevel is specified.

The internal UST ABI/API (used when lttng-ust is disabled) was not
updated also making it fail when disablin the lttng-ust support.

This broke too much stuff in lttng-tools so the commit is reverted and
test must pass before commiting it again.

lttng-ust HEAD will *NOT* work with lttng-tools head so stay on commit
939950af98d044a3b0632cad5293f91cb1493ef8 for UST.

This reverts commit dad47fc4c65ec0acbfedc676895833b465d25cd6.

Signed-off-by: David Goulet <dgoulet@efficios.com>
include/lttng/lttng.h
src/bin/lttng-sessiond/lttng-ust-abi.h
src/bin/lttng-sessiond/main.c
src/bin/lttng-sessiond/trace-ust.c
src/bin/lttng-sessiond/ust-app.c
src/bin/lttng/commands/enable_events.c
src/bin/lttng/commands/list.c

index 433d2d804829749b2909b2485213b1c06607377f..a791338c89d5948eea001d7624d585e02dd70bfb 100644 (file)
@@ -65,14 +65,7 @@ enum lttng_event_type {
        LTTNG_EVENT_FUNCTION_ENTRY            = 3,
        LTTNG_EVENT_NOOP                      = 4,
        LTTNG_EVENT_SYSCALL                   = 5,
-};
-
-/*
- * Loglevel information.
- */
-enum lttng_loglevel_type {
-       LTTNG_EVENT_LOGLEVEL                  = 0,
-       LTTNG_EVENT_LOGLEVEL_ONLY             = 1,
+       LTTNG_EVENT_TRACEPOINT_LOGLEVEL       = 6,
 };
 
 /*
@@ -148,13 +141,10 @@ struct lttng_event_function_attr {
  * Generic lttng event
  */
 struct lttng_event {
-       enum lttng_event_type type;
        char name[LTTNG_SYMBOL_NAME_LEN];
-
-       enum lttng_loglevel_type loglevel_type;
        char loglevel[LTTNG_SYMBOL_NAME_LEN];
-       int64_t loglevel_value;         /* for printing */
-
+       int64_t loglevel_value;
+       enum lttng_event_type type;
        uint32_t enabled;
        pid_t pid;
        /* Per event type configuration */
index 28962aaf747dd3a7107033b2dc2a99f49d423343..f30dbde3f92e76f76ba6480a6f644ccd504e6c5e 100644 (file)
@@ -22,11 +22,7 @@ enum lttng_ust_instrumentation {
        LTTNG_UST_TRACEPOINT            = 0,
        LTTNG_UST_PROBE                 = 1,
        LTTNG_UST_FUNCTION              = 2,
-};
-
-enum lttng_ust_loglevel_type {
-       LTTNG_UST_LOGLEVEL              = 0,
-       LTTNG_UST_LOGLEVEL_ONLY         = 1,
+       LTTNG_UST_TRACEPOINT_LOGLEVEL   = 3,
 };
 
 enum lttng_ust_output {
@@ -49,12 +45,8 @@ struct lttng_ust_channel {
 };
 
 struct lttng_ust_event {
-       enum lttng_ust_instrumentation instrumentation;
        char name[LTTNG_UST_SYM_NAME_LEN];      /* event name */
-
-       enum lttng_ust_loglevel_type loglevel_type;
-       char loglevel[LTTNG_UST_SYM_NAME_LEN];  /* loglevel name */
-
+       enum lttng_ust_instrumentation instrumentation;
        /* Per instrumentation type configuration */
        union {
        } u;
index 8e4afb00ba0827295d86f53ed728763eb5ebe463..8304de8be394ca034f0726f622fdebe865c7c5df 100644 (file)
@@ -2031,15 +2031,8 @@ static int list_lttng_ust_global_events(char *channel_name,
                case LTTNG_UST_FUNCTION:
                        tmp[i].type = LTTNG_EVENT_FUNCTION;
                        break;
-               }
-               strncpy(tmp[i].loglevel, uevent->attr.loglevel, LTTNG_SYMBOL_NAME_LEN);
-               tmp[i].loglevel[LTTNG_SYMBOL_NAME_LEN - 1] = '\0';
-               switch (uevent->attr.loglevel_type) {
-               case LTTNG_UST_LOGLEVEL:
-                       tmp[i].type = LTTNG_EVENT_LOGLEVEL;
-                       break;
-               case LTTNG_UST_LOGLEVEL_ONLY:
-                       tmp[i].type = LTTNG_EVENT_LOGLEVEL_ONLY;
+               case LTTNG_UST_TRACEPOINT_LOGLEVEL:
+                       tmp[i].type = LTTNG_EVENT_TRACEPOINT_LOGLEVEL;
                        break;
                }
                i++;
index 0a90cac0ec13aa1d71049d9053217ab0fde0fffe..0858f47d53b29ea598f94471b4271d029ba1a2bd 100644 (file)
@@ -213,6 +213,9 @@ struct ltt_ust_event *trace_ust_create_event(struct lttng_event *ev)
        case LTTNG_EVENT_TRACEPOINT:
                lue->attr.instrumentation = LTTNG_UST_TRACEPOINT;
                break;
+       case LTTNG_EVENT_TRACEPOINT_LOGLEVEL:
+               lue->attr.instrumentation = LTTNG_UST_TRACEPOINT_LOGLEVEL;
+               break;
        default:
                ERR("Unknown ust instrumentation type (%d)", ev->type);
                goto error_free_event;
@@ -222,22 +225,6 @@ struct ltt_ust_event *trace_ust_create_event(struct lttng_event *ev)
        strncpy(lue->attr.name, ev->name, LTTNG_UST_SYM_NAME_LEN);
        lue->attr.name[LTTNG_UST_SYM_NAME_LEN - 1] = '\0';
 
-       switch (ev->loglevel_type) {
-       case LTTNG_EVENT_LOGLEVEL:
-               lue->attr.loglevel_type = LTTNG_UST_LOGLEVEL;
-               break;
-       case LTTNG_EVENT_LOGLEVEL_ONLY:
-               lue->attr.loglevel_type = LTTNG_UST_LOGLEVEL_ONLY;
-               break;
-       default:
-               ERR("Unknown ust loglevel type (%d)", ev->type);
-               goto error_free_event;
-       }
-
-       /* Copy loglevel name */
-       strncpy(lue->attr.loglevel, ev->loglevel, LTTNG_UST_SYM_NAME_LEN);
-       lue->attr.loglevel[LTTNG_UST_SYM_NAME_LEN - 1] = '\0';
-
        /* Init node */
        lttng_ht_node_init_str(&lue->node, lue->attr.name);
        /* Alloc context hash tables */
index 8e329a29f08adb661b2c053b3c361b616aa64027..39dd9ba36e004e448915239063a1ddcf34253671 100644 (file)
@@ -1421,8 +1421,8 @@ int ust_app_list_events(struct lttng_event **events)
                        }
                        memcpy(tmp[count].name, uiter.name, LTTNG_UST_SYM_NAME_LEN);
                        memcpy(tmp[count].loglevel, uiter.loglevel, LTTNG_UST_SYM_NAME_LEN);
-                       tmp[count].type = LTTNG_UST_TRACEPOINT;
                        tmp[count].loglevel_value = uiter.loglevel_value;
+                       tmp[count].type = LTTNG_UST_TRACEPOINT;
                        tmp[count].pid = app->key.pid;
                        tmp[count].enabled = -1;
                        count++;
index 0fa3e916c835b48e2d9228ac8c86ee1e0e4a5dcf..3f30ab8ba5156449ee3dba7084f957bbf7027664 100644 (file)
@@ -31,8 +31,6 @@
 
 static char *opt_event_list;
 static int opt_event_type;
-static const char *opt_loglevel;
-static int opt_loglevel_type;
 static int opt_kernel;
 static char *opt_session_name;
 static int opt_userspace;
@@ -55,8 +53,7 @@ enum {
        OPT_FUNCTION_ENTRY,
        OPT_SYSCALL,
        OPT_USERSPACE,
-       OPT_LOGLEVEL,
-       OPT_LOGLEVEL_ONLY,
+       OPT_TRACEPOINT_LOGLEVEL,
        OPT_LIST_OPTIONS,
 };
 
@@ -87,8 +84,7 @@ static struct poptOption long_options[] = {
        {"function:entry", 0,   POPT_ARG_STRING, &opt_function_entry_symbol, OPT_FUNCTION_ENTRY, 0, 0},
 #endif
        {"syscall",        0,   POPT_ARG_NONE, 0, OPT_SYSCALL, 0, 0},
-       {"loglevel",       0,     POPT_ARG_STRING, 0, OPT_LOGLEVEL, 0, 0},
-       {"loglevel-only",  0,     POPT_ARG_STRING, 0, OPT_LOGLEVEL_ONLY, 0, 0},
+       {"loglevel",     0,     POPT_ARG_NONE, 0, OPT_TRACEPOINT_LOGLEVEL, 0, 0},
        {"list-options", 0, POPT_ARG_NONE, NULL, OPT_LIST_OPTIONS, NULL, NULL},
        {0, 0, 0, 0, 0, 0, 0}
 };
@@ -122,10 +118,7 @@ static void usage(FILE *ofp)
        fprintf(ofp, "                             e.g.:\n");
        fprintf(ofp, "                               \"*\"\n");
        fprintf(ofp, "                               \"app_component:na*\"\n");
-       fprintf(ofp, "    --loglevel name\n");
-       fprintf(ofp, "                           Tracepoint loglevel (range: 0 to loglevel)\n");
-       fprintf(ofp, "    --loglevel-only name\n");
-       fprintf(ofp, "                           Tracepoint loglevel (only this loglevel)\n");
+       fprintf(ofp, "    --loglevel             Tracepoint loglevel\n");
        fprintf(ofp, "    --probe [addr | symbol | symbol+offset]\n");
        fprintf(ofp, "                           Dynamic probe.\n");
        fprintf(ofp, "                           Addr and offset can be octal (0NNN...),\n");
@@ -340,16 +333,6 @@ static int enable_events(char *session_name)
                                ret = CMD_UNDEFINED;
                                goto error;
                        }
-
-                       if (opt_loglevel[0] != '\0') {
-                               MSG("Kernel loglevels are not supported.");
-                               ret = CMD_UNDEFINED;
-                               goto error;
-                       }
-
-                       /* kernel loglevels not implemented */
-                       ev.loglevel_type = opt_loglevel_type;
-                       ev.loglevel[0] = '\0';
                } else if (opt_userspace) {             /* User-space tracer action */
 #if 0
                        if (opt_cmd_name != NULL || opt_pid) {
@@ -371,6 +354,12 @@ static int enable_events(char *session_name)
                                strncpy(ev.name, event_name, LTTNG_SYMBOL_NAME_LEN);
                                ev.name[LTTNG_SYMBOL_NAME_LEN - 1] = '\0';
                                break;
+                       case LTTNG_EVENT_TRACEPOINT_LOGLEVEL:
+                               /* Copy name and type of the event */
+                               ev.type = LTTNG_EVENT_TRACEPOINT_LOGLEVEL;
+                               strncpy(ev.name, event_name, LTTNG_SYMBOL_NAME_LEN);
+                               ev.name[LTTNG_SYMBOL_NAME_LEN - 1] = '\0';
+                               break;
                        case LTTNG_EVENT_PROBE:
                        case LTTNG_EVENT_FUNCTION:
                        case LTTNG_EVENT_FUNCTION_ENTRY:
@@ -379,10 +368,6 @@ static int enable_events(char *session_name)
                                ret = CMD_UNDEFINED;
                                goto error;
                        }
-
-                       ev.loglevel_type = opt_loglevel_type;
-                       strncpy(ev.loglevel, opt_loglevel, LTTNG_SYMBOL_NAME_LEN);
-                       ev.loglevel[LTTNG_SYMBOL_NAME_LEN - 1] = '\0';
                } else {
                        ERR("Please specify a tracer (-k/--kernel or -u/--userspace)");
                        goto error;
@@ -447,13 +432,8 @@ int cmd_enable_events(int argc, const char **argv)
                case OPT_USERSPACE:
                        opt_userspace = 1;
                        break;
-               case OPT_LOGLEVEL:
-                       opt_loglevel_type = LTTNG_EVENT_LOGLEVEL;
-                       opt_loglevel = poptGetOptArg(pc);
-                       break;
-               case OPT_LOGLEVEL_ONLY:
-                       opt_loglevel_type = LTTNG_EVENT_LOGLEVEL_ONLY;
-                       opt_loglevel = poptGetOptArg(pc);
+               case OPT_TRACEPOINT_LOGLEVEL:
+                       opt_event_type = LTTNG_EVENT_TRACEPOINT_LOGLEVEL;
                        break;
                case OPT_LIST_OPTIONS:
                        list_cmd_options(stdout, long_options);
index 4b8a07c48fc6aa29dc316711f8cf0774c6fbe334..701ce83c05ba5e2e8715b1eb6aa5ecf8735719e4 100644 (file)
@@ -179,9 +179,8 @@ static void print_events(struct lttng_event *event)
 
                        ret = snprintf(ll_value, LTTNG_SYMBOL_NAME_LEN,
                                " (%lld)", (long long) event->loglevel_value);
-                       if (ret < 0) {
+                       if (ret < 0)
                                ERR("snprintf error");
-                       }
                }
                MSG("%s%s%s%s%s%s (type: tracepoint)%s", indent6,
                                event->name,
@@ -216,6 +215,11 @@ static void print_events(struct lttng_event *event)
                MSG("%s (type: noop)%s", indent6,
                                enabled_string(event->enabled));
                break;
+       case LTTNG_EVENT_TRACEPOINT_LOGLEVEL:
+               MSG("%s%s (type: tracepoint loglevel)%s", indent6,
+                       event->name,
+                       enabled_string(event->enabled));
+               break;
        case LTTNG_EVENT_ALL:
                /* We should never have "all" events in list. */
                assert(0);
This page took 0.033607 seconds and 4 git commands to generate.