Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 169418
b: refs/heads/master
c: 2fba0c8
h: refs/heads/master
v: v3
  • Loading branch information
Masami Hiramatsu authored and Frederic Weisbecker committed Sep 11, 2009
1 parent 1ed2db6 commit 0f43344
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 20 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ad5cafcdb09c57008c990edd309c0a563b09f238
refs/heads/master: 2fba0c8867af47f6455490e7b59e512dd180c027
14 changes: 7 additions & 7 deletions trunk/Documentation/trace/kprobetrace.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ probe events via /sys/kernel/debug/tracing/events/kprobes/<EVENT>/filter.

Synopsis of kprobe_events
-------------------------
p[:EVENT] SYMBOL[+offs|-offs]|MEMADDR [FETCHARGS] : Set a probe
r[:EVENT] SYMBOL[+0] [FETCHARGS] : Set a return probe
p[:EVENT] SYMBOL[+offs]|MEMADDR [FETCHARGS] : Set a probe
r[:EVENT] SYMBOL[+0] [FETCHARGS] : Set a return probe

EVENT : Event name. If omitted, the event name is generated
based on SYMBOL+offs or MEMADDR.
SYMBOL[+offs|-offs] : Symbol+offset where the probe is inserted.
MEMADDR : Address where the probe is inserted.
EVENT : Event name. If omitted, the event name is generated
based on SYMBOL+offs or MEMADDR.
SYMBOL[+offs] : Symbol+offset where the probe is inserted.
MEMADDR : Address where the probe is inserted.

FETCHARGS : Arguments. Each probe can have up to 128 args.
FETCHARGS : Arguments. Each probe can have up to 128 args.
%REG : Fetch register REG
sN : Fetch Nth entry of stack (N >= 0)
sa : Fetch stack address.
Expand Down
19 changes: 7 additions & 12 deletions trunk/kernel/trace/trace_kprobe.c
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ static __kprobes const char *probe_symbol(struct trace_probe *tp)
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;
}
Expand Down Expand Up @@ -380,7 +380,7 @@ static int register_trace_probe(struct trace_probe *tp)
}

/* 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;
Expand All @@ -389,16 +389,11 @@ static int split_symbol_offset(char *symbol, long *offset)
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;
Expand Down Expand Up @@ -520,7 +515,7 @@ static int create_trace_probe(int argc, char **argv)
{
/*
* 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-)
Expand All @@ -539,7 +534,7 @@ static int create_trace_probe(int argc, char **argv)
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)
Expand Down Expand Up @@ -605,7 +600,7 @@ static int create_trace_probe(int argc, char **argv)

if (tp->symbol) {
kp->symbol_name = tp->symbol;
kp->offset = offset;
kp->offset = (unsigned int)offset;
} else
kp->addr = addr;

Expand Down Expand Up @@ -675,7 +670,7 @@ static int probes_seq_show(struct seq_file *m, void *v)
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));

Expand Down

0 comments on commit 0f43344

Please sign in to comment.