]>
Commit | Line | Data |
---|---|---|
0b302171 | 1 | # Copyright (C) 2011-2012 Free Software Foundation, Inc. |
e18b2753 JK |
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 | load_lib mi-support.exp | |
17 | set MIFLAGS "-i=mi2" | |
18 | ||
19 | gdb_exit | |
20 | if [mi_gdb_start] { | |
21 | continue | |
22 | } | |
23 | ||
24 | set testfile mi2-amd64-entry-value | |
25 | set srcfile ${testfile}.s | |
26 | set opts {} | |
27 | ||
28 | if [info exists COMPILE] { | |
29 | # make check RUNTESTFLAGS="gdb.mi/mi2-amd64-entry-value.exp COMPILE=1" | |
30 | set srcfile ${testfile}.c | |
31 | lappend opts debug optimize=-O2 | |
32 | } elseif { ![istarget x86_64-*-* ] || ![is_lp64_target] } { | |
33 | verbose "Skipping mi2-amd64-entry-value." | |
34 | return | |
35 | } | |
36 | ||
37 | set executable ${testfile} | |
38 | set binfile ${objdir}/${subdir}/${executable} | |
39 | ||
40 | if [build_executable ${testfile}.exp ${executable} ${srcfile} $opts] { | |
41 | return -1 | |
42 | } | |
43 | ||
44 | mi_gdb_reinitialize_dir $srcdir/$subdir | |
45 | mi_gdb_load ${binfile} | |
46 | ||
47 | foreach name {different breakhere_different breakhere_validity breakhere_invalid} { | |
48 | mi_create_breakpoint $name .* .* .* .* .* .* "break $name" | |
49 | } | |
50 | ||
51 | ||
52 | # Test various kinds of `set print entry-values'. | |
53 | ||
54 | if {[mi_runto main] == -1} { | |
55 | return -1 | |
56 | } | |
57 | mi_gdb_test "-gdb-set print entry-values no" {\^done} "no: set print entry-values" | |
58 | mi_send_resuming_command "exec-continue" "no: entry_equal: continue" | |
59 | mi_expect_stop "breakpoint-hit" .* {{name="val",value="5"}} .* .* {.* disp="keep"} "no: entry_equal: stop" | |
60 | mi_gdb_test "-stack-list-variables --all-values" {\^done,variables=\[{name="val",arg="1",value="5"}\]} "no: entry_equal: -stack-list-variables" | |
61 | mi_send_resuming_command "exec-continue" "no: entry_different: continue" | |
62 | mi_expect_stop "breakpoint-hit" .* {{name="val",value="6"}} .* .* {.* disp="keep"} "no: entry_different: stop" | |
63 | mi_gdb_test "-stack-list-variables --all-values" {\^done,variables=\[{name="val",arg="1",value="6"}\]} "no: entry_different: -stack-list-variables" | |
64 | mi_send_resuming_command "exec-continue" "no: validity: continue" | |
65 | mi_expect_stop "breakpoint-hit" .* {{name="lost",value="<optimized out>"},{name="born",value="10"}} .* .* {.* disp="keep"} "no: validity: stop" | |
66 | mi_gdb_test "-stack-list-variables --all-values" {\^done,variables=\[{name="lost",arg="1",value="<optimized out>"},{name="born",arg="1",value="10"}\]} "no: validity: -stack-list-variables" | |
67 | mi_send_resuming_command "exec-continue" "no: invalid: continue" | |
68 | mi_expect_stop "breakpoint-hit" .* {{name="inv",value="<optimized out>"}} .* .* {.* disp="keep"} "no: invalid: stop" | |
69 | mi_gdb_test "-stack-list-variables --all-values" {\^done,variables=\[{name="inv",arg="1",value="<optimized out>"}\]} "no: invalid: -stack-list-variables" | |
70 | ||
71 | if {[mi_runto main] == -1} { | |
72 | return -1 | |
73 | } | |
74 | mi_gdb_test "-gdb-set print entry-values only" {\^done} "only: set print entry-values" | |
75 | mi_send_resuming_command "exec-continue" "only: entry_equal: continue" | |
76 | mi_expect_stop "breakpoint-hit" .* {{name="val@entry",value="5"}} .* .* {.* disp="keep"} "only: entry_equal: stop" | |
77 | mi_gdb_test "-stack-list-variables --all-values" {\^done,variables=\[{name="val@entry",arg="1",value="5"}\]} "only: entry_equal: -stack-list-variables" | |
78 | mi_send_resuming_command "exec-continue" "only: entry_different: continue" | |
79 | mi_expect_stop "breakpoint-hit" .* {{name="val@entry",value="5"}} .* .* {.* disp="keep"} "only: entry_different: stop" | |
80 | mi_gdb_test "-stack-list-variables --all-values" {\^done,variables=\[{name="val@entry",arg="1",value="5"}\]} "only: entry_different: -stack-list-variables" | |
81 | mi_send_resuming_command "exec-continue" "only: validity: continue" | |
82 | mi_expect_stop "breakpoint-hit" .* {{name="lost@entry",value="5"},{name="born@entry",value="<optimized out>"}} .* .* {.* disp="keep"} "only: validity: stop" | |
83 | mi_gdb_test "-stack-list-variables --all-values" {\^done,variables=\[{name="lost@entry",arg="1",value="5"},{name="born@entry",arg="1",value="<optimized out>"}\]} "only: validity: -stack-list-variables" | |
84 | mi_send_resuming_command "exec-continue" "only: invalid: continue" | |
85 | mi_expect_stop "breakpoint-hit" .* {{name="inv@entry",value="<optimized out>"}} .* .* {.* disp="keep"} "only: invalid: stop" | |
86 | mi_gdb_test "-stack-list-variables --all-values" {\^done,variables=\[{name="inv@entry",arg="1",value="<optimized out>"}\]} "only: invalid: -stack-list-variables" | |
87 | ||
88 | if {[mi_runto main] == -1} { | |
89 | return -1 | |
90 | } | |
91 | mi_gdb_test "-gdb-set print entry-values preferred" {\^done} "preferred: set print entry-values" | |
92 | mi_send_resuming_command "exec-continue" "preferred: entry_equal: continue" | |
93 | mi_expect_stop "breakpoint-hit" .* {{name="val@entry",value="5"}} .* .* {.* disp="keep"} "preferred: entry_equal: stop" | |
94 | mi_gdb_test "-stack-list-variables --all-values" {\^done,variables=\[{name="val@entry",arg="1",value="5"}\]} "preferred: entry_equal: -stack-list-variables" | |
95 | mi_send_resuming_command "exec-continue" "preferred: entry_different: continue" | |
96 | mi_expect_stop "breakpoint-hit" .* {{name="val@entry",value="5"}} .* .* {.* disp="keep"} "preferred: entry_different: stop" | |
97 | mi_gdb_test "-stack-list-variables --all-values" {\^done,variables=\[{name="val@entry",arg="1",value="5"}\]} "preferred: entry_different: -stack-list-variables" | |
98 | mi_send_resuming_command "exec-continue" "preferred: validity: continue" | |
99 | mi_expect_stop "breakpoint-hit" .* {{name="lost@entry",value="5"},{name="born",value="10"}} .* .* {.* disp="keep"} "preferred: validity: stop" | |
100 | mi_gdb_test "-stack-list-variables --all-values" {\^done,variables=\[{name="lost@entry",arg="1",value="5"},{name="born",arg="1",value="10"}\]} "preferred: validity: -stack-list-variables" | |
101 | mi_send_resuming_command "exec-continue" "preferred: invalid: continue" | |
102 | mi_expect_stop "breakpoint-hit" .* {{name="inv@entry",value="<optimized out>"}} .* .* {.* disp="keep"} "preferred: invalid: stop" | |
103 | mi_gdb_test "-stack-list-variables --all-values" {\^done,variables=\[{name="inv@entry",arg="1",value="<optimized out>"}\]} "preferred: invalid: -stack-list-variables" | |
104 | ||
105 | if {[mi_runto main] == -1} { | |
106 | return -1 | |
107 | } | |
108 | mi_gdb_test "-gdb-set print entry-values if-needed" {\^done} "if-needed: set print entry-values" | |
109 | mi_send_resuming_command "exec-continue" "if-needed: entry_equal: continue" | |
110 | mi_expect_stop "breakpoint-hit" .* {{name="val",value="5"}} .* .* {.* disp="keep"} "if-needed: entry_equal: stop" | |
111 | mi_gdb_test "-stack-list-variables --all-values" {\^done,variables=\[{name="val",arg="1",value="5"}\]} "if-needed: entry_equal: -stack-list-variables" | |
112 | mi_send_resuming_command "exec-continue" "if-needed: entry_different: continue" | |
113 | mi_expect_stop "breakpoint-hit" .* {{name="val",value="6"}} .* .* {.* disp="keep"} "if-needed: entry_different: stop" | |
114 | mi_gdb_test "-stack-list-variables --all-values" {\^done,variables=\[{name="val",arg="1",value="6"}\]} "if-needed: entry_different: -stack-list-variables" | |
115 | mi_send_resuming_command "exec-continue" "if-needed: validity: continue" | |
116 | mi_expect_stop "breakpoint-hit" .* {{name="lost@entry",value="5"},{name="born",value="10"}} .* .* {.* disp="keep"} "if-needed: validity: stop" | |
117 | mi_gdb_test "-stack-list-variables --all-values" {\^done,variables=\[{name="lost@entry",arg="1",value="5"},{name="born",arg="1",value="10"}\]} "if-needed: validity: -stack-list-variables" | |
118 | mi_send_resuming_command "exec-continue" "if-needed: invalid: continue" | |
119 | mi_expect_stop "breakpoint-hit" .* {{name="inv",value="<optimized out>"}} .* .* {.* disp="keep"} "if-needed: invalid: stop" | |
120 | mi_gdb_test "-stack-list-variables --all-values" {\^done,variables=\[{name="inv",arg="1",value="<optimized out>"}\]} "if-needed: invalid: -stack-list-variables" | |
121 | ||
122 | if {[mi_runto main] == -1} { | |
123 | return -1 | |
124 | } | |
125 | mi_gdb_test "-gdb-set print entry-values both" {\^done} "both: set print entry-values" | |
126 | mi_send_resuming_command "exec-continue" "both: entry_equal: continue" | |
127 | mi_expect_stop "breakpoint-hit" .* {{name="val",value="5"},{name="val@entry",value="5"}} .* .* {.* disp="keep"} "both: entry_equal: stop" | |
128 | mi_gdb_test "-stack-list-variables --all-values" {\^done,variables=\[{name="val",arg="1",value="5"},{name="val@entry",arg="1",value="5"}\]} "both: entry_equal: -stack-list-variables" | |
129 | mi_send_resuming_command "exec-continue" "both: entry_different: continue" | |
130 | mi_expect_stop "breakpoint-hit" .* {{name="val",value="6"},{name="val@entry",value="5"}} .* .* {.* disp="keep"} "both: entry_different: stop" | |
131 | mi_gdb_test "-stack-list-variables --all-values" {\^done,variables=\[{name="val",arg="1",value="6"},{name="val@entry",arg="1",value="5"}\]} "both: entry_different: -stack-list-variables" | |
132 | mi_send_resuming_command "exec-continue" "both: validity: continue" | |
133 | mi_expect_stop "breakpoint-hit" .* {{name="lost",value="<optimized out>"},{name="lost@entry",value="5"},{name="born",value="10"},{name="born@entry",value="<optimized out>"}} .* .* {.* disp="keep"} "both: validity: stop" | |
134 | mi_gdb_test "-stack-list-variables --all-values" {\^done,variables=\[{name="lost",arg="1",value="<optimized out>"},{name="lost@entry",arg="1",value="5"},{name="born",arg="1",value="10"},{name="born@entry",arg="1",value="<optimized out>"}\]} "both: validity: -stack-list-variables" | |
135 | mi_send_resuming_command "exec-continue" "both: invalid: continue" | |
136 | mi_expect_stop "breakpoint-hit" .* {{name="inv",value="<optimized out>"},{name="inv@entry",value="<optimized out>"}} .* .* {.* disp="keep"} "both: invalid: stop" | |
137 | mi_gdb_test "-stack-list-variables --all-values" {\^done,variables=\[{name="inv",arg="1",value="<optimized out>"},{name="inv@entry",arg="1",value="<optimized out>"}\]} "both: invalid: -stack-list-variables" | |
138 | ||
139 | if {[mi_runto main] == -1} { | |
140 | return -1 | |
141 | } | |
142 | mi_gdb_test "-gdb-set print entry-values compact" {\^done} "compact: set print entry-values" | |
143 | mi_send_resuming_command "exec-continue" "compact: entry_equal: continue" | |
144 | mi_expect_stop "breakpoint-hit" .* {{name="val",value="5"},{name="val@entry",value="5"}} .* .* {.* disp="keep"} "compact: entry_equal: stop" | |
145 | mi_gdb_test "-stack-list-variables --all-values" {\^done,variables=\[{name="val",arg="1",value="5"},{name="val@entry",arg="1",value="5"}\]} "compact: entry_equal: -stack-list-variables" | |
146 | mi_send_resuming_command "exec-continue" "compact: entry_different: continue" | |
147 | mi_expect_stop "breakpoint-hit" .* {{name="val",value="6"},{name="val@entry",value="5"}} .* .* {.* disp="keep"} "compact: entry_different: stop" | |
148 | mi_gdb_test "-stack-list-variables --all-values" {\^done,variables=\[{name="val",arg="1",value="6"},{name="val@entry",arg="1",value="5"}\]} "compact: entry_different: -stack-list-variables" | |
149 | mi_send_resuming_command "exec-continue" "compact: validity: continue" | |
150 | mi_expect_stop "breakpoint-hit" .* {{name="lost@entry",value="5"},{name="born",value="10"}} .* .* {.* disp="keep"} "compact: validity: stop" | |
151 | mi_gdb_test "-stack-list-variables --all-values" {\^done,variables=\[{name="lost@entry",arg="1",value="5"},{name="born",arg="1",value="10"}\]} "compact: validity: -stack-list-variables" | |
152 | mi_send_resuming_command "exec-continue" "compact: invalid: continue" | |
153 | mi_expect_stop "breakpoint-hit" .* {{name="inv",value="<optimized out>"}} .* .* {.* disp="keep"} "compact: invalid: stop" | |
154 | mi_gdb_test "-stack-list-variables --all-values" {\^done,variables=\[{name="inv",arg="1",value="<optimized out>"}\]} "compact: invalid: -stack-list-variables" | |
155 | ||
156 | if {[mi_runto main] == -1} { | |
157 | return -1 | |
158 | } | |
159 | mi_gdb_test "-gdb-set print entry-values default" {\^done} "default: set print entry-values" | |
160 | mi_send_resuming_command "exec-continue" "default: entry_equal: continue" | |
161 | mi_expect_stop "breakpoint-hit" .* {{name="val",value="5"},{name="val@entry",value="5"}} .* .* {.* disp="keep"} "default: entry_equal: stop" | |
162 | mi_gdb_test "-stack-list-variables --all-values" {\^done,variables=\[{name="val",arg="1",value="5"},{name="val@entry",arg="1",value="5"}\]} "default: entry_equal: -stack-list-variables" | |
163 | mi_send_resuming_command "exec-continue" "default: entry_different: continue" | |
164 | mi_expect_stop "breakpoint-hit" .* {{name="val",value="6"},{name="val@entry",value="5"}} .* .* {.* disp="keep"} "default: entry_different: stop" | |
165 | mi_gdb_test "-stack-list-variables --all-values" {\^done,variables=\[{name="val",arg="1",value="6"},{name="val@entry",arg="1",value="5"}\]} "default: entry_different: -stack-list-variables" | |
166 | mi_send_resuming_command "exec-continue" "default: validity: continue" | |
167 | mi_expect_stop "breakpoint-hit" .* {{name="lost",value="<optimized out>"},{name="lost@entry",value="5"},{name="born",value="10"}} .* .* {.* disp="keep"} "default: validity: stop" | |
168 | mi_gdb_test "-stack-list-variables --all-values" {\^done,variables=\[{name="lost",arg="1",value="<optimized out>"},{name="lost@entry",arg="1",value="5"},{name="born",arg="1",value="10"}\]} "default: validity: -stack-list-variables" | |
169 | mi_send_resuming_command "exec-continue" "default: invalid: continue" | |
170 | mi_expect_stop "breakpoint-hit" .* {{name="inv",value="<optimized out>"}} .* .* {.* disp="keep"} "default: invalid: stop" | |
171 | mi_gdb_test "-stack-list-variables --all-values" {\^done,variables=\[{name="inv",arg="1",value="<optimized out>"}\]} "default: invalid: -stack-list-variables" |