#! stap -p4

global i = 1


# pretty-printing with @cast
probe begin {
    t = task_current()
    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($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]$$)
}

