| 1 |
#! stap -p2 |
| 2 |
|
| 3 |
probe begin { |
| 4 |
// basic @cast test, with and without specifying kernel |
| 5 |
println(@cast(0, "task_struct", "kernel")->tgid) |
| 6 |
println(@cast(0, "task_struct", "kernel")->tgid) |
| 7 |
|
| 8 |
// check module-search paths |
| 9 |
println(@cast(0, "task_struct", "foo:kernel:bar")->tgid) |
| 10 |
|
| 11 |
// would be nice to test usermode @cast too, |
| 12 |
// but who knows what debuginfo is installed... |
| 13 |
|
| 14 |
// check modules generated from headers |
| 15 |
println(@cast(0, "task_struct", "kernel<linux/sched.h>")->tgid) |
| 16 |
println(@cast(0, "timeval", "<sys/time.h>")->tv_sec) |
| 17 |
|
| 18 |
// sometimes multiple headers are needed in tandem |
| 19 |
println(@cast(0, "task_struct", "kernel<linux/sched.h><linux/fs_struct.h>")->fs->umask) |
| 20 |
|
| 21 |
// make sure that bogus @casts can get optimized away |
| 22 |
@cast(0, "task_struct")->no_such_field |
| 23 |
@cast(0, "task_struct")->parent->no_such_field |
| 24 |
@cast(0, "no_such_type")->tgid |
| 25 |
@cast(0, "task_struct", "no_such_module")->tgid |
| 26 |
|
| 27 |
// PR11556: we should be able to treat the initial pointer like an array too |
| 28 |
println(@cast(0, "task_struct", "kernel")[42]->tgid) |
| 29 |
} |