diff options
author | Vladimir Prus <vladimir@codesourcery.com> | 2007-04-14 09:51:30 +0000 |
---|---|---|
committer | Vladimir Prus <vladimir@codesourcery.com> | 2007-04-14 09:51:30 +0000 |
commit | 25d5ea921bee4a06522b807e33912e2345bb1086 (patch) | |
tree | bf7e66e01ebe4b3aa974d50cf84f7953bcdd6a8f /gdb/testsuite | |
parent | 4d115fc687decb37191c284a0dd422210466ba57 (diff) | |
download | gdb-25d5ea921bee4a06522b807e33912e2345bb1086.zip gdb-25d5ea921bee4a06522b807e33912e2345bb1086.tar.gz gdb-25d5ea921bee4a06522b807e33912e2345bb1086.tar.bz2 |
* varobj.h (varobj_set_frozen): New
(varobj_get_frozen): New.
(varobj_update): New parameter explicit.
* varobj.c (struct varobj): New fields frozen
and not_fetched.
(varobj_set_frozen, varobj_get_frozen): New.
(install_new_value): Don't fetch values for
frozen variable object, or children thereof. Allow
a frozen variable object to have non-fetched value.
(varobj_update): Allow updating child variables.
Don't traverse frozen children.
(new_variable): Initialize the frozen field.
(c_value_of_variable): Return NULL for frozen
variable without any value yet.
* mi/mi-cmd-var.c (varobj_update_one): New parameter
'explicit'.
(mi_cmd_var_create): Output the 'frozen' field,
as soon as testsuite is adjusted to expect that field.
(mi_cmd_var_set_frozen): New.
(mi_cmd_var_update): Pass the 'explicit' parameter to
varobj_update_one.
* mi/mi-cmds.c (mi_cmds): Register '-var-set-frozen'.
* mi/mi-cmds.h (mi_cmd_var_set_frozen): Declare.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r-- | gdb/testsuite/ChangeLog | 7 | ||||
-rw-r--r-- | gdb/testsuite/gdb.mi/mi-var-cmd.exp | 14 | ||||
-rw-r--r-- | gdb/testsuite/gdb.mi/var-cmd.c | 87 | ||||
-rw-r--r-- | gdb/testsuite/lib/mi-support.exp | 5 |
4 files changed, 111 insertions, 2 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index a79ef0b..d8322ea 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2007-04-14 Vladimir Prus <vladimir@codesourcery.com> + + * gdb.mi/mi-var-cmd.exp: Delete varobjs left by previous + tests. Run the frozen varobjs test. + * gdb.mi/var-cmd.c (do_frozen_tests): New. + * lib/mi-support.exp (mi_varobj_update): Fix thinko. + 2007-04-11 Jan Kratochvil <jan.kratochvil@redhat.com> * gdb.base/type-opaque-lib.c, gdb.base/type-opaque-main.c, diff --git a/gdb/testsuite/gdb.mi/mi-var-cmd.exp b/gdb/testsuite/gdb.mi/mi-var-cmd.exp index 80041c6..58ee4c9 100644 --- a/gdb/testsuite/gdb.mi/mi-var-cmd.exp +++ b/gdb/testsuite/gdb.mi/mi-var-cmd.exp @@ -596,6 +596,20 @@ mi_gdb_test "-var-update selected_a" \ "\\^done,changelist=\\\[\{name=\"selected_a\",in_scope=\"true\",new_type=\"int\",new_num_children=\"0\"\}\\\]" \ "update selected_a in do_special_tests" +mi_delete_varobj selected_a "delete selected_a" +mi_delete_varobj array_ptr "delete array_ptr" + +proc set_frozen {varobjs flag} { + foreach v $varobjs { + mi_gdb_test "-var-set-frozen $v $flag" \ + "\\^done" \ + "-var-set-frozen $v $flag" + } +} + +mi_prepare_inline_tests $srcfile +mi_run_inline_test frozen + # Test whether bad varobjs crash GDB. # A varobj we fail to read during -var-update should be considered diff --git a/gdb/testsuite/gdb.mi/var-cmd.c b/gdb/testsuite/gdb.mi/var-cmd.c index a61dc88..8abb513 100644 --- a/gdb/testsuite/gdb.mi/var-cmd.c +++ b/gdb/testsuite/gdb.mi/var-cmd.c @@ -315,6 +315,92 @@ do_special_tests (void) incr_a(2); } +void do_frozen_tests () +{ + /*: BEGIN: frozen :*/ + struct { + int i; + struct { + int j; + int k; + } nested; + } v1 = {1, {2, 3}}; + + int v2 = 4; + /*: + mi_create_varobj V1 v1 "create varobj for v1" + mi_create_varobj V2 v2 "create varobj for v2" + + mi_list_varobj_children "V1" { + {"V1.i" "i" "0" "int"} + {"V1.nested" "nested" "2" "struct {...}"} + } "list children of v1" + + mi_list_varobj_children "V1.nested" { + {"V1.nested.j" "j" "0" "int"} + {"V1.nested.k" "k" "0" "int"} + } "list children of v1.nested" + + mi_check_varobj_value V1.i 1 "check V1.i: 1" + mi_check_varobj_value V1.nested.j 2 "check V1.nested.j: 2" + mi_check_varobj_value V1.nested.k 3 "check V1.nested.k: 3" + mi_check_varobj_value V2 4 "check V2: 4" + :*/ + v2 = 5; + /*: + mi_varobj_update * {V2} "update varobjs: V2 changed" + set_frozen V2 1 + :*/ + v2 = 6; + /*: + mi_varobj_update * {} "update varobjs: nothing changed" + mi_check_varobj_value V2 5 "check V2: 5" + mi_varobj_update V2 {V2} "update V2 explicitly" + mi_check_varobj_value V2 6 "check V2: 6" + :*/ + v1.i = 7; + v1.nested.j = 8; + v1.nested.k = 9; + /*: + set_frozen V1 1 + mi_varobj_update * {} "update varobjs: nothing changed" + mi_check_varobj_value V1.i 1 "check V1.i: 1" + mi_check_varobj_value V1.nested.j 2 "check V1.nested.j: 2" + mi_check_varobj_value V1.nested.k 3 "check V1.nested.k: 3" + # Check that explicit update for elements of structures + # works. + # Update v1.j + mi_varobj_update V1.nested.j {V1.nested.j} "update V1.nested.j" + mi_check_varobj_value V1.i 1 "check V1.i: 1" + mi_check_varobj_value V1.nested.j 8 "check V1.nested.j: 8" + mi_check_varobj_value V1.nested.k 3 "check V1.nested.k: 3" + # Update v1.nested, check that children is updated. + mi_varobj_update V1.nested {V1.nested.k} "update V1.nested" + mi_check_varobj_value V1.i 1 "check V1.i: 1" + mi_check_varobj_value V1.nested.j 8 "check V1.nested.j: 8" + mi_check_varobj_value V1.nested.k 9 "check V1.nested.k: 9" + # Update v1.i + mi_varobj_update V1.i {V1.i} "update V1.i" + mi_check_varobj_value V1.i 7 "check V1.i: 7" + :*/ + v1.i = 10; + v1.nested.j = 11; + v1.nested.k = 12; + /*: + # Check that unfreeze itself does not updates the values. + set_frozen V1 0 + mi_check_varobj_value V1.i 7 "check V1.i: 7" + mi_check_varobj_value V1.nested.j 8 "check V1.nested.j: 8" + mi_check_varobj_value V1.nested.k 9 "check V1.nested.k: 9" + mi_varobj_update V1 {V1.i V1.nested.j V1.nested.k} "update V1" + mi_check_varobj_value V1.i 10 "check V1.i: 10" + mi_check_varobj_value V1.nested.j 11 "check V1.nested.j: 11" + mi_check_varobj_value V1.nested.k 12 "check V1.nested.k: 12" + :*/ + + /*: END: frozen :*/ +} + int main (int argc, char *argv []) { @@ -322,6 +408,7 @@ main (int argc, char *argv []) do_block_tests (); do_children_tests (); do_special_tests (); + do_frozen_tests (); exit (0); } diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp index d423636..87e35c0 100644 --- a/gdb/testsuite/lib/mi-support.exp +++ b/gdb/testsuite/lib/mi-support.exp @@ -1024,8 +1024,9 @@ proc mi_varobj_update { name expected testname } { set first 1 foreach item $expected { set v "{name=\"$item\",in_scope=\"true\",type_changed=\"false\"}" - if {$first} { + if {$first == 1} { set er "$er$v" + set first 0 } else { set er "$er,$v" } @@ -1312,7 +1313,7 @@ proc mi_run_inline_test { testcase } { set line_now [mi_wait_for_stop "$testcase: step to $line"] set first 0 } elseif {$line_now!=$line} { - set line_now [mi_continue_to_line "$mi_autotest_source:$line"] + set line_now [mi_continue_to_line "$mi_autotest_source:$line" "continue to $line"] } if {$line_now!=$line} { |