diff options
Diffstat (limited to 'Documentation/trace')
-rw-r--r-- | Documentation/trace/kprobetrace.txt | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/Documentation/trace/kprobetrace.txt b/Documentation/trace/kprobetrace.txt index c3eff6ff945f..f30978e001f8 100644 --- a/Documentation/trace/kprobetrace.txt +++ b/Documentation/trace/kprobetrace.txt | |||
@@ -37,15 +37,12 @@ Synopsis of kprobe_events | |||
37 | @SYM[+|-offs] : Fetch memory at SYM +|- offs (SYM should be a data symbol) | 37 | @SYM[+|-offs] : Fetch memory at SYM +|- offs (SYM should be a data symbol) |
38 | $stackN : Fetch Nth entry of stack (N >= 0) | 38 | $stackN : Fetch Nth entry of stack (N >= 0) |
39 | $stack : Fetch stack address. | 39 | $stack : Fetch stack address. |
40 | $argN : Fetch function argument. (N >= 0)(*) | 40 | $retval : Fetch return value.(*) |
41 | $retval : Fetch return value.(**) | 41 | +|-offs(FETCHARG) : Fetch memory at FETCHARG +|- offs address.(**) |
42 | +|-offs(FETCHARG) : Fetch memory at FETCHARG +|- offs address.(***) | ||
43 | NAME=FETCHARG: Set NAME as the argument name of FETCHARG. | 42 | NAME=FETCHARG: Set NAME as the argument name of FETCHARG. |
44 | 43 | ||
45 | (*) aN may not correct on asmlinkaged functions and at the middle of | 44 | (*) only for return probe. |
46 | function body. | 45 | (**) this is useful for fetching a field of data structures. |
47 | (**) only for return probe. | ||
48 | (***) this is useful for fetching a field of data structures. | ||
49 | 46 | ||
50 | 47 | ||
51 | Per-Probe Event Filtering | 48 | Per-Probe Event Filtering |
@@ -82,11 +79,14 @@ Usage examples | |||
82 | To add a probe as a new event, write a new definition to kprobe_events | 79 | To add a probe as a new event, write a new definition to kprobe_events |
83 | as below. | 80 | as below. |
84 | 81 | ||
85 | echo p:myprobe do_sys_open dfd=$arg0 filename=$arg1 flags=$arg2 mode=$arg3 > /sys/kernel/debug/tracing/kprobe_events | 82 | echo p:myprobe do_sys_open dfd=%ax filename=%dx flags=%cx mode=+4($stack) > /sys/kernel/debug/tracing/kprobe_events |
86 | 83 | ||
87 | This sets a kprobe on the top of do_sys_open() function with recording | 84 | This sets a kprobe on the top of do_sys_open() function with recording |
88 | 1st to 4th arguments as "myprobe" event. As this example shows, users can | 85 | 1st to 4th arguments as "myprobe" event. Note, which register/stack entry is |
89 | choose more familiar names for each arguments. | 86 | assigned to each function argument depends on arch-specific ABI. If you unsure |
87 | the ABI, please try to use probe subcommand of perf-tools (you can find it | ||
88 | under tools/perf/). | ||
89 | As this example shows, users can choose more familiar names for each arguments. | ||
90 | 90 | ||
91 | echo r:myretprobe do_sys_open $retval >> /sys/kernel/debug/tracing/kprobe_events | 91 | echo r:myretprobe do_sys_open $retval >> /sys/kernel/debug/tracing/kprobe_events |
92 | 92 | ||
@@ -147,4 +147,3 @@ events, you need to enable it. | |||
147 | returns from SYMBOL(e.g. "sys_open+0x1b/0x1d <- do_sys_open" means kernel | 147 | returns from SYMBOL(e.g. "sys_open+0x1b/0x1d <- do_sys_open" means kernel |
148 | returns from do_sys_open to sys_open+0x1b). | 148 | returns from do_sys_open to sys_open+0x1b). |
149 | 149 | ||
150 | |||