1 # Copyright
2012-2022 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
3 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
, see
<http
://www.gnu.org
/licenses
/>.
16 if { [skip_cplus_tests
] } { return }
18 load_lib mi
-support.exp
29 if [build_executable $testfile.exp $testfile $srcfile $opts
] {
33 mi_gdb_load $
{binfile
}
35 mi_prepare_inline_tests $srcfile
37 # Enable using RTTI to determine real types of the objects
38 proc set_print_object
{state testname
} {
39 mi_gdb_test
"-interpreter-exec console \"set print object ${state}\"" \
40 "(.*=cmd-param-changed,param=\"print object\",value=\"${state}\".*|)\\^done" \
41 "-interpreter-exec console \"set print object ${state}\" in $testname"
44 proc check_derived_children_without_rtti
{varobj_name var_name testname
} {
45 mi_list_varobj_children $
{varobj_name
} "
46 { $
{varobj_name
}.public public
1 }
47 " "list children of ${var_name} (without RTTI) in $testname"
48 mi_list_varobj_children
"${varobj_name}.public" "
49 { $
{varobj_name
}.public.A A
0 int }
50 " "list children of ${var_name}.public (without RTTI) in $testname"
53 proc check_derived_content_without_rtti
{varobj_name var_name testname
} {
54 mi_check_varobj_value $
{varobj_name
}.public.A
1 \
55 "check ${var_name}->A (without RTTI) in $testname"
58 proc check_derived_without_rtti
{varobj_name var_name testname
} {
59 check_derived_children_without_rtti $
{varobj_name
} $
{var_name
} $
{testname
}
60 check_derived_content_without_rtti $
{varobj_name
} $
{var_name
} $
{testname
}
63 proc check_new_derived_without_rtti
{var_name var_type testname
} {
65 mi_create_varobj_checked $
{varobj_name
} $
{var_name
} $
{var_type
} \
66 "create varobj for ${var_name} (without RTTI) in ${testname}"
67 check_derived_without_rtti $
{varobj_name
} $
{var_name
} $
{testname
}
68 mi_delete_varobj $
{varobj_name
} \
69 "delete varobj for ${var_name} (without RTTI) in ${testname}"
72 proc check_derived_children_with_rtti
{varobj_name var_name testname
} {
73 mi_list_varobj_children $
{varobj_name
} "
74 { $
{varobj_name
}.Base Base
1 Base
}
75 { $
{varobj_name
}.public public
2 }
76 " "list children of ${var_name} (with RTTI) in $testname"
77 mi_list_varobj_children
"${varobj_name}.Base" "
78 { $
{varobj_name
}.Base.public public
1 }
79 " "list children of ${var_name}.Base (with RTTI) in $testname"
80 mi_list_varobj_children
"${varobj_name}.Base.public" "
81 { $
{varobj_name
}.Base.public.A A
0 int }
82 " "list children of ${var_name}.Base.public (with RTTI) in $testname"
83 mi_list_varobj_children
"${varobj_name}.public" "
84 { $
{varobj_name
}.public.B B
0 int }
85 { $
{varobj_name
}.public.C C
0 int }
86 " "list children of ${var_name}.public (with RTTI) in $testname"
89 proc check_derived_content_with_rtti
{varobj_name var_name testname
} {
90 mi_check_varobj_value $
{varobj_name
}.Base.public.A
1 \
91 "check ${var_name}->A (with RTTI) in $testname"
92 mi_check_varobj_value $
{varobj_name
}.public.B
2 \
93 "check ${var_name}->B (with RTTI) in $testname"
94 mi_check_varobj_value $
{varobj_name
}.public.C
3 \
95 "check ${var_name}->C (with RTTI) in $testname"
98 proc check_derived_with_rtti
{varobj_name var_name testname
} {
99 check_derived_children_with_rtti $
{varobj_name
} $
{var_name
} $testname
100 check_derived_content_with_rtti $
{varobj_name
} $
{var_name
} $testname
103 proc check_new_derived_with_rtti
{var_name var_type testname
} {
105 mi_create_varobj_checked $
{varobj_name
} $
{var_name
} $
{var_type
} \
106 "create varobj for ${var_name} (with RTTI) in $testname"
107 check_derived_with_rtti $
{varobj_name
} $
{var_name
} $testname
108 mi_delete_varobj $
{varobj_name
} \
109 "delete varobj for ${var_name} (with RTTI) in $testname"
115 use_rtti_for_ptr_child
116 use_rtti_for_ref_child
117 use_rtti_with_multiple_inheritence
118 type_update_when_use_rtti
119 skip_type_update_when_not_use_rtti
122 foreach_with_prefix inline_test $inline_tests
{
123 if { [mi_run_inline_test $inline_test
] < 0 } {