| # Copyright 2018-2026 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/>. |
| |
| # Test for subtype definitions, i.e., types defined in classes, functions, |
| # etc. |
| |
| require allow_cplus_tests |
| |
| load_lib "cp-support.exp" |
| |
| standard_testfile .cc subtypes-2.cc |
| |
| include_file subtypes.h |
| |
| if {[prepare_for_testing "failed to prepare" $testfile \ |
| [list $srcfile $srcfile2] \ |
| {debug c++ additional_flags=-std=c++11}]} { |
| return -1 |
| } |
| |
| # Xfail for superfluous DW_TAG_lexical_block, gcc PR debug/55541. |
| set have_xfail [expr {[test_compiler_info gcc-*] && [gcc_major_version] < 5}] |
| |
| gdb_test "ptype Outer::Inner::InnerInner" \ |
| "type = struct Outer::Inner::InnerInner.*" |
| gdb_test "ptype Outer::Inner" "type = struct Outer::Inner.*" |
| |
| foreach s { Foo Bar Baz } { |
| gdb_test_multiple "ptype main::$s" "" { |
| -re -wrap "type = struct $s.*" { |
| pass $gdb_test_name |
| } |
| -re -wrap "No symbol \"$s\" in specified context\\." { |
| if { $have_xfail } { |
| setup_xfail *-*-* gcc/55541 |
| } |
| fail $gdb_test_name |
| } |
| |
| } |
| } |
| |
| gdb_test "ptype Outer::Oenum" "type = enum class Outer::Oenum.*" |
| |
| foreach t { int char } { |
| foreach s { Foo Bar Baz } { |
| gdb_test_multiple "ptype foobar<$t>::$s" "" { |
| -re -wrap "type = struct $s.*" { |
| pass $gdb_test_name |
| } |
| -re -wrap "No symbol \"$s\" in specified context\\." { |
| if { $have_xfail } { |
| setup_xfail *-*-* gcc/55541 |
| } |
| fail $gdb_test_name |
| } |
| } |
| } |
| } |
| |
| gdb_breakpoint "Outer::Inner::doit" message |
| |
| foreach s { Foo Bar Baz } { |
| gdb_breakpoint "main::${s}::doit" message |
| } |
| |
| foreach t { int char } { |
| foreach s { Foo Bar Baz } { |
| gdb_breakpoint "foobar<$t>(int)::${s}::doit" message |
| } |
| } |