| 1 |
# DW_AT_const_value (blocks). |
| 2 |
set test "const_value" |
| 3 |
set ::result_string {i: 2 |
| 4 |
j: 21 |
| 5 |
a: {17, 23}} |
| 6 |
|
| 7 |
set test_flags "additional_flags=-g" |
| 8 |
# We need -O2 to get const_value encodings in dwarf. |
| 9 |
set test_flags "$test_flags additional_flags=-O2" |
| 10 |
set test_flags "$test_flags [sdt_includes]" |
| 11 |
|
| 12 |
set res [target_compile $srcdir/$subdir/$test.c $test.exe executable "$test_flags"] |
| 13 |
if { $res != "" } { |
| 14 |
verbose "target_compile failed: $res" 2 |
| 15 |
fail "$test.c compile" |
| 16 |
untested "$test" |
| 17 |
return |
| 18 |
} else { |
| 19 |
pass "$test.c compile" |
| 20 |
} |
| 21 |
|
| 22 |
# Test only when we are running an install test (can execute) and when |
| 23 |
# gcc generated DW_AT_const_values for us. We are interested in block |
| 24 |
# constant values. |
| 25 |
if {[installtest_p]} { |
| 26 |
set dw_at_c {DW_AT_const_value} |
| 27 |
if {![catch {exec readelf --debug-dump=info $test.exe | grep "$dw_at_c"}]} { |
| 28 |
foreach runtime [get_runtime_list] { |
| 29 |
if {$runtime != ""} { |
| 30 |
stap_run2 $srcdir/$subdir/$test.stp -c ./$test.exe --runtime=$runtime |
| 31 |
} elseif {[uprobes_p]} { |
| 32 |
stap_run2 $srcdir/$subdir/$test.stp -c ./$test.exe |
| 33 |
} else { |
| 34 |
untested "$test" |
| 35 |
} |
| 36 |
} |
| 37 |
} else { |
| 38 |
untested "$test (no-const-value)" |
| 39 |
} |
| 40 |
} else { |
| 41 |
untested "$test" |
| 42 |
} |
| 43 |
catch {exec rm -f $test.exe} |
| 44 |
|
| 45 |
|
| 46 |
# DW_AT_const_value (address). |
| 47 |
set test "const_value_func" |
| 48 |
set ::result_string {f: bar} |
| 49 |
|
| 50 |
set test_flags "additional_flags=-g" |
| 51 |
# We need -O2 to get const_value encodings in dwarf. |
| 52 |
set test_flags "$test_flags additional_flags=-O2" |
| 53 |
set test_flags "$test_flags [sdt_includes]" |
| 54 |
|
| 55 |
set res [target_compile $srcdir/$subdir/$test.c $test.exe executable "$test_flags"] |
| 56 |
if { $res != "" } { |
| 57 |
verbose "target_compile failed: $res" 2 |
| 58 |
fail "$test.c compile" |
| 59 |
untested "$test" |
| 60 |
return |
| 61 |
} else { |
| 62 |
pass "$test.c compile" |
| 63 |
} |
| 64 |
|
| 65 |
# Test only when we are running an install test (can execute) and when |
| 66 |
# gcc generated DW_AT_const_values for us. We are interested in pure |
| 67 |
# constant addresses. |
| 68 |
if {[installtest_p]} { |
| 69 |
set dw_at_c {DW_AT_const_value} |
| 70 |
if {![catch {exec readelf --debug-dump=info $test.exe | grep "$dw_at_c"}]} { |
| 71 |
foreach runtime [get_runtime_list] { |
| 72 |
setup_kfail 10739 "*-*-*" |
| 73 |
if {$runtime != ""} { |
| 74 |
stap_run2 $srcdir/$subdir/$test.stp -c ./$test.exe --runtime=$runtime |
| 75 |
} elseif {[uprobes_p]} { |
| 76 |
stap_run2 $srcdir/$subdir/$test.stp -c ./$test.exe |
| 77 |
} else { |
| 78 |
untested "$test" |
| 79 |
} |
| 80 |
} |
| 81 |
} else { |
| 82 |
untested "$test (no-const-value)" |
| 83 |
} |
| 84 |
} else { |
| 85 |
untested "$test" |
| 86 |
} |
| 87 |
catch {exec rm -f $test.exe} |