OLD | NEW |
(Empty) | |
| 1 # Copyright (C) 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 # This file is part of the GDB testsuite. It tests the mechanism |
| 17 # exposing values to Python. |
| 18 |
| 19 if { [skip_cplus_tests] } { continue } |
| 20 |
| 21 standard_testfile py-explore.cc |
| 22 |
| 23 if {[prepare_for_testing $testfile.exp $testfile $srcfile {debug c++}]} { |
| 24 return -1 |
| 25 } |
| 26 |
| 27 # Skip all tests if Python scripting is not enabled. |
| 28 if { [skip_python_tests] } { continue } |
| 29 |
| 30 set int_ptr_ref_desc "The value of 'int_ptr_ref' is of type 'int_ptr' which is a
typedef of type 'int \\*'.*\'int_ptr_ref' is a pointer to a value of type 'int'
.*" |
| 31 |
| 32 set b_desc "The value of 'b' is a struct/class of type 'B' with the following fi
elds:.*\ |
| 33 A = <Enter 0 to explore this base class of type 'A'>.*\ |
| 34 i = 10 \\.\\. \\(Value of type 'int'\\).*\ |
| 35 c = 97 'a' \\.\\. \\(Value of type 'char'\\).*" |
| 36 |
| 37 set B_desc "'B' is a struct/class with the following fields:.*\ |
| 38 A = <Enter 0 to explore this base class of type 'A'>.*\ |
| 39 i = <Enter 1 to explore this field of type 'int'>.*\ |
| 40 c = <Enter 2 to explore this field of type 'char'>.*" |
| 41 |
| 42 if ![runto_main] { |
| 43 return -1 |
| 44 } |
| 45 |
| 46 gdb_breakpoint [gdb_get_line_number "Break here."] |
| 47 gdb_continue_to_breakpoint "Break here" ".*Break here.*" |
| 48 |
| 49 gdb_test "explore A" "'A' is a struct/class with no fields\." |
| 50 gdb_test "explore a" "The value of 'a' is a struct/class of type 'const A' with
no fields\." |
| 51 gdb_test "explore int_ref" "'int_ref' is a scalar value of type 'int'.*int_ref =
10" |
| 52 |
| 53 gdb_test_multiple "explore int_ptr_ref" "" { |
| 54 -re "$int_ptr_ref_desc.*Continue exploring it as a pointer to a single value
\\\[y/n\\\]:.*" { |
| 55 pass "explore int_ptr_ref" |
| 56 gdb_test_multiple "y" "explore_int_ptr_ref_as_single_value_pointer" { |
| 57 -re "'\[*\]int_ptr_ref' is a scalar value of type 'int'.*\[*\]int_pt
r_ref = 10.*$gdb_prompt" { |
| 58 pass "explore_int_ptr_ref_as_single_value_pointer" |
| 59 } |
| 60 } |
| 61 } |
| 62 } |
| 63 |
| 64 gdb_test_multiple "explore b" "" { |
| 65 -re "$b_desc.*Enter the field number of choice:.*" { |
| 66 pass "explore b" |
| 67 gdb_test_multiple "0" "explore_base_class_A" { |
| 68 -re "The value of 'b\.A' is a struct/class of type 'A' with no field
s\." { |
| 69 pass "explore_base_class_A" |
| 70 gdb_test_multiple "\0" "return_to_b_from_A" { |
| 71 -re ".*$b_desc.*Enter the field number of choice:.*" { |
| 72 pass "return_to_b_from_A" |
| 73 gdb_test_multiple "1" "explore_field_i_of_b" { |
| 74 -re "'b\.i' is a scalar value of type 'int'.*b\.i =
10.*" { |
| 75 pass "explore_field_i_of_b" |
| 76 gdb_test_multiple "\0" "return_to_b_from_i" { |
| 77 -re "$b_desc.*Enter the field number of choi
ce:.*" { |
| 78 pass "return_to_b_from_i" |
| 79 } |
| 80 } |
| 81 } |
| 82 } |
| 83 gdb_test_multiple "2" "explore_field_c_of_b" { |
| 84 -re "'b\.c' is a scalar value of type 'char'.*b\.c =
.*'a'.*" { |
| 85 pass "explore_field_c_of_b" |
| 86 gdb_test_multiple "\0" "return_to_b_from_c" { |
| 87 -re "$b_desc.*Enter the field number of choi
ce:.*" { |
| 88 pass "return_to_b_from_i" |
| 89 } |
| 90 } |
| 91 } |
| 92 } |
| 93 gdb_test_multiple "\0" "return_to_gdb_prompt" { |
| 94 -re "$gdb_prompt" { |
| 95 pass "return_to_gdb_prompt_from_b" |
| 96 } |
| 97 } |
| 98 } |
| 99 } |
| 100 } |
| 101 } |
| 102 } |
| 103 } |
| 104 |
| 105 gdb_test_multiple "explore B" "" { |
| 106 -re "$B_desc.*Enter the field number of choice:.*" { |
| 107 pass "explore B" |
| 108 gdb_test_multiple "0" "explore_base_class_A" { |
| 109 -re "base class 'A' of 'B' is a struct/class of type 'A' with no fie
lds\." { |
| 110 pass "explore_base_class_A" |
| 111 gdb_test_multiple "\0" "return_to_B" { |
| 112 -re "$B_desc.*Enter the field number of choice:.*" { |
| 113 pass "return_to_B" |
| 114 gdb_test_multiple "1" "explore_field_i_of_B" { |
| 115 -re "field 'i' of 'B' is of a scalar type 'int'.*" { |
| 116 pass "explore_field_i_of_B" |
| 117 gdb_test_multiple "\0" "return_to_B_from_i" { |
| 118 -re "$B_desc.*Enter the field number of choi
ce:.*" { |
| 119 pass "return_to_B_from_i" |
| 120 } |
| 121 } |
| 122 } |
| 123 } |
| 124 gdb_test_multiple "2" "explore_field_c_of_B" { |
| 125 -re "field 'c' of 'B' is of a scalar type 'char'.*"
{ |
| 126 pass "explore_field_c_of_B" |
| 127 gdb_test_multiple "\0" "return_to_B_from_c" { |
| 128 -re "$B_desc.*Enter the field number of choi
ce:.*" { |
| 129 pass "return_to_B_from_c" |
| 130 } |
| 131 } |
| 132 } |
| 133 } |
| 134 gdb_test_multiple "\0" "return_to_gdb_prompt" { |
| 135 -re "$gdb_prompt" { |
| 136 pass "return_to_gdb_prompt_from_B" |
| 137 } |
| 138 } |
| 139 } |
| 140 } |
| 141 } |
| 142 } |
| 143 } |
| 144 } |
OLD | NEW |