summaryrefslogtreecommitdiffstats
path: root/gdb/testsuite/gdb.mi/var-cmd.c
diff options
context:
space:
mode:
authorVladimir Prus <vladimir@codesourcery.com>2007-04-14 09:51:30 +0000
committerVladimir Prus <vladimir@codesourcery.com>2007-04-14 09:51:30 +0000
commit25d5ea921bee4a06522b807e33912e2345bb1086 (patch)
treebf7e66e01ebe4b3aa974d50cf84f7953bcdd6a8f /gdb/testsuite/gdb.mi/var-cmd.c
parent4d115fc687decb37191c284a0dd422210466ba57 (diff)
downloadppe42-binutils-25d5ea921bee4a06522b807e33912e2345bb1086.tar.gz
ppe42-binutils-25d5ea921bee4a06522b807e33912e2345bb1086.zip
* 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/gdb.mi/var-cmd.c')
-rw-r--r--gdb/testsuite/gdb.mi/var-cmd.c87
1 files changed, 87 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.mi/var-cmd.c b/gdb/testsuite/gdb.mi/var-cmd.c
index a61dc885e3..8abb513d22 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);
}
OpenPOWER on IntegriCloud