OLD | NEW |
(Empty) | |
| 1 # Copyright 2012 Free Software Foundation, Inc. |
| 2 |
| 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. |
| 7 # |
| 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. |
| 12 # |
| 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/>. |
| 15 |
| 16 if { [skip_cplus_tests] } { continue } |
| 17 |
| 18 load_lib mi-support.exp |
| 19 set MIFLAGS "-i=mi" |
| 20 |
| 21 gdb_exit |
| 22 if [mi_gdb_start] { |
| 23 continue |
| 24 } |
| 25 |
| 26 standard_testfile .cc |
| 27 set opts {debug c++} |
| 28 |
| 29 if [build_executable $testfile.exp $testfile $srcfile $opts] { |
| 30 return -1; |
| 31 } |
| 32 |
| 33 mi_gdb_load ${binfile} |
| 34 |
| 35 mi_prepare_inline_tests $srcfile |
| 36 |
| 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 {\^done} \ |
| 41 "-interpreter-exec console \"set print object ${state}\" in $testname" |
| 42 } |
| 43 |
| 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" |
| 51 } |
| 52 |
| 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" |
| 56 } |
| 57 |
| 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} |
| 61 } |
| 62 |
| 63 proc check_new_derived_without_rtti {var_name var_type testname} { |
| 64 set varobj_name VAR |
| 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}" |
| 70 } |
| 71 |
| 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" |
| 87 } |
| 88 |
| 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" |
| 96 } |
| 97 |
| 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 |
| 101 } |
| 102 |
| 103 proc check_new_derived_with_rtti {var_name var_type testname} { |
| 104 set varobj_name VAR |
| 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" |
| 110 } |
| 111 |
| 112 mi_run_inline_test use_rtti_for_ptr |
| 113 mi_run_inline_test use_rtti_for_ref |
| 114 mi_run_inline_test use_rtti_for_ptr_child |
| 115 mi_run_inline_test use_rtti_for_ref_child |
| 116 mi_run_inline_test use_rtti_with_multiple_inheritence |
| 117 mi_run_inline_test type_update_when_use_rtti |
| 118 mi_run_inline_test skip_type_update_when_not_use_rtti |
| 119 |
| 120 mi_gdb_exit |
| 121 return 0 |
OLD | NEW |