5e3cb60a9eebacfb7a946191c0bb9b6850ab96ec
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.arch / amd64-stap-expressions.exp
1 # Copyright 2021 Free Software Foundation, Inc.
2
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 3 of the License, or
6 # (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program. If not, see <http://www.gnu.org/licenses/>.
15
16 standard_testfile ".S"
17
18 if { ![istarget "x86_64-*-*"] || ![is_lp64_target] } {
19 verbose "Skipping $testfile.exp"
20 return
21 }
22
23 if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
24 return -1
25 }
26
27 # Helper procedure to go to probe NAME
28
29 proc goto_probe { name } {
30 global decimal hex
31
32 gdb_test "break -pstap $name" "Breakpoint $decimal at $hex"
33 gdb_test "continue" "Breakpoint $decimal, main \\(\\) at .*\r\n.*STAP_PROBE1.*${name},.*\\)"
34 }
35
36 # Helper procedure to test the probe's argument
37
38 proc test_probe_value { value } {
39 gdb_test "print \$_probe_argc" "= 1"
40 gdb_test "print \$_probe_arg0" "= $value"
41 }
42
43 if { ![runto_main] } {
44 return -1
45 }
46
47 # Name and expected value for each probe.
48 set probe_names_and_values {
49 { "log_neg" "0" }
50 { "minus" "-7" }
51 { "bit_neg" "-23" }
52
53 { "plus1" "4" }
54 { "plus2" "135" }
55 { "plus3" "171" }
56
57 { "and" "128" }
58 { "or" "12" }
59 }
60
61 foreach probe_info $probe_names_and_values {
62 set name [lindex $probe_info 0]
63 set value [lindex $probe_info 1]
64 with_test_prefix $name {
65 goto_probe $name
66 test_probe_value $value
67 }
68 }
This page took 0.031509 seconds and 3 git commands to generate.