1 # Copyright
1999, 2000, 2001, 2002, 2004 Free Software Foundation
, Inc.
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
2 of the License
, or
6 #
(at your option
) any later version.
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.
13 # You should have received a copy of the GNU General Public License
14 # along with this
program; if not
, write to the Free Software
15 # Foundation
, Inc.
, 59 Temple Place
- Suite
330, Boston
, MA
02111-1307, USA.
17 # Test essential Machine interface
(MI
) operations
19 # Verify that
, using the MI
, we can create
, update, delete variables.
23 load_lib mi
-support.exp
31 set testfile
"var-cmd"
32 set srcfile $
{testfile
}.c
33 set binfile $
{objdir
}/$
{subdir
}/$
{testfile
}
34 if { [gdb_compile
"${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } {
35 gdb_suppress_entire_file
"Testcase compile failed, so all tests in this file will automatically fail."
39 mi_gdb_reinitialize_dir $srcdir
/$subdir
40 mi_gdb_load $
{binfile
}
42 mi_runto do_block_tests
44 # Test
: c_variable
-3.2
45 # Desc
: create cb and foo
46 mi_gdb_test
"-var-create cb * cb" \
47 "\\^done,name=\"cb\",numchild=\"0\",type=\"int\"" \
48 "create local variable cb"
50 mi_gdb_test
"-var-create foo * foo" \
51 "&\"mi_cmd_var_create: unable to create variable object\\\\n\".*\\^error,msg=\"mi_cmd_var_create: unable to create variable object\"" \
52 "create local variable foo"
54 # step to
"foo = 123;"
55 mi_step_to
"do_block_tests" "" "var-cmd.c" \
56 [gdb_get_line_number
"foo = 123;"] \
57 "step at do_block_test"
60 # Be paranoid and assume
3.2 created foo
61 mi_gdb_test
"-var-delete foo" \
62 "&\"Variable object not found\\\\n\".*\\^error,msg=\"Variable object not found\"" \
66 # Test
: c_variable
-3.3
68 mi_gdb_test
"-var-create foo * foo" \
69 "\\^done,name=\"foo\",numchild=\"0\",type=\"int\"" \
70 "create local variable foo"
72 # step to
"foo2 = 123;"
73 mi_step_to
"do_block_tests" "" "var-cmd.c" \
74 [gdb_get_line_number
"foo2 = 123;"] \
75 "step at do_block_test"
77 # Test
: c_variable
-3.4
78 # Desc
: check foo
, cb changed
79 mi_gdb_test
"-var-update *" \
80 "\\^done,changelist=\\\[\{name=\"foo\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"cb\",in_scope=\"true\",type_changed=\"false\"\}\\\]" \
81 "update all vars: cb foo changed"
83 # step to
"foo = 321;"
84 mi_step_to
"do_block_tests" "" "var-cmd.c" \
85 [gdb_get_line_number
"foo = 321;"] \
86 "step at do_block_test"
88 # Test
: c_variable
-3.5
89 # Desc
: create inner block foo
90 mi_gdb_test
"-var-create inner_foo * foo" \
91 "\\^done,name=\"inner_foo\",numchild=\"0\",type=\"int\"" \
92 "create local variable inner_foo"
95 mi_step_to
"do_block_tests" "" "var-cmd.c" \
96 [gdb_get_line_number
"foo2 = 0;"] \
97 "step at do_block_test"
99 # Test
: c_variable
-3.6
101 mi_gdb_test
"-var-create foo2 * foo2" \
102 "\\^done,name=\"foo2\",numchild=\"0\",type=\"int\"" \
103 "create local variable foo2"
105 # Test
: c_variable
-3.7
106 # Desc
: check that outer foo in scope and inner foo out of scope
107 # Note
: also a known gdb problem
109 mi_gdb_test
"-var-update inner_foo" \
110 "\\^done,changelist=\{FIXME\}" \
111 "update inner_foo: should be out of scope: KNOWN PROBLEM"
115 mi_gdb_test
"-var-evaluate-expression inner_foo" \
116 "\\^done,value=\{FIXME\}" \
117 "evaluate inner_foo: should be out of scope: KNOWN PROBLEM"
120 mi_gdb_test
"-var-update foo" \
121 "\\^done,changelist=\\\[\\\]" \
122 "update foo: did not change"
124 mi_gdb_test
"-var-delete inner_foo" \
125 "\\^done,ndeleted=\"1\"" \
126 "delete var inner_foo"
129 mi_step_to
"do_block_tests" "" "var-cmd.c" \
130 [gdb_get_line_number
"foo = 0;"] \
131 "step at do_block_test"
133 # Test
: c_variable
-3.8
134 # Desc
: check that foo2 out of scope
(known gdb problem
)
136 mi_gdb_test
"-var-update foo2" \
137 "\\^done,changelist=\{FIXME\}" \
138 "update foo2: should be out of scope: KNOWN PROBLEM"
142 mi_step_to
"do_block_tests" "" "var-cmd.c" \
143 [gdb_get_line_number
"cb = 21;"] \
144 "step at do_block_test"
146 # Test
: c_variable
-3.9
147 # Desc
: check that only cb is in scope
(known gdb problem
)
149 mi_gdb_test
"-var-update foo2" \
150 "\\^done,changelist=\\\[FIXME\\\]" \
151 "update foo2 should be out of scope: KNOWN PROBLEM"
154 mi_gdb_test
"-var-update foo" \
155 "\\^done,changelist=\{FIXME\}" \
156 "update foo should be out of scope: KNOWN PROBLEM"
158 mi_gdb_test
"-var-update cb" \
159 "\\^done,changelist=\\\[\\\]" \
162 # Test
: c_variable
-3.10
163 # Desc
: names of editable variables
164 #gdbtk_test c_variable
-3.10 {names of editable variables
} {
166 #
} {{foo cb foo2
} {}}
168 # Done with block tests
169 mi_gdb_test
"-var-delete foo" \
170 "\\^done,ndeleted=\"1\"" \
173 mi_gdb_test
"-var-delete foo2" \
174 "\\^done,ndeleted=\"1\"" \
177 mi_gdb_test
"-var-delete cb" \
178 "\\^done,ndeleted=\"1\"" \