| .. | .. |
|---|
| 18 | 18 | However unlike kprobe-event tracer, the uprobe event interface expects the |
|---|
| 19 | 19 | user to calculate the offset of the probepoint in the object. |
|---|
| 20 | 20 | |
|---|
| 21 | +You can also use /sys/kernel/debug/tracing/dynamic_events instead of |
|---|
| 22 | +uprobe_events. That interface will provide unified access to other |
|---|
| 23 | +dynamic events too. |
|---|
| 24 | + |
|---|
| 21 | 25 | Synopsis of uprobe_tracer |
|---|
| 22 | 26 | ------------------------- |
|---|
| 23 | 27 | :: |
|---|
| 24 | 28 | |
|---|
| 25 | 29 | p[:[GRP/]EVENT] PATH:OFFSET [FETCHARGS] : Set a uprobe |
|---|
| 26 | 30 | r[:[GRP/]EVENT] PATH:OFFSET [FETCHARGS] : Set a return uprobe (uretprobe) |
|---|
| 31 | + p[:[GRP/]EVENT] PATH:OFFSET%return [FETCHARGS] : Set a return uprobe (uretprobe) |
|---|
| 27 | 32 | -:[GRP/]EVENT : Clear uprobe or uretprobe event |
|---|
| 28 | 33 | |
|---|
| 29 | 34 | GRP : Group name. If omitted, "uprobes" is the default value. |
|---|
| .. | .. |
|---|
| 31 | 36 | on PATH+OFFSET. |
|---|
| 32 | 37 | PATH : Path to an executable or a library. |
|---|
| 33 | 38 | OFFSET : Offset where the probe is inserted. |
|---|
| 39 | + OFFSET%return : Offset where the return probe is inserted. |
|---|
| 34 | 40 | |
|---|
| 35 | 41 | FETCHARGS : Arguments. Each probe can have up to 128 args. |
|---|
| 36 | 42 | %REG : Fetch register REG |
|---|
| .. | .. |
|---|
| 38 | 44 | @+OFFSET : Fetch memory at OFFSET (OFFSET from same file as PATH) |
|---|
| 39 | 45 | $stackN : Fetch Nth entry of stack (N >= 0) |
|---|
| 40 | 46 | $stack : Fetch stack address. |
|---|
| 41 | | - $retval : Fetch return value.(*) |
|---|
| 47 | + $retval : Fetch return value.(\*1) |
|---|
| 42 | 48 | $comm : Fetch current task comm. |
|---|
| 43 | | - +|-offs(FETCHARG) : Fetch memory at FETCHARG +|- offs address.(**) |
|---|
| 49 | + +|-[u]OFFS(FETCHARG) : Fetch memory at FETCHARG +|- OFFS address.(\*2)(\*3) |
|---|
| 50 | + \IMM : Store an immediate value to the argument. |
|---|
| 44 | 51 | NAME=FETCHARG : Set NAME as the argument name of FETCHARG. |
|---|
| 45 | 52 | FETCHARG:TYPE : Set TYPE as the type of FETCHARG. Currently, basic types |
|---|
| 46 | 53 | (u8/u16/u32/u64/s8/s16/s32/s64), hexadecimal types |
|---|
| 47 | 54 | (x8/x16/x32/x64), "string" and bitfield are supported. |
|---|
| 48 | 55 | |
|---|
| 49 | | - (*) only for return probe. |
|---|
| 50 | | - (**) this is useful for fetching a field of data structures. |
|---|
| 56 | + (\*1) only for return probe. |
|---|
| 57 | + (\*2) this is useful for fetching a field of data structures. |
|---|
| 58 | + (\*3) Unlike kprobe event, "u" prefix will just be ignored, becuse uprobe |
|---|
| 59 | + events can access only user-space memory. |
|---|
| 51 | 60 | |
|---|
| 52 | 61 | Types |
|---|
| 53 | 62 | ----- |
|---|
| .. | .. |
|---|
| 69 | 78 | |
|---|
| 70 | 79 | Event Profiling |
|---|
| 71 | 80 | --------------- |
|---|
| 72 | | -You can check the total number of probe hits and probe miss-hits via |
|---|
| 73 | | -/sys/kernel/debug/tracing/uprobe_profile. |
|---|
| 74 | | -The first column is event name, the second is the number of probe hits, |
|---|
| 75 | | -the third is the number of probe miss-hits. |
|---|
| 81 | +You can check the total number of probe hits per event via |
|---|
| 82 | +/sys/kernel/debug/tracing/uprobe_profile. The first column is the filename, |
|---|
| 83 | +the second is the event name, the third is the number of probe hits. |
|---|
| 76 | 84 | |
|---|
| 77 | 85 | Usage examples |
|---|
| 78 | 86 | -------------- |
|---|
| .. | .. |
|---|
| 149 | 157 | |
|---|
| 150 | 158 | # echo 1 > events/uprobes/enable |
|---|
| 151 | 159 | |
|---|
| 152 | | -Lets disable the event after sleeping for some time. |
|---|
| 160 | +Lets start tracing, sleep for some time and stop tracing. |
|---|
| 153 | 161 | :: |
|---|
| 154 | 162 | |
|---|
| 163 | + # echo 1 > tracing_on |
|---|
| 155 | 164 | # sleep 20 |
|---|
| 165 | + # echo 0 > tracing_on |
|---|
| 166 | + |
|---|
| 167 | +Also, you can disable the event by:: |
|---|
| 168 | + |
|---|
| 156 | 169 | # echo 0 > events/uprobes/enable |
|---|
| 157 | 170 | |
|---|
| 158 | 171 | And you can see the traced information via /sys/kernel/debug/tracing/trace. |
|---|