*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
+ * as published by the Free Software Foundation; only version 2
+ * of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
#include <sys/types.h>
#include <unistd.h>
-#include "cmd.h"
-#include "conf.h"
-#include "utils.h"
+#include "../cmd.h"
+#include "../conf.h"
+#include "../utils.h"
static char *opt_event_list;
static int opt_event_type;
/* Check for symbol+offset */
ret = sscanf(opt, "%[^'+']+%li", name, &hex);
if (ret == 2) {
- strncpy(ev->attr.kprobe.symbol_name, name, LTTNG_SYMBOL_NAME_LEN);
- DBG("kprobe symbol %s", ev->attr.kprobe.symbol_name);
+ strncpy(ev->attr.probe.symbol_name, name, LTTNG_SYMBOL_NAME_LEN);
+ DBG("kprobe symbol %s", ev->attr.probe.symbol_name);
if (hex == 0) {
ERR("Invalid kprobe offset %lu", hex);
ret = -1;
goto error;
}
- ev->attr.kprobe.offset = hex;
- DBG("kprobe offset %lu", ev->attr.kprobe.offset);
+ ev->attr.probe.offset = hex;
+ DBG("kprobe offset %lu", ev->attr.probe.offset);
goto error;
}
ret = -1;
goto error;
}
- ev->attr.kprobe.addr = hex;
- DBG("kprobe addr %lu", ev->attr.kprobe.addr);
+ ev->attr.probe.addr = hex;
+ DBG("kprobe addr %lu", ev->attr.probe.addr);
goto error;
}
int err, ret = CMD_SUCCESS;
char *event_name, *channel_name = NULL;
struct lttng_event ev;
+ struct lttng_domain dom;
if (set_session_name(opt_session_name) < 0) {
ret = CMD_ERROR;
channel_name = opt_channel_name;
}
+ /* Create lttng domain */
+ if (opt_kernel) {
+ dom.type = LTTNG_DOMAIN_KERNEL;
+ }
+
if (opt_enable_all) {
if (opt_kernel) {
- ret = lttng_kernel_enable_event(NULL, channel_name);
+ ret = lttng_enable_event(&dom, NULL, channel_name);
+ if (ret == 0) {
+ MSG("All kernel events are enabled in channel %s", channel_name);
+ }
goto error;
}
ev.type = opt_event_type;
switch (opt_event_type) {
- case LTTNG_EVENT_TRACEPOINTS:
- ret = lttng_kernel_enable_event(&ev, channel_name);
+ case LTTNG_EVENT_TRACEPOINT:
break;
- case LTTNG_EVENT_KPROBES:
+ case LTTNG_EVENT_PROBE:
ret = parse_kprobe_opts(&ev, opt_kprobe);
if (ret < 0) {
ERR("Unable to parse kprobe options");
ret = 0;
goto error;
}
-
- ret = lttng_kernel_enable_event(&ev, channel_name);
break;
case LTTNG_EVENT_FUNCTION:
strncpy(ev.attr.ftrace.symbol_name, opt_function_symbol, LTTNG_SYMBOL_NAME_LEN);
- ret = lttng_kernel_enable_event(&ev, channel_name);
break;
default:
ret = CMD_NOT_IMPLEMENTED;
goto error;
}
- if (ret > 0) {
+ ret = lttng_enable_event(&dom, &ev, channel_name);
+ if (ret == 0) {
MSG("Kernel event %s created in channel %s", event_name, channel_name);
+ } else if (ret < 0) {
+ ERR("Unable to find event %s", ev.name);
}
} else if (opt_userspace) { /* User-space tracer action */
/*
poptReadDefaultConfig(pc, 0);
/* Default event type */
- opt_event_type = LTTNG_KERNEL_TRACEPOINTS;
+ opt_event_type = LTTNG_EVENT_TRACEPOINT;
while ((opt = poptGetNextOpt(pc)) != -1) {
switch (opt) {
opt_cmd_name = poptGetOptArg(pc);
break;
case OPT_TRACEPOINT:
- opt_event_type = LTTNG_EVENT_TRACEPOINTS;
+ opt_event_type = LTTNG_EVENT_TRACEPOINT;
break;
case OPT_MARKER:
ret = CMD_NOT_IMPLEMENTED;
goto end;
case OPT_KPROBE:
- opt_event_type = LTTNG_EVENT_KPROBES;
+ opt_event_type = LTTNG_EVENT_PROBE;
opt_kprobe = poptGetOptArg(pc);
break;
case OPT_FUNCTION: