+2002-01-15 Keith Seitz <keiths@redhat.com>
+
+ * c_variable.test (1.4,2.14): Remove test for local frame
+ variables. Varobj now forces evaluation in the current frame
+ by default.
+ (2.15): Ignore any changes and only check for out of scope
+ locals (which is still unsupported).
+ * cpp_variable.test (1.1): Support alternative names for
+ local scope.
+ (1.6a): Catch call to gdb_cmd to prevent an error from
+ throwing testsuite into la-la land. Add to test.
+ (1.7): Ignore results from children during step, since
+ they may or may not change value when the parent changes.
+ (2.2a): New test incorperating gdb_cmd (also wrapped in
+ catch).
+ (2.22a): Likewise.
+ (2.71a): Likewise.
+
2001-12-20 Keith Seitz <keiths@redhat.com>
* cpp_variable.test: Catch non-test calls in case we
# Desc: create local variables
gdbtk_test c_variable-1.4 {create local variables} {
set results {}
- foreach v {linteger lpinteger lcharacter lpcharacter} {
- lappend results [create_variable $v]
- }
-
- # Create "llong" differently. Tell it to use the current frame. Test 2.14
- # will check that this works.
- set err [catch {gdb_variable create llong -expr llong -frame ""} v]
- if {!$err} {
- set var(llong) $v
- }
- lappend results $err
-
- foreach v {lplong lfloat lpfloat ldouble lpdouble lsimple lpsimple func} {
+ foreach v {linteger lpinteger lcharacter lpcharacter llong lplong lfloat lpfloat ldouble lpdouble lsimple lpsimple func} {
lappend results [create_variable $v]
}
set results
# *l = 12
gdb_cmd "step"
+# This test is no longer valid, since varobj now forces
+# re-evaluation in the current frame by default.
# Test: c_variable-2.14
# Desc: change do_locals_tests local llong
-gdbtk_test c_variable-2.14 {change do_locals_tests local llong} {
- check_update
-} {llong {}}
+#gdbtk_test c_variable-2.14 {change do_locals_tests local llong} {
+# check_update
+#} {llong {}}
# Leave subroutine1
gdb_cmd "next"
# Test: c_variable-2.15
# Desc: check for out of scope subroutine1 locals
gdbtk_test *c_variable-2.15 {check for out of scope subroutine1 locals (ops, we don't have a out-of-scope list yet)} {
- check_update
-} {{} {i l}}
+ lindex [check_update] 1
+} {i l}
# Test: c_variable-2.16
# Desc: names of all editable variables
# Test: cpp_variable-1.1
# Desc: stopped in do_simple_class_tests
gdbtk_test cpp_variable-1.1 {stopped in do_simple_class_tests} {
- lindex [gdb_loc] 1
-} {do_simple_class_tests(void)}
+ # G++ can output "do_simple_class_tests(void)". Strip the "(void)" part.
+ set loc [lindex [gdb_loc] 1]
+ set index [string first \( $loc]
+ if {$index > 0} {
+ set loc [string range $loc 0 [expr {$index-1}]]
+ }
+ set loc
+} {do_simple_class_tests}
# Test: cpp_variable-1.2
# Desc: create variable v
set value {}
catch {$var(v) value} value
-# Step over "V *v = new V;"
-gdb_cmd "next"
+# Test: cpp_variable-1.6a
+# Desc: Step over "V *v = new V;"
+gdbtk_test cpp_variable-1.6a {step over "V *v = new V;"} {
+ catch {gdb_cmd "next"}
+} {0}
# Test: cpp_variable-1.7
# Desc: check value of v changed
gdbtk_test cpp_variable-1.7 {check value of v changed} {
- check_update
-} {{v v.public.v_pub_int v.public.v_pub_charp v.private.v_priv_int v.private.v_priv_charp} {}}
+ set changes [check_update]
+
+ # It is undefined whether the children will change values
+ # or not, so ignore them.
+ expr {[lsearch [lindex $changes 0] v] != -1}
+} {1}
# Test: cpp_variable-1.8
# Desc: check values of v
$var(v.public.v_pub_int) format
} {natural}
-gdb_cmd "set variable v.v_pub_int=2112"
+# Test: cpp_variable-2.2a
+# Desc: set variable v->v_pub_int=2112
+gdbtk_test cpp_variable-2.2a {set variable v.v_pub_int=2112} {
+ set err [catch {gdb_cmd "set variable v.v_pub_int=2112"} txt]
+ if {$err} {
+ set txt
+ } else {
+ set err
+ }
+} {0}
# Test: cpp_variable-2.3
# Desc: value of v.v_pub_int changed
$var(v.private.v_priv_charp) format
} {natural}
-gdb_cmd "set variable v.v_priv_charp=2112"
+# Test: cpp_variable-2.22a
+# Desc: set variable v->v_priv_charp=2112
+gdbtk_test cpp_variable-2.22a {set variable v->v_priv_charp=2112} {
+ set err [catch {gdb_cmd "set variable v->v_priv_charp=2112"} txt]
+ if {$err} {
+ set txt
+ } else {
+ set err
+ }
+} {0}
# Test: cpp_variable-2.23
# Desc: value of v.v_priv_charp changed
$var(v.VB.public.vb_pub_int) editable
} {1}
-gdb_cmd "set variable v.vb_pub_int=2112"
+# Test: cpp_variable-2.71a
+# Desc: set variable v->vb_pub_int=2112
+gdbtk_test cpp_variable-2.71a {set variable v->v_pub_int=2112} {
+ set err [catch {gdb_cmd "set variable v->vb_pub_int=2112"} txt]
+ if {$err} {
+ set txt
+ } else {
+ set err
+ }
+} {0}
# Test: cpp_variable-2.72
# Desc: value of v.vb_pub_int changed