#! stap -p4

global i = 1


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

