aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/trace/kprobetrace.txt13
-rw-r--r--kernel/trace/trace_kprobe.c11
2 files changed, 6 insertions, 18 deletions
diff --git a/Documentation/trace/kprobetrace.txt b/Documentation/trace/kprobetrace.txt
index 33f531858c56..4208253b5a53 100644
--- a/Documentation/trace/kprobetrace.txt
+++ b/Documentation/trace/kprobetrace.txt
@@ -1,4 +1,4 @@
1 Kprobe-based Event Tracer 1 Kprobe-based Event Tracer
2 ========================= 2 =========================
3 3
4 Documentation is written by Masami Hiramatsu 4 Documentation is written by Masami Hiramatsu
@@ -42,7 +42,6 @@ Synopsis of kprobe_events
42 $sa : Fetch stack address. 42 $sa : Fetch stack address.
43 $aN : Fetch function argument. (N >= 0)(*) 43 $aN : Fetch function argument. (N >= 0)(*)
44 $rv : Fetch return value.(**) 44 $rv : Fetch return value.(**)
45 $ra : Fetch return address.(**)
46 +|-offs(FETCHARG) : Fetch memory at FETCHARG +|- offs address.(***) 45 +|-offs(FETCHARG) : Fetch memory at FETCHARG +|- offs address.(***)
47 NAME=FETCHARG: Set NAME as the argument name of FETCHARG. 46 NAME=FETCHARG: Set NAME as the argument name of FETCHARG.
48 47
@@ -91,10 +90,10 @@ as below.
911st to 4th arguments as "myprobe" event. As this example shows, users can 901st to 4th arguments as "myprobe" event. As this example shows, users can
92choose more familiar names for each arguments. 91choose more familiar names for each arguments.
93 92
94 echo r:myretprobe do_sys_open $rv $ra >> /sys/kernel/debug/tracing/kprobe_events 93 echo r:myretprobe do_sys_open $rv >> /sys/kernel/debug/tracing/kprobe_events
95 94
96 This sets a kretprobe on the return point of do_sys_open() function with 95 This sets a kretprobe on the return point of do_sys_open() function with
97recording return value and return address as "myretprobe" event. 96recording return value as "myretprobe" event.
98 You can see the format of these events via 97 You can see the format of these events via
99/sys/kernel/debug/tracing/events/kprobes/<EVENT>/format. 98/sys/kernel/debug/tracing/events/kprobes/<EVENT>/format.
100 99
@@ -138,11 +137,11 @@ events, you need to enable it.
138# TASK-PID CPU# TIMESTAMP FUNCTION 137# TASK-PID CPU# TIMESTAMP FUNCTION
139# | | | | | 138# | | | | |
140 <...>-1447 [001] 1038282.286875: myprobe: (do_sys_open+0x0/0xd6) dfd=3 filename=7fffd1ec4440 flags=8000 mode=0 139 <...>-1447 [001] 1038282.286875: myprobe: (do_sys_open+0x0/0xd6) dfd=3 filename=7fffd1ec4440 flags=8000 mode=0
141 <...>-1447 [001] 1038282.286878: myretprobe: (sys_openat+0xc/0xe <- do_sys_open) $rv=fffffffffffffffe $ra=ffffffff81367a3a 140 <...>-1447 [001] 1038282.286878: myretprobe: (sys_openat+0xc/0xe <- do_sys_open) $rv=fffffffffffffffe
142 <...>-1447 [001] 1038282.286885: myprobe: (do_sys_open+0x0/0xd6) dfd=ffffff9c filename=40413c flags=8000 mode=1b6 141 <...>-1447 [001] 1038282.286885: myprobe: (do_sys_open+0x0/0xd6) dfd=ffffff9c filename=40413c flags=8000 mode=1b6
143 <...>-1447 [001] 1038282.286915: myretprobe: (sys_open+0x1b/0x1d <- do_sys_open) $rv=3 $ra=ffffffff81367a3a 142 <...>-1447 [001] 1038282.286915: myretprobe: (sys_open+0x1b/0x1d <- do_sys_open) $rv=3
144 <...>-1447 [001] 1038282.286969: myprobe: (do_sys_open+0x0/0xd6) dfd=ffffff9c filename=4041c6 flags=98800 mode=10 143 <...>-1447 [001] 1038282.286969: myprobe: (do_sys_open+0x0/0xd6) dfd=ffffff9c filename=4041c6 flags=98800 mode=10
145 <...>-1447 [001] 1038282.286976: myretprobe: (sys_open+0x1b/0x1d <- do_sys_open) $rv=3 $ra=ffffffff81367a3a 144 <...>-1447 [001] 1038282.286976: myretprobe: (sys_open+0x1b/0x1d <- do_sys_open) $rv=3
146 145
147 146
148 Each line shows when the kernel hits an event, and <- SYMBOL means kernel 147 Each line shows when the kernel hits an event, and <- SYMBOL means kernel
diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
index f63ead0cc5cf..ba6d3bd48889 100644
--- a/kernel/trace/trace_kprobe.c
+++ b/kernel/trace/trace_kprobe.c
@@ -85,11 +85,6 @@ static __kprobes unsigned long fetch_retvalue(struct pt_regs *regs,
85 return regs_return_value(regs); 85 return regs_return_value(regs);
86} 86}
87 87
88static __kprobes unsigned long fetch_ip(struct pt_regs *regs, void *dummy)
89{
90 return instruction_pointer(regs);
91}
92
93static __kprobes unsigned long fetch_stack_address(struct pt_regs *regs, 88static __kprobes unsigned long fetch_stack_address(struct pt_regs *regs,
94 void *dummy) 89 void *dummy)
95{ 90{
@@ -234,8 +229,6 @@ static int probe_arg_string(char *buf, size_t n, struct fetch_func *ff)
234 ret = snprintf(buf, n, "@%s%+ld", sc->symbol, sc->offset); 229 ret = snprintf(buf, n, "@%s%+ld", sc->symbol, sc->offset);
235 } else if (ff->func == fetch_retvalue) 230 } else if (ff->func == fetch_retvalue)
236 ret = snprintf(buf, n, "$rv"); 231 ret = snprintf(buf, n, "$rv");
237 else if (ff->func == fetch_ip)
238 ret = snprintf(buf, n, "$ra");
239 else if (ff->func == fetch_stack_address) 232 else if (ff->func == fetch_stack_address)
240 ret = snprintf(buf, n, "$sa"); 233 ret = snprintf(buf, n, "$sa");
241 else if (ff->func == fetch_indirect) { 234 else if (ff->func == fetch_indirect) {
@@ -448,9 +441,6 @@ static int parse_probe_vars(char *arg, struct fetch_func *ff, int is_return)
448 if (is_return && arg[1] == 'v') { 441 if (is_return && arg[1] == 'v') {
449 ff->func = fetch_retvalue; 442 ff->func = fetch_retvalue;
450 ff->data = NULL; 443 ff->data = NULL;
451 } else if (is_return && arg[1] == 'a') {
452 ff->func = fetch_ip;
453 ff->data = NULL;
454 } else 444 } else
455 ret = -EINVAL; 445 ret = -EINVAL;
456 break; 446 break;
@@ -560,7 +550,6 @@ static int create_trace_probe(int argc, char **argv)
560 * Fetch args: 550 * Fetch args:
561 * $aN : fetch Nth of function argument. (N:0-) 551 * $aN : fetch Nth of function argument. (N:0-)
562 * $rv : fetch return value 552 * $rv : fetch return value
563 * $ra : fetch return address
564 * $sa : fetch stack address 553 * $sa : fetch stack address
565 * $sN : fetch Nth of stack (N:0-) 554 * $sN : fetch Nth of stack (N:0-)
566 * @ADDR : fetch memory at ADDR (ADDR should be in kernel) 555 * @ADDR : fetch memory at ADDR (ADDR should be in kernel)