#! stap -p2


# NB: Most of these can't go beyond pass-2, because systemtap_session and
# task_struct are huge.  It's still useful to test that the entire beast can
# be expanded though...


global i = 1


# pretty-printing with @cast
probe begin {
    t = task_current()
    log(@cast(t, "task_struct", "kernel")$)
    log(@cast(t, "task_struct", "kernel")$$)
    log(@cast(t, "task_struct", "kernel")->fs$)
    log(@cast(t, "task_struct", "kernel")->fs$$)
    log(@cast(t, "task_struct", "kernel")->comm$)
    log(@cast(t, "task_struct", "kernel")->comm$$)
    log(@cast(t, "task_struct", "kernel")->comm[0]$)
    log(@cast(t, "task_struct", "kernel")->comm[0]$$)
    log(@cast(t, "task_struct", "kernel")->comm[i]$)
    log(@cast(t, "task_struct", "kernel")->comm[i]$$)
}

# pretty-printing in dwarf kernel context
probe kernel.function("schedule_tail")
    %( CONFIG_TRACEPOINTS == "y" %?
    # pretty-printing in tracepoints
    , kernel.trace("sched_switch")
    %)
{
    log($$vars$)
    log($$vars$$)
    log($$parms$)
    log($$parms$$)

    log($prev$)
    log($prev$$)
    log($prev->fs$)
    log($prev->fs$$)
    log($prev->comm$)
    log($prev->comm$$)
    log($prev->comm[0]$)
    log($prev->comm[0]$$)
    log($prev->comm[i]$)
    log($prev->comm[i]$$)
}
