OLD | NEW |
1 # Copyright 1999-2004, 2009, 2012 Free Software Foundation, Inc. | 1 # Copyright 1999-2004, 2009, 2012 Free Software Foundation, Inc. |
2 | 2 |
3 # This program is free software; you can redistribute it and/or modify | 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 | 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 | 5 # the Free Software Foundation; either version 3 of the License, or |
6 # (at your option) any later version. | 6 # (at your option) any later version. |
7 # | 7 # |
8 # This program is distributed in the hope that it will be useful, | 8 # This program is distributed in the hope that it will be useful, |
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
11 # GNU General Public License for more details. | 11 # GNU General Public License for more details. |
12 # | 12 # |
13 # You should have received a copy of the GNU General Public License | 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/>. | 14 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
15 | 15 |
16 # Test essential Machine interface (MI) operations | 16 # Test essential Machine interface (MI) operations |
17 # | 17 # |
18 # Verify that, using the MI, we can create, update, delete variables. | 18 # Verify that, using the MI, we can create, update, delete variables. |
19 # | 19 # |
20 | 20 |
21 | 21 |
22 load_lib mi-support.exp | 22 load_lib mi-support.exp |
23 set MIFLAGS "-i=mi2" | 23 set MIFLAGS "-i=mi2" |
24 | 24 |
25 gdb_exit | 25 gdb_exit |
26 if [mi_gdb_start] { | 26 if [mi_gdb_start] { |
27 continue | 27 continue |
28 } | 28 } |
29 | 29 |
30 set testfile "var-cmd" | 30 standard_testfile var-cmd.c |
31 set srcfile ${testfile}.c | 31 |
32 set binfile ${objdir}/${subdir}/mi2-var-child | 32 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
ug}] != "" } { |
33 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
ug additional_flags=-DFAKEARGV}] != "" } { | |
34 untested mi2-var-child.exp | 33 untested mi2-var-child.exp |
35 return -1 | 34 return -1 |
36 } | 35 } |
37 | 36 |
38 mi_delete_breakpoints | 37 mi_delete_breakpoints |
39 mi_gdb_reinitialize_dir $srcdir/$subdir | 38 mi_gdb_reinitialize_dir $srcdir/$subdir |
40 mi_gdb_load ${binfile} | 39 mi_gdb_load ${binfile} |
41 | 40 |
42 mi_runto do_children_tests | 41 mi_runto do_children_tests |
43 | 42 |
(...skipping 1088 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1132 mi_step_to do_children_tests {} {.*var-cmd.c} \ | 1131 mi_step_to do_children_tests {} {.*var-cmd.c} \ |
1133 [expr $line_dct_snp0 + 7] "step \$line_dct_snp0 + 7" | 1132 [expr $line_dct_snp0 + 7] "step \$line_dct_snp0 + 7" |
1134 | 1133 |
1135 # Test: c_variable-5.52 | 1134 # Test: c_variable-5.52 |
1136 # Desc: check that psnp->next->next->long_ptr (and [2].long_ptr) changed | 1135 # Desc: check that psnp->next->next->long_ptr (and [2].long_ptr) changed |
1137 mi_gdb_test "-var-update *" \ | 1136 mi_gdb_test "-var-update *" \ |
1138 "\\^done,changelist=\\\[\{name=\"psnp->ptrs.0.next.next.long_ptr\",in_sc
ope=\"true\",type_changed=\"false\",has_more=\"0\"\}\\\]" \ | 1137 "\\^done,changelist=\\\[\{name=\"psnp->ptrs.0.next.next.long_ptr\",in_sc
ope=\"true\",type_changed=\"false\",has_more=\"0\"\}\\\]" \ |
1139 "update all vars psnp->next->next->long_ptr (and 2.long_ptr) changed" | 1138 "update all vars psnp->next->next->long_ptr (and 2.long_ptr) changed" |
1140 | 1139 |
1141 | 1140 |
| 1141 # Anonymous type tests |
| 1142 proc verify_everything {variable_name} { |
| 1143 # Test -var-list-children |
| 1144 mi_varobj_tree_test_children_callback $variable_name |
1142 | 1145 |
| 1146 # Bring the variable named by VARIABLE_NAME into the current scope |
| 1147 # in VAROBJ. |
| 1148 upvar #0 $variable_name varobj |
| 1149 |
| 1150 # Test -var-info-path-expression |
| 1151 mi_gdb_test "-var-info-path-expression $varobj(obj_name)" \ |
| 1152 "\\^done,path_expr=\"[string_to_regexp $varobj(path_expr)]\"" \ |
| 1153 "path expression for $varobj(obj_name)" |
| 1154 |
| 1155 # Test -var-info-expression |
| 1156 mi_gdb_test "-var-info-expression $varobj(obj_name)" \ |
| 1157 "\\^done,lang=\"C\",exp=\"[string_to_regexp $varobj(display_name)]\"" \ |
| 1158 "expression for $varobj(obj_name)" |
| 1159 } |
| 1160 |
| 1161 set lineno [gdb_get_line_number "anonymous type tests breakpoint"] |
| 1162 mi_create_breakpoint \ |
| 1163 "$srcfile:$lineno" {[0-9]+} keep {do_anonymous_type_tests} \ |
| 1164 ".*var-cmd.c" $lineno $hex "break in do_anonymous_type_tests" |
| 1165 mi_execute_to "exec-continue" "breakpoint-hit" "do_anonymous_type_tests" ""\ |
| 1166 ".*" ".*" {"" "disp=\"keep\""} \ |
| 1167 "continue to do_anonymous_type_tests breakpoint" |
| 1168 |
| 1169 # Run the varobj tree on variable "ptr". |
| 1170 set tree { |
| 1171 {struct anonymous **} ptr { |
| 1172 {struct anonymous *} {*ptr} { |
| 1173 int a {} |
| 1174 anonymous struct { |
| 1175 int b {} |
| 1176 {char *} c { |
| 1177 char {*c} {} |
| 1178 } |
| 1179 anonymous union { |
| 1180 int d {} |
| 1181 {void *} e {} |
| 1182 char f {} |
| 1183 anonymous struct { |
| 1184 char g {} |
| 1185 {const char **} h { |
| 1186 {const char *} {*h} { |
| 1187 {const char} {**h} {} |
| 1188 } |
| 1189 } |
| 1190 {simpleton ***} simple { |
| 1191 {simpleton **} {*simple} { |
| 1192 {simpleton *} {**simple} { |
| 1193 int integer {} |
| 1194 {unsigned int} unsigned_integer {} |
| 1195 char character {} |
| 1196 {signed char} signed_character {} |
| 1197 {char *} char_ptr { |
| 1198 char {*char_ptr} {} |
| 1199 } |
| 1200 {int [10]} array_of_10 { |
| 1201 int 0 {} |
| 1202 int 1 {} |
| 1203 int 2 {} |
| 1204 int 3 {} |
| 1205 int 4 {} |
| 1206 int 5 {} |
| 1207 int 6 {} |
| 1208 int 7 {} |
| 1209 int 8 {} |
| 1210 int 9 {} |
| 1211 } |
| 1212 } |
| 1213 } |
| 1214 } |
| 1215 } |
| 1216 } |
| 1217 } |
| 1218 } |
| 1219 } |
| 1220 } |
| 1221 |
| 1222 mi_walk_varobj_tree c $tree verify_everything |
| 1223 |
| 1224 set tree { |
| 1225 {struct {...}} v { |
| 1226 int x {} |
| 1227 anonymous struct { |
| 1228 int a {} |
| 1229 } |
| 1230 anonymous struct { |
| 1231 int b {} |
| 1232 } |
| 1233 } |
| 1234 } |
| 1235 |
| 1236 mi_walk_varobj_tree c $tree verify_everything |
1143 | 1237 |
1144 mi_gdb_exit | 1238 mi_gdb_exit |
1145 return 0 | 1239 return 0 |
OLD | NEW |