return tp->symbol ? tp->symbol : "unknown";
}
-static __kprobes long probe_offset(struct trace_probe *tp)
+static __kprobes unsigned int probe_offset(struct trace_probe *tp)
{
return (probe_is_return(tp)) ? tp->rp.kp.offset : tp->kp.offset;
}
return (probe_is_return(tp)) ? tp->rp.kp.addr : tp->kp.addr;
}
-static int trace_arg_string(char *buf, size_t n, struct fetch_func *ff)
+static int probe_arg_string(char *buf, size_t n, struct fetch_func *ff)
{
int ret = -EINVAL;
if (ret >= n)
goto end;
l += ret;
- ret = trace_arg_string(buf + l, n - l, &id->orig);
+ ret = probe_arg_string(buf + l, n - l, &id->orig);
if (ret < 0)
goto end;
l += ret;
}
/* Split symbol and offset. */
-static int split_symbol_offset(char *symbol, long *offset)
+static int split_symbol_offset(char *symbol, unsigned long *offset)
{
char *tmp;
int ret;
return -EINVAL;
tmp = strchr(symbol, '+');
- if (!tmp)
- tmp = strchr(symbol, '-');
-
if (tmp) {
/* skip sign because strict_strtol doesn't accept '+' */
- ret = strict_strtol(tmp + 1, 0, offset);
+ ret = strict_strtoul(tmp + 1, 0, offset);
if (ret)
return ret;
- if (*tmp == '-')
- *offset = -(*offset);
*tmp = '\0';
} else
*offset = 0;
#define PARAM_MAX_ARGS 16
#define PARAM_MAX_STACK (THREAD_SIZE / sizeof(unsigned long))
-static int parse_trace_arg(char *arg, struct fetch_func *ff, int is_return)
+static int parse_probe_arg(char *arg, struct fetch_func *ff, int is_return)
{
int ret = 0;
unsigned long param;
if (!id)
return -ENOMEM;
id->offset = offset;
- ret = parse_trace_arg(arg, &id->orig, is_return);
+ ret = parse_probe_arg(arg, &id->orig, is_return);
if (ret)
kfree(id);
else {
{
/*
* Argument syntax:
- * - Add kprobe: p[:EVENT] SYMBOL[+OFFS|-OFFS]|ADDRESS [FETCHARGS]
+ * - Add kprobe: p[:EVENT] SYMBOL[+OFFS]|ADDRESS [FETCHARGS]
* - Add kretprobe: r[:EVENT] SYMBOL[+0] [FETCHARGS]
* Fetch args:
* aN : fetch Nth of function argument. (N:0-)
int i, ret = 0;
int is_return = 0;
char *symbol = NULL, *event = NULL;
- long offset = 0;
+ unsigned long offset = 0;
void *addr = NULL;
if (argc < 2)
if (tp->symbol) {
kp->symbol_name = tp->symbol;
- kp->offset = offset;
+ kp->offset = (unsigned int)offset;
} else
kp->addr = addr;
ret = -ENOSPC;
goto error;
}
- ret = parse_trace_arg(argv[i], &tp->args[i], is_return);
+ ret = parse_probe_arg(argv[i], &tp->args[i], is_return);
if (ret)
goto error;
}
seq_printf(m, ":%s", tp->call.name);
if (tp->symbol)
- seq_printf(m, " %s%+ld", probe_symbol(tp), probe_offset(tp));
+ seq_printf(m, " %s+%u", probe_symbol(tp), probe_offset(tp));
else
seq_printf(m, " 0x%p", probe_address(tp));
for (i = 0; i < tp->nr_args; i++) {
- ret = trace_arg_string(buf, MAX_ARGSTR_LEN, &tp->args[i]);
+ ret = probe_arg_string(buf, MAX_ARGSTR_LEN, &tp->args[i]);
if (ret < 0) {
pr_warning("Argument%d decoding error(%d).\n", i, ret);
return ret;
struct trace_probe *tp = container_of(kp, struct trace_probe, kp);
struct kprobe_trace_entry *entry;
struct ring_buffer_event *event;
+ struct ring_buffer *buffer;
int size, i, pc;
unsigned long irq_flags;
struct ftrace_event_call *call = &tp->call;
size = SIZEOF_KPROBE_TRACE_ENTRY(tp->nr_args);
- event = trace_current_buffer_lock_reserve(call->id, size,
+ event = trace_current_buffer_lock_reserve(&buffer, call->id, size,
irq_flags, pc);
if (!event)
return 0;
for (i = 0; i < tp->nr_args; i++)
entry->args[i] = call_fetch(&tp->args[i], regs);
- if (!filter_current_check_discard(call, entry, event))
- trace_nowake_buffer_unlock_commit(event, irq_flags, pc);
+ if (!filter_current_check_discard(buffer, call, entry, event))
+ trace_nowake_buffer_unlock_commit(buffer, event, irq_flags, pc);
return 0;
}
struct trace_probe *tp = container_of(ri->rp, struct trace_probe, rp);
struct kretprobe_trace_entry *entry;
struct ring_buffer_event *event;
+ struct ring_buffer *buffer;
int size, i, pc;
unsigned long irq_flags;
struct ftrace_event_call *call = &tp->call;
size = SIZEOF_KRETPROBE_TRACE_ENTRY(tp->nr_args);
- event = trace_current_buffer_lock_reserve(call->id, size,
+ event = trace_current_buffer_lock_reserve(&buffer, call->id, size,
irq_flags, pc);
if (!event)
return 0;
for (i = 0; i < tp->nr_args; i++)
entry->args[i] = call_fetch(&tp->args[i], regs);
- if (!filter_current_check_discard(call, entry, event))
- trace_nowake_buffer_unlock_commit(event, irq_flags, pc);
+ if (!filter_current_check_discard(buffer, call, entry, event))
+ trace_nowake_buffer_unlock_commit(buffer, event, irq_flags, pc);
return 0;
}
static int probe_event_raw_init(struct ftrace_event_call *event_call)
{
INIT_LIST_HEAD(&event_call->fields);
- init_preds(event_call);
+
return 0;
}
sprintf(buf, "arg%d", i);
DEFINE_FIELD(unsigned long, args[i], buf, 0);
/* Set argument string as an alias field */
- ret = trace_arg_string(buf, MAX_ARGSTR_LEN, &tp->args[i]);
+ ret = probe_arg_string(buf, MAX_ARGSTR_LEN, &tp->args[i]);
if (ret < 0)
return ret;
DEFINE_FIELD(unsigned long, args[i], buf, 0);
sprintf(buf, "arg%d", i);
DEFINE_FIELD(unsigned long, args[i], buf, 0);
/* Set argument string as an alias field */
- ret = trace_arg_string(buf, MAX_ARGSTR_LEN, &tp->args[i]);
+ ret = probe_arg_string(buf, MAX_ARGSTR_LEN, &tp->args[i]);
if (ret < 0)
return ret;
DEFINE_FIELD(unsigned long, args[i], buf, 0);
/* Show aliases */
for (i = 0; i < tp->nr_args; i++) {
- ret = trace_arg_string(buf, MAX_ARGSTR_LEN, &tp->args[i]);
+ ret = probe_arg_string(buf, MAX_ARGSTR_LEN, &tp->args[i]);
if (ret < 0)
return ret;
if (!trace_seq_printf(s, "\talias: %s;\toriginal: arg%d;\n",