blob: 40881b0c6a0b8de58f9d9428248bd1ef6fa66dc7 (
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
# Tests uaddr in function call and return probes. For a call probe we
# expect the address to be in the function; for a return probe it
# should be in the function's caller.
set test "uprobe_uaddr"
# Only run on make installcheck and uprobes present.
if {! [installtest_p]} { untested "$test"; return }
if {! [uprobes_p]} { untested "$test"; return }
set testpath "$srcdir/$subdir"
set testsrc "$testpath/uprobe_stmt_num.c"
set testexe "[pwd]/$test"
# We want debug info and no optimization (every line counts).
set testflags "additional_flags=-g additional_flags=-O0"
set teststp "$testpath/$test.stp"
set res [target_compile $testsrc $testexe executable $testflags]
if { $res != "" } {
verbose "target_compile failed: $res" 2
fail "unable to compile $testsrc"
return
}
set cmd [concat stap -c $testexe $teststp]
send_log "cmd: $cmd\n"
catch {eval exec $cmd} output
send_log "cmd output:\n $output\n"
set output_lines [split $output "\n"]
set lines [llength $output_lines]
if { $lines == 6 } {
pass "$test"
} else {
fail "$test ($lines)"
}
set result_funcs [list "main *" "func *" "func2 *" "func *" "main *"]
foreach expected $result_funcs output $output_lines {
if {$expected != ""} {
if [string match $expected $output] {
pass "$test"
} else {
fail "$test $output"
}
} else {
break;
}
}
if [string match "main *" [lindex $output_lines 5]] {
fail "$test return from main"
} else {
pass "$test"
}
|