diff options
Diffstat (limited to 'gdb/testsuite')
-rw-r--r-- | gdb/testsuite/ChangeLog | 13 | ||||
-rw-r--r-- | gdb/testsuite/gdb.python/Makefile.in | 3 | ||||
-rw-r--r-- | gdb/testsuite/gdb.python/py-explore-cc.exp | 146 | ||||
-rw-r--r-- | gdb/testsuite/gdb.python/py-explore.c | 82 | ||||
-rw-r--r-- | gdb/testsuite/gdb.python/py-explore.cc | 54 | ||||
-rw-r--r-- | gdb/testsuite/gdb.python/py-explore.exp | 469 |
6 files changed, 766 insertions, 1 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 4aa7f64..422ac8b 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,16 @@ +2012-04-02 Siva Chandra Reddy <sivachandra@google.com> + + * gdb.python/Makefile.in: Add py-explore and py-explore-cc to + EXECUTABLES. + * gdb.python/py-explore.c: C program used for testing the new + 'explore' command on C constructs. + * gdb.python/py-explore.cc: C++ program used for testing the new + 'explore' command on C++ constructs. + * gdb-python/py-explore.exp: Tests for the new 'explore' + command on C constructs. + * gdb-python/py-explore-cc.exp: Tests for the new 'explore' + command on C++ constructs. + 2012-04-07 Mark Kettenis <kettenis@gnu.org> * gdb.base/funcargs.exp (complex_args): Fix typo. diff --git a/gdb/testsuite/gdb.python/Makefile.in b/gdb/testsuite/gdb.python/Makefile.in index cf9c142..511df95 100644 --- a/gdb/testsuite/gdb.python/Makefile.in +++ b/gdb/testsuite/gdb.python/Makefile.in @@ -5,7 +5,8 @@ EXECUTABLES = py-type py-value py-prettyprint py-template py-block \ py-symbol py-mi py-breakpoint py-inferior py-infthread \ py-shared python lib-types py-events py-evthreads py-frame \ py-mi py-pp-maint py-progspace py-section-script py-objfile \ - py-finish-breakpoint py-finish-breakpoint2 py-value-cc + py-finish-breakpoint py-finish-breakpoint2 py-value-cc py-explore \ + py-explore-cc MISCELLANEOUS = py-shared-sl.sl py-events-shlib.so py-events-shlib-nodebug.so diff --git a/gdb/testsuite/gdb.python/py-explore-cc.exp b/gdb/testsuite/gdb.python/py-explore-cc.exp new file mode 100644 index 0000000..afcf453 --- /dev/null +++ b/gdb/testsuite/gdb.python/py-explore-cc.exp @@ -0,0 +1,146 @@ +# Copyright (C) 2012 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +# This file is part of the GDB testsuite. It tests the mechanism +# exposing values to Python. + +if { [skip_cplus_tests] } { continue } + +set testfile "py-explore" +set srcfile ${testfile}.cc +set binfile ${objdir}/${subdir}/${testfile} + +if {[prepare_for_testing $testfile.exp $testfile $srcfile {debug c++}]} { + return -1 +} + +# Skip all tests if Python scripting is not enabled. +if { [skip_python_tests] } { continue } + +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'.*" + +set b_desc "The value of 'b' is a struct/class of type 'B' with the following fields:.*\ +A = <Enter 0 to explore this base class of type 'A'>.*\ +i = 10 \\.\\. \\(Value of type 'int'\\).*\ +c = 97 'a' \\.\\. \\(Value of type 'char'\\).*" + +set B_desc "'B' is a struct/class with the following fields:.*\ +A = <Enter 0 to explore this base class of type 'A'>.*\ +i = <Enter 1 to explore this field of type 'int'>.*\ +c = <Enter 2 to explore this field of type 'char'>.*" + +if ![runto_main] { + return -1 +} + +gdb_breakpoint [gdb_get_line_number "Break here."] +gdb_continue_to_breakpoint "Break here" ".*Break here.*" + +gdb_test "explore A" "'A' is a struct/class with no fields\." +gdb_test "explore a" "The value of 'a' is a struct/class of type 'const A' with no fields\." +gdb_test "explore int_ref" "'int_ref' is a scalar value of type 'int'.*int_ref = 10" + +gdb_test_multiple "explore int_ptr_ref" "" { + -re "$int_ptr_ref_desc.*Continue exploring it as a pointer to a single value \\\[y/n\\\]:.*" { + pass "explore int_ptr_ref" + gdb_test_multiple "y" "explore_int_ptr_ref_as_single_value_pointer" { + -re "'\[*\]int_ptr_ref' is a scalar value of type 'int'.*\[*\]int_ptr_ref = 10.*$gdb_prompt" { + pass "explore_int_ptr_ref_as_single_value_pointer" + } + } + } +} + +gdb_test_multiple "explore b" "" { + -re "$b_desc.*Enter the field number of choice:.*" { + pass "explore b" + gdb_test_multiple "0" "explore_base_class_A" { + -re "The value of 'b\.A' is a struct/class of type 'A' with no fields\." { + pass "explore_base_class_A" + gdb_test_multiple "\0" "return_to_b_from_A" { + -re ".*$b_desc.*Enter the field number of choice:.*" { + pass "return_to_b_from_A" + gdb_test_multiple "1" "explore_field_i_of_b" { + -re "'b\.i' is a scalar value of type 'int'.*b\.i = 10.*" { + pass "explore_field_i_of_b" + gdb_test_multiple "\0" "return_to_b_from_i" { + -re "$b_desc.*Enter the field number of choice:.*" { + pass "return_to_b_from_i" + } + } + } + } + gdb_test_multiple "2" "explore_field_c_of_b" { + -re "'b\.c' is a scalar value of type 'char'.*b\.c = .*'a'.*" { + pass "explore_field_c_of_b" + gdb_test_multiple "\0" "return_to_b_from_c" { + -re "$b_desc.*Enter the field number of choice:.*" { + pass "return_to_b_from_i" + } + } + } + } + gdb_test_multiple "\0" "return_to_gdb_prompt" { + -re "$gdb_prompt" { + pass "return_to_gdb_prompt_from_b" + } + } + } + } + } + } + } +} + +gdb_test_multiple "explore B" "" { + -re "$B_desc.*Enter the field number of choice:.*" { + pass "explore B" + gdb_test_multiple "0" "explore_base_class_A" { + -re "base class 'A' of 'B' is a struct/class of type 'A' with no fields\." { + pass "explore_base_class_A" + gdb_test_multiple "\0" "return_to_B" { + -re "$B_desc.*Enter the field number of choice:.*" { + pass "return_to_B" + gdb_test_multiple "1" "explore_field_i_of_B" { + -re "field 'i' of 'B' is of a scalar type 'int'.*" { + pass "explore_field_i_of_B" + gdb_test_multiple "\0" "return_to_B_from_i" { + -re "$B_desc.*Enter the field number of choice:.*" { + pass "return_to_B_from_i" + } + } + } + } + gdb_test_multiple "2" "explore_field_c_of_B" { + -re "field 'c' of 'B' is of a scalar type 'char'.*" { + pass "explore_field_c_of_B" + gdb_test_multiple "\0" "return_to_B_from_c" { + -re "$B_desc.*Enter the field number of choice:.*" { + pass "return_to_B_from_c" + } + } + } + } + gdb_test_multiple "\0" "return_to_gdb_prompt" { + -re "$gdb_prompt" { + pass "return_to_gdb_prompt_from_B" + } + } + } + } + } + } + } +} diff --git a/gdb/testsuite/gdb.python/py-explore.c b/gdb/testsuite/gdb.python/py-explore.c new file mode 100644 index 0000000..9dcf0e9 --- /dev/null +++ b/gdb/testsuite/gdb.python/py-explore.c @@ -0,0 +1,82 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#define ARRAY_SIZE 10 + +struct SimpleStruct +{ + int a; + double d; +}; + +union SimpleUnion +{ + int i; + char c; + float f; + double d; +}; + +typedef struct SimpleStruct SS; + +struct ComplexStruct +{ + struct SimpleStruct s; + union SimpleUnion u; + SS sa[ARRAY_SIZE]; +}; + +union ComplexUnion +{ + SS s; + struct SimpleStruct sa[ARRAY_SIZE]; +}; + +int +main (void) +{ + struct SimpleStruct ss; + struct SimpleStruct* ss_ptr = &ss; + SS ss_t; + + union SimpleUnion su; + struct ComplexStruct cs; + struct ComplexStruct* cs_ptr = &cs; + union ComplexUnion cu; + int i; + double darray[5] = {0.1, 0.2, 0.3, 0.4, 0.5}; + double *darray_ref = darray; + + ss.a = 10; + ss.d = 100.01; + ss_t = ss; + + su.d = 100.1; + + cs.s = ss; + cs.u = su; + for (i = 0; i < ARRAY_SIZE; i++) + { + cs.sa[i].a = i; + cs.sa[i].d = 10.10 + i; + cu.sa[i].a = i; + cu.sa[i].d = 100.10 + i; + } + + return 0; /* Break here. */ +} diff --git a/gdb/testsuite/gdb.python/py-explore.cc b/gdb/testsuite/gdb.python/py-explore.cc new file mode 100644 index 0000000..420ba57 --- /dev/null +++ b/gdb/testsuite/gdb.python/py-explore.cc @@ -0,0 +1,54 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +class A { + public: + virtual ~A() { } +}; + +class B : public A { + public: + virtual ~B() { } + + int i; + char c; +}; + +typedef int *int_ptr; + +int +func (const A &a) +{ + int val = 10; + int &int_ref = val; + int_ptr ptr = &val; + int_ptr &int_ptr_ref = ptr; + B b; + + b.i = 10; + b.c = 'a'; + + return 0; /* Break here. */ +} + +int +main () +{ + A obj; + return func (obj); +} diff --git a/gdb/testsuite/gdb.python/py-explore.exp b/gdb/testsuite/gdb.python/py-explore.exp new file mode 100644 index 0000000..5ba98e9 --- /dev/null +++ b/gdb/testsuite/gdb.python/py-explore.exp @@ -0,0 +1,469 @@ +# Copyright 2012 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +set testfile "py-explore" +set srcfile ${testfile}.c +set binfile ${objdir}/${subdir}/${testfile} +if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile}] } { + return -1 +} + +# Skip all tests if Python scripting is not enabled. +if { [skip_python_tests] } { continue } + +set SS "struct SimpleStruct" +set SU "union SimpleUnion" +set CS "struct ComplexStruct" +set CU "union ComplexUnion" +set enter_field_number_prompt {Enter the field number of choice: } +set return_to_parent_prompt {Press enter to return to parent value: } +set array_index_prompt {Enter the index of the element you want to explore in .*: } + +proc compound_description { value_name type_desc type_name } { + return "The value of '$value_name' is a $type_desc of type '$type_name' with the following fields:\[\r\n\]+" +} + +proc typedef_description { value_name typedef_name type_name } { + return "The value of '$value_name' is of type '$typedef_name' which is a typedef of type '$type_name'\.\[\r\n\]+" +} + +proc scalar_description { value_name type } { + return "'$value_name' is a scalar value of type '$type'\.\[\r\n\]+" +} + +proc array_description { value_name type } { + return "'$value_name' is an array of '$type'\.\[\r\n\]+" +} + +proc pointer_description { value_name type_name } { + set type_description "'$value_name' is a pointer to a value of type '$type_name'\.\[\r\n\]+" + set prompt "Continue exploring it as a pointer to a single value \[\[\]y/n\[\]\]: " + return "$type_description$prompt" +} + +proc field_values { args } { + set result "" + foreach field $args { + set result "$result\[ \]*$field \[\.\]\[\.\] \[\(\]Value of type .*\[\)\]\[\r\n\]+" + } + return $result +} + +proc field_choices { args } { + set result "" + set field_num 0 + foreach field $args { + set result "$result$field\[ \]+=\[ \]+<Enter $field_num to explore this field of type .*" + incr field_num + } + return $result +} + +proc scalar_value { value_name value } { + return "$value_name = $value\[r\n\]+" +} + +set SS_fields [field_values {a = 10} {d = 100[.].*}] + +if ![runto_main] { + return -1 +} + +gdb_breakpoint [gdb_get_line_number "Break here."] +gdb_continue_to_breakpoint "Break here" ".*Break here.*" + +######################### +# Value exploration tests +######################### + +gdb_test "explore i" "[scalar_description {i} {int}].*i = .*" +gdb_test "explore ss" "[compound_description {ss} {struct/class} $SS].*$SS_fields" +gdb_test "explore *ss_ptr" "[compound_description {\*ss_ptr} {struct/class} $SS].*$SS_fields" +gdb_test "explore ss_t" "[typedef_description {ss_t} {SS} $SS].*[compound_description {ss_t} {struct/class} $SS].*$SS_fields" + +gdb_test_multiple "explore ss_ptr" "" { + -re "[pointer_description {ss_ptr} $SS].*" { + pass "explore ss_ptr" + gdb_test_multiple "y" "explore_as_single_value_pointer" { + -re "$SS_fields" { + pass "explore ss_ptr as single value pointer" + } + } + } +} + +gdb_test_multiple "explore darray_ref" "" { + -re "[pointer_description {darray_ref} {double}].*" { + pass "explore darray_ref" + gdb_test_multiple "n" "no_to_explore_as_pointer" { + -re "Continue exploring it as a pointer to an array \[\[\]y/n\[\]\]: " { + pass "no_to_explore_as_pointer" + gdb_test_multiple "y" "explore_as_array" { + -re ".*Enter the index of the element you want to explore in 'darray_ref':.*" { + pass "explore_as_array" + gdb_test_multiple "2" "explore_as_array_index_2" { + -re ".*'darray_ref\\\[2\\\]' is a scalar value of type 'double'\..*darray_ref\\\[2\\\] = 0.*" { + pass "explore_as_array_index_2" + gdb_test_multiple "\0" "end explore_as_array_index_2" { + -re ".*Returning to parent value.*Enter the index of the element you want to explore in 'darray_ref':.*" { + pass "end explore_as_array_index_2" + gdb_test_multiple "\0" "end explore_as_array" { + -re "\[\n\r\]+" { + pass "end explore_as_array" + } + } + } + } + } + } + } + } + } + } + } +} + +gdb_test_multiple "explore su" "" { + -re "[compound_description {su} {union} {union SimpleUnion}].*[field_choices {i} {c} {f} {d}].*$enter_field_number_prompt" { + pass "explore su" + gdb_test_multiple "3" "explore su.d" { + -re "[scalar_description {su.d} {double}].*[scalar_value {su.d} {100[.].*}].*$return_to_parent_prompt" { + pass "explore su.d" + gdb_test_multiple " " "end su.d exploration" { + -re ".*[compound_description {su} {union} {union SimpleUnion}].*[field_choices {i} {c} {f} {d}].*$enter_field_number_prompt" { + pass "end su.d exploration" + gdb_test_multiple "\0" "end su exploration" { + -re "$gdb_prompt" { + pass "end su exploration" + } + } + } + } + } + } + } +} + +gdb_test_multiple "explore cs" "" { + -re "[compound_description {cs} {struct/class} {struct ComplexStruct}].*[field_choices {s} {u} {sa}].*$enter_field_number_prompt" { + pass "explore cs" + gdb_test_multiple "0" "explore cs.s" { + -re "[compound_description {cs.s} {struct/class} {struct SimpleStruct}].*[field_values {a = 10} {d = 100[.].*}].*$return_to_parent_prompt" { + pass "explore cs.s" + gdb_test_multiple " " "end cs.s exploration" { + -re ".*$enter_field_number_prompt" { + pass "end cs.s exploration" + gdb_test_multiple "\0" "end cs exploration" { + -re "$gdb_prompt" { + pass "end cs exploration" + } + } + } + } + } + } + } +} + +gdb_test_multiple "explore cu" "" { + -re "[compound_description {cu} {union} {union ComplexUnion}].*[field_choices {s} {sa}].*$enter_field_number_prompt" { + pass "explore cu" + gdb_test_multiple "1" "explore cu.sa" { + -re ".*[array_description {cu.sa} $SS].*$array_index_prompt" { + pass "explore cu.sa" + gdb_test_multiple "0" "explore cu.sa\[0\]" { + -re "[compound_description {\(cu.sa\)\[0\]} {struct/class} {struct SimpleStruct}].*[field_values {a = 0} {d = 100[.].*}].*$return_to_parent_prompt" { + pass "explore cu.sa\[0\]" + gdb_test_multiple "\0" "end cu.sa\[0\] exploration" { + -re "[array_description {cu.sa} $SS]$array_index_prompt" { + pass "end cu.sa\[0\] exploration" + } + } + } + } + gdb_test_multiple "\0" "end cu.sa exploration" { + -re ".*$enter_field_number_prompt" { + pass "end cu.sa exploration" + gdb_test_multiple "\0" "end cu exploration" { + -re "$gdb_prompt" { + pass "end cu exploration" + } + } + } + } + } + } + } +} + +######################## +# Type exploration tests +######################## + +proc scalar_type_decsription {type} { + return "'$type' is a scalar type\." +} + +proc child_scalar_type_description {path type} { + return "$path is of a scalar type '$type'\." +} + +proc compound_type_description { type_name type_desc } { + return "'$type_name' is a $type_desc with the following fields:" +} + +proc child_compound_type_description { path type_name type_desc } { + return "$path is a $type_desc of type '$type_name' with the following fields:" +} + +proc child_array_type_description { path target_type_name } { + return "$path is an array of '$target_type_name'\." +} + +proc typedef_type_description { type_name target_name } { + return "The type '$type_name' is a typedef of type '$target_name'\." +} + +set SS_fields_types [field_choices {a} {d}] +set SU_fields_types [field_choices {i} {c} {f} {d}] +set CS_fields_types [field_choices {s} {u} {sa}] +set CU_fields_types [field_choices {s} {sa}] + +set CS_field_0 "field 's' of 'struct ComplexStruct'" +set CS_field_1 "field 'u' of 'struct ComplexStruct'" +set CS_field_2 "field 'sa' of 'struct ComplexStruct'" +set CS_field_2_array_element "an array element of $CS_field_2" + +set CU_field_0 "field 's' of 'union ComplexUnion'" +set CU_field_1 "field 'sa' of 'union ComplexUnion'" +set CU_field_1_array_element "an array element of $CU_field_1" + +gdb_test "explore int" ".*[scalar_type_decsription {int}].*" + +gdb_test_multiple "explore struct SimpleStruct" "" { + -re ".*[compound_type_description $SS {struct/class}].*$SS_fields_types.*" { + pass "explore struct SimpleStruct" + gdb_test_multiple "0" "explore type struct SimpleStruct feild 0" { + -re ".*[child_scalar_type_description {field 'a' of 'struct SimpleStruct'} {int}].*" { + pass "explore type struct SimpleStruct feild 0" + gdb_test_multiple "\0" "return to struct SimpleStruct from field 0" { + -re ".*[compound_type_description $SS {struct/class}].*$SS_fields_types.*" { + pass "return to struct SimpleStruct from field 0" + } + } + } + } + gdb_test_multiple "1" "explore type struct SimpleStruct feild 1" { + -re ".*[child_scalar_type_description {field 'd' of 'struct SimpleStruct'} {double}].*" { + pass "explore type struct SimpleStruct feild 1" + gdb_test_multiple "\0" "return to struct SimpleStruct from field 1" { + -re ".*[compound_type_description $SS {struct/class}].*$SS_fields_types.*" { + pass "return to struct SimpleStruct from field 1" + } + } + } + } + gdb_test_multiple "\0" "return to GDB prompt from struct SimpleStruct" { + -re "$gdb_prompt" { + pass "return to GDB prompt from struct SimpleStruct" + } + } + } +} + +gdb_test_multiple "explore union SimpleUnion" "" { + -re ".*[compound_type_description $SU {union}].*$SU_fields_types.*" { + pass "explore union SimpleUnion" + gdb_test_multiple "0" "explore type union SimpleUnion feild 0" { + -re ".*[child_scalar_type_description {field 'i' of 'union SimpleUnion'} {int}].*" { + pass "explore type union SimpleUnion feild 0" + gdb_test_multiple "\0" "return to union SimpleUnion from field 0" { + -re ".*[compound_type_description $SU {union}].*$SU_fields_types.*" { + pass "return to union SimpleUnion from field 0" + } + } + } + } + gdb_test_multiple "1" "explore type union SimpleUnion feild 1" { + -re ".*[child_scalar_type_description {field 'c' of 'union SimpleUnion'} {char}].*" { + pass "explore type union SimpleUnion feild 1" + gdb_test_multiple "\0" "return to union SimpleUnion from field 1" { + -re ".*[compound_type_description $SU {union}].*$SU_fields_types.*" { + pass "return to union SimpleUnion from field 1" + } + } + } + } + gdb_test_multiple "2" "explore type union SimpleUnion feild 2" { + -re ".*[child_scalar_type_description {field 'f' of 'union SimpleUnion'} {float}].*" { + pass "explore type union SimpleUnion feild 2" + gdb_test_multiple "\0" "return to union SimpleUnion from field 2" { + -re ".*[compound_type_description $SU {union}].*$SU_fields_types.*" { + pass "return to union SimpleUnion from field 2" + } + } + } + } + gdb_test_multiple "3" "explore type union SimpleUnion feild 3" { + -re ".*[child_scalar_type_description {field 'd' of 'union SimpleUnion'} {double}].*" { + pass "explore type union SimpleUnion feild 3" + gdb_test_multiple "\0" "return to union SimpleUnion from field 3" { + -re ".*[compound_type_description $SU {union}].*$SU_fields_types.*" { + pass "return to union SimpleUnion from field 3" + } + } + } + } + gdb_test_multiple "\0" "return to GDB prompt from union SimpleUnion" { + -re "$gdb_prompt" { + pass "return to GDB prompt from union SimpleUnion" + } + } + } +} + +gdb_test_multiple "explore SS" "" { + -re ".*[typedef_type_description {SS} $SS].*[compound_type_description {SS} {struct/class}].*$SS_fields_types.*" { + pass "explore SS" + gdb_test_multiple "0" "explore type SS feild 0" { + -re ".*[child_scalar_type_description {field 'a' of 'SS'} {int}].*" { + pass "explore type SS feild 0" + gdb_test_multiple "\0" "return to SS from field 0" { + -re ".*[compound_type_description {SS} {struct/class}].*$SS_fields_types.*" { + pass "return to SS from field 0" + } + } + } + } + gdb_test_multiple "1" "explore type SS feild 1" { + -re ".*[child_scalar_type_description {field 'd' of 'SS'} {double}].*" { + pass "explore type SS feild 1" + gdb_test_multiple "\0" "return to struct SimpleStruct from field 1" { + -re ".*[compound_type_description {SS} {struct/class}].*$SS_fields_types.*" { + pass "return to SS field 1" + } + } + } + } + gdb_test_multiple "\0" "return to GDB prompt from SS" { + -re "$gdb_prompt" { + pass "return to GDB prompt from SS" + } + } + } +} + +gdb_test_multiple "explore type struct ComplexStruct" "" { + -re ".*[compound_type_description $CS {struct/class}].*$CS_fields_types.*" { + pass "explore type struct ComplexStruct" + gdb_test_multiple "0" "explore type struct ComplexStruct field 0" { + -re ".*[child_compound_type_description $CS_field_0 $SS {struct/class}].*$SS_fields_types.*" { + pass "explore type struct ComplexStruct field 0" + gdb_test_multiple "\0" "return to ComplexStruct from field 0" { + -re ".*[compound_type_description $CS {struct/class}].*$CS_fields_types.*" { + pass "return to ComplexStruct from field 0" + } + } + } + } + gdb_test_multiple "1" "explore type struct ComplexStruct field 1" { + -re ".*[child_compound_type_description $CS_field_1 $SU {union}].*$SU_fields_types.*" { + pass "explore type struct ComplexStruct field 1" + gdb_test_multiple "\0" "return to ComplexStruct from field 1" { + -re ".*[compound_type_description $CS {struct/class}].*$CS_fields_types.*" { + pass "return to ComplexStruct from field 1" + } + } + } + } + gdb_test_multiple "2" "explore type struct ComplexStruct field 2" { + -re ".*[child_array_type_description $CS_field_2 {SS}].*" { + pass "explore type struct ComplexStruct field 2" + gdb_test_multiple "\0" "return to ComplexStruct from field 2" { + -re ".*[compound_type_description $CS {struct/class}].*$CS_fields_types.*" { + pass "return to ComplexStruct from field 2" + } + } + } + } + gdb_test_multiple "\0" "return to GDB prompt from ComplexStruct type exploration" { + -re "$gdb_prompt" { + pass "return to GDB prompt from ComplexStruct type exploration" + } + } + } +} + +gdb_test_multiple "explore type union ComplexUnion" "" { + -re ".*[compound_type_description $CU {union}].*$CU_fields_types.*" { + pass "explore type union ComplexUnion" + gdb_test_multiple "0" "explore type union ComplexStruct field 0" { + -re ".*[child_compound_type_description $CU_field_0 $SS {struct/class}].*$SS_fields_types.*" { + pass "explore type union ComplexUnion field 0" + gdb_test_multiple "\0" "return to ComplexUnion from field 0" { + -re ".*[compound_type_description $CU {union}].*$CU_fields_types.*" { + pass "return to ComplexUnion from field 0" + } + } + } + } + gdb_test_multiple "1" "explore type union ComplexUnion field 1" { + -re ".*[child_array_type_description $CU_field_1 $SS].*" { + pass "explore type union ComplexUnion field 1" + gdb_test_multiple "\0" "return to ComplexUnion array" { + -re ".*[compound_type_description $CU {union}].*$CU_fields_types.*" { + pass "return to ComplexUnion from field 1" + } + } + } + } + gdb_test_multiple "\0" "return to GDB prompt from ComplexUnion type exploration" { + -re "$gdb_prompt" { + pass "return to GDB prompt from ComplexUnion type exploration" + } + } + } +} + +gdb_test_multiple "explore type cu" "" { + -re "'cu' is of type 'union ComplexUnion'.*[compound_type_description $CU {union}].*$CU_fields_types.*" { + pass "explore type union ComplexUnion" + gdb_test_multiple "0" "explore type union ComplexStruct field 0" { + -re ".*[child_compound_type_description $CU_field_0 $SS {struct/class}].*$SS_fields_types.*" { + pass "explore type union ComplexUnion field 0" + gdb_test_multiple "\0" "return to ComplexUnion from field 0" { + -re ".*[compound_type_description $CU {union}].*$CU_fields_types.*" { + pass "return to ComplexUnion from field 0" + } + } + } + } + gdb_test_multiple "1" "explore type union ComplexUnion field 1" { + -re ".*[child_array_type_description $CU_field_1 $SS].*" { + pass "explore type union ComplexUnion field 1" + gdb_test_multiple "\0" "return to ComplexUnion array" { + -re ".*[compound_type_description $CU {union}].*$CU_fields_types.*" { + pass "return to ComplexUnion from field 1" + } + } + } + } + gdb_test_multiple "\0" "return to GDB prompt from ComplexUnion type exploration" { + -re "$gdb_prompt" { + pass "return to GDB prompt from ComplexUnion type exploration" + } + } + } +} |