| 1 |
// Jumbo stp script |
| 2 |
// Arguments: @1 uprobes_exe, @2 libuprobes_lib.so |
| 3 |
|
| 4 |
# lib |
| 5 |
probe process(@1).function("main") { |
| 6 |
printf("main\n"); |
| 7 |
} |
| 8 |
|
| 9 |
probe process(@1).function("main_func") { |
| 10 |
printf("main_func: %d\n", $foo); |
| 11 |
} |
| 12 |
|
| 13 |
probe process(@2).function("lib_main") { |
| 14 |
printf("lib_main\n"); |
| 15 |
} |
| 16 |
|
| 17 |
probe process(@2).function("lib_func") { |
| 18 |
printf("lib_func: %d\n", $bar); |
| 19 |
} |
| 20 |
|
| 21 |
#mark |
| 22 |
probe process(@1).mark("main_count") { |
| 23 |
printf("main_count: %d\n", $arg1); |
| 24 |
} |
| 25 |
|
| 26 |
probe process(@2).mark("func_count") { |
| 27 |
printf("func_count: %d\n", $arg1); |
| 28 |
} |
| 29 |
|
| 30 |
#uname |
| 31 |
probe process(@1).function("main"), |
| 32 |
process(@1).function("main_func") { |
| 33 |
printf("exe: %s=%s\n",probefunc(), usymname(uaddr())); |
| 34 |
} |
| 35 |
|
| 36 |
probe process(@2).function("lib_main"), |
| 37 |
process(@2).function("lib_func") { |
| 38 |
printf("lib: %s=%s\n",probefunc(), usymname(uaddr())); |
| 39 |
} |
| 40 |
|
| 41 |
# ustack |
| 42 |
global hits = 0; |
| 43 |
|
| 44 |
probe process(@1).function("main_func") |
| 45 |
{ |
| 46 |
if (hits == 0) |
| 47 |
{ |
| 48 |
log("print_ubacktrace exe 0"); |
| 49 |
print_ubacktrace(); |
| 50 |
hits++; |
| 51 |
} |
| 52 |
else if (hits == 1) |
| 53 |
{ |
| 54 |
log("print_usyms exe 1"); |
| 55 |
print_usyms(ubacktrace()); |
| 56 |
hits++; |
| 57 |
} |
| 58 |
} |
| 59 |
|
| 60 |
probe process(@2).function("lib_func") |
| 61 |
{ |
| 62 |
if (hits == 2) |
| 63 |
{ |
| 64 |
log("print_ubacktrace lib 2"); |
| 65 |
print_ubacktrace(); |
| 66 |
hits++; |
| 67 |
} |
| 68 |
else if (hits == 3) |
| 69 |
{ |
| 70 |
log("print_usyms lib 3"); |
| 71 |
print_usyms(ubacktrace()); |
| 72 |
hits++; |
| 73 |
} |
| 74 |
} |