set test "stmtvars"
# PR 5787

set pc 0
set vars ""
spawn stap -e "probe kernel.function(\"do_sys_open\") {\$foo}" -p4 -vv -u
expect {
    -re {probe do_sys_open[^\r\n]*pc=(0x[^\r\n]*)\r\n} { set pc $expect_out(1,string); exp_continue }
    -re {alternatives: ([^\r\n]*)\): identifier [^\r\n]*\r\n} { set vars $expect_out(1,string); exp_continue }
    timeout { fail "$test (timeout)" }
    eof
    }
catch {close}; catch {wait}

verbose -log "pc=$pc vars=$vars"
if {$pc != 0 && $vars != ""} { pass "$test - .function" } { fail "$test - .function" }

set pc2 0
set vars2 ""
spawn stap -e "probe kernel.statement($pc) {\$foo}" -p4 -vv -u
expect {
    -re {probe do_sys_open[^\r\n]*pc=(0x[^\r\n]*)\r\n} { set pc2 $expect_out(1,string); exp_continue }
    -re {alternatives: ([^\r\n]*)\): identifier [^\r\n]*\r\n} { set vars2 $expect_out(1,string); exp_continue }
    timeout { fail "$test (timeout)" }
    eof
    }
catch {close}; catch {wait}

verbose -log "pc2=$pc2 vars2=$vars2"
if {$pc == $pc2 && $vars == $vars2} { pass $test } { fail $test }
