summaryrefslogtreecommitdiffstats
path: root/testsuite/semok/cast.stp
blob: d3606a50cb8cb50cfd3fe8e4f9d9c18e141c203a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#! stap -p2

probe begin {
    // basic @cast test, with and without specifying kernel
    println(@cast(0, "task_struct")->tgid)
    println(@cast(0, "task_struct", "kernel")->tgid)

    // check module-search paths
    println(@cast(0, "task_struct", "foo:kernel:bar")->tgid)

    // would be nice to test usermode @cast too,
    // but who knows what debuginfo is installed...

    // check modules generated from headers
    println(@cast(0, "task_struct", "kernel<linux/sched.h>")->tgid)
    println(@cast(0, "timeval", "<sys/time.h>")->tv_sec)

    // sometimes multiple headers are needed in tandem
    println(@cast(0, "task_struct", "kernel<linux/sched.h><linux/fs_struct.h>")->fs->umask)

    // make sure that bogus @casts can get optimized away
    @cast(0, "task_struct")->no_such_field
    @cast(0, "task_struct")->parent->no_such_field
    @cast(0, "no_such_type")->tgid
    @cast(0, "task_struct", "no_such_module")->tgid
}