]>
git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.mi/mi-var-cp.cc
1 /* Copyright 2006, 2007 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.
18 void reference_update_tests ()
20 /*: BEGIN: reference_update :*/
22 /*: mi_create_varobj "RX" "rx" "create varobj for rx" :*/
24 /*: mi_varobj_update RX {RX} "update RX (1)"
25 mi_check_varobj_value RX 167 "check RX: expect 167"
28 /*: mi_varobj_update RX {RX} "update RX (2)"
29 mi_check_varobj_value RX 567 "check RX: expect 567"
32 /*: mi_varobj_update RX {} "update RX (3)"
35 /*: END: reference_update :*/
38 struct S
{ int i
; int j
; };
41 int base_in_reference_test (S2
& s2
)
43 /*: BEGIN: base_in_reference :*/
46 mi_create_varobj "S2" "s2" "create varobj for s2"
47 mi_list_varobj_children "S2" {
49 } "list children of s2"
50 mi_list_varobj_children "S2.S" {
51 {"S2.S.public" "public" "2"}
52 } "list children of s2.s"
53 mi_list_varobj_children "S2.S.public" {
54 {"S2.S.public.i" "i" "0" "int"}
55 {"S2.S.public.j" "j" "0" "int"}
56 } "list children of s2.s.public"
58 mi_check_varobj_value "S2.S.public.i" "67" "check S2.S.public.i"
59 mi_check_varobj_value "S2.S.public.j" "89" "check S2.S.public.j"
62 /*: END: base_in_reference :*/
65 void base_in_reference_test_main ()
70 base_in_reference_test (s
);
73 int reference_to_pointer ()
75 S s
, *ptr_s
, *& rptr_s
= ptr_s
;
79 /*: BEGIN: reference_to_pointer :*/
82 mi_create_varobj RPTR rptr_s "create varobj for rptr_s"
84 mi_list_varobj_children RPTR {{RPTR.public public 2}} \
85 "list public child of RPTR"
87 mi_list_varobj_children RPTR.public \
88 {{RPTR.public.i i 0 int}
89 {RPTR.public.j j 0 int}} "list children of reference to pointer"
91 mi_check_varobj_value RPTR.public.i 67 "check i member"
92 mi_check_varobj_value RPTR.public.j 89 "check j member"
94 /*: END: reference_to_pointer :*/
99 reference_update_tests ();
100 base_in_reference_test_main ();
101 reference_to_pointer ();