From f5362c933e2280398d7aea3cc0748bec8f66a1ab Mon Sep 17 00:00:00 2001 From: Tom de Vries Date: Mon, 28 Aug 2023 13:46:36 +0200 Subject: [PATCH] [gdb/testsuite] Add xfail in gdb.cp/subtypes.exp When running test-case gdb.cp/subtypes.exp with gcc 4.8.4, we run into: ... FAIL: gdb.cp/subtypes.exp: ptype main::Foo FAIL: gdb.cp/subtypes.exp: ptype main::Bar FAIL: gdb.cp/subtypes.exp: ptype main::Baz FAIL: gdb.cp/subtypes.exp: ptype foobar::Foo FAIL: gdb.cp/subtypes.exp: ptype foobar::Bar FAIL: gdb.cp/subtypes.exp: ptype foobar::Baz FAIL: gdb.cp/subtypes.exp: ptype foobar::Foo FAIL: gdb.cp/subtypes.exp: ptype foobar::Bar FAIL: gdb.cp/subtypes.exp: ptype foobar::Baz ... The problem is gcc PR debug/55541, which generates a superfluous DW_TAG_lexical_block. Add a corresponding xfail. Tested on x86_64-linux. --- gdb/testsuite/gdb.cp/subtypes.exp | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/gdb/testsuite/gdb.cp/subtypes.exp b/gdb/testsuite/gdb.cp/subtypes.exp index 48c9784dd68..11acd75029a 100644 --- a/gdb/testsuite/gdb.cp/subtypes.exp +++ b/gdb/testsuite/gdb.cp/subtypes.exp @@ -30,19 +30,43 @@ if {[prepare_for_testing "failed to prepare" $testfile \ 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 "ptype main::$s" "type = struct $s.*" + 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 "ptype foobar<$t>::$s" "type = struct $s.*" + 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 + } + } } } -- 2.30.2