From 35b72e4e5baabef35b34db7f12c627e7232ee204 Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Wed, 30 Mar 2022 14:31:56 +0100 Subject: [PATCH] gdb.base/scope.exp: Remove bogus gdb_test questions This test is abusing the QUESTION/RESPONSE feature to send an alternative command to GDB if the first command fails. Like so: gdb_test "print 'scope0.c'::filelocal" \ "\\\$$decimal = 1" "print 'scope0.c'::filelocal at main" \ "No symbol \"scope0.c\" in current context.*" \ "print '$srcdir/$subdir/scope0.c'::filelocal" So if 'scope0.c' doesn't work, we try again with '$srcdir/$subdir/scope0.c'. I strongly suspect this is really an obsolete test. I think that if '$srcdir/$subdir/scope0.c' works, then 'scope0.c' should have worked too, thus I'd think that if we pass due to the question path, then it's a bug. So just remove the question part passed to gdb_test. Change-Id: I2acc99285f1d519284051b49693b5441fbdfe3cd --- gdb/testsuite/gdb.base/scope.exp | 60 ++++++++++++++++---------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/gdb/testsuite/gdb.base/scope.exp b/gdb/testsuite/gdb.base/scope.exp index 19a85bcd244..a8ddb61350a 100644 --- a/gdb/testsuite/gdb.base/scope.exp +++ b/gdb/testsuite/gdb.base/scope.exp @@ -49,11 +49,11 @@ proc_with_prefix test_at_main {} { # Print scope0.c::filelocal, which is 1 gdb_test "print filelocal" "\\\$$decimal = 1" - gdb_test "print 'scope0.c'::filelocal" "\\\$$decimal = 1" "print 'scope0.c'::filelocal at main" "No symbol \"scope0.c\" in current context.*" "print '$srcdir/$subdir/scope0.c'::filelocal" + gdb_test "print 'scope0.c'::filelocal" "\\\$$decimal = 1" "print 'scope0.c'::filelocal at main" # Print scope0.c::filelocal_bss, which is 101 gdb_test "print filelocal_bss" "\\\$$decimal = 101" - gdb_test "print 'scope0.c'::filelocal_bss" "\\\$$decimal = 101" "print 'scope0.c'::filelocal_bss in test_at_main" "No symbol \"scope0.c\" in current context.*" "print '$srcdir/$subdir/scope0.c'::filelocal_bss" + gdb_test "print 'scope0.c'::filelocal_bss" "\\\$$decimal = 101" "print 'scope0.c'::filelocal_bss in test_at_main" # Print scope0.c::filelocal_ro, which is 201 @@ -62,37 +62,37 @@ proc_with_prefix test_at_main {} { gdb_test "print filelocal_ro" "\\\$$decimal = 201" "print filelocal_ro in test_at_main" if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } - gdb_test "print 'scope0.c'::filelocal_ro" "\\\$$decimal = 201" "print 'scope0.c'::filelocal_ro" "No symbol \"scope0.c\" in current context.*" "print '$srcdir/$subdir/scope0.c'::filelocal_ro" + gdb_test "print 'scope0.c'::filelocal_ro" "\\\$$decimal = 201" "print 'scope0.c'::filelocal_ro" # Print scope1.c::filelocal, which is 2 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } - gdb_test "print 'scope1.c'::filelocal" "\\\$$decimal = 2" "print 'scope1.c'::filelocal" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::filelocal" + gdb_test "print 'scope1.c'::filelocal" "\\\$$decimal = 2" "print 'scope1.c'::filelocal" # Print scope1.c::filelocal_bss, which is 102 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } - gdb_test "print 'scope1.c'::filelocal_bss" "\\\$$decimal = 102" "print 'scope1.c'::filelocal_bss" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::filelocal_bss" + gdb_test "print 'scope1.c'::filelocal_bss" "\\\$$decimal = 102" "print 'scope1.c'::filelocal_bss" # Print scope1.c::filelocal_ro, which is 202 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } - gdb_test "print 'scope1.c'::filelocal_ro" "\\\$$decimal = 202" "print 'scope1.c'::filelocal_ro" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::filelocal_ro" + gdb_test "print 'scope1.c'::filelocal_ro" "\\\$$decimal = 202" "print 'scope1.c'::filelocal_ro" # Print scope1.c::foo::funclocal, which is 3 gdb_test "print foo::funclocal" "\\\$$decimal = 3" if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } - gdb_test "print 'scope1.c'::foo::funclocal" "\\\$$decimal = 3" "print 'scope1.c'::foo::funclocal" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::foo::funclocal" + gdb_test "print 'scope1.c'::foo::funclocal" "\\\$$decimal = 3" "print 'scope1.c'::foo::funclocal" # Print scope1.c::foo::funclocal_ro, which is 203 gdb_test "print foo::funclocal_ro" "\\\$$decimal = 203" if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } - gdb_test "print 'scope1.c'::foo::funclocal_ro" "\\\$$decimal = 203" "print 'scope1.c'::foo::funclocal_ro" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::foo::funclocal_ro" + gdb_test "print 'scope1.c'::foo::funclocal_ro" "\\\$$decimal = 203" "print 'scope1.c'::foo::funclocal_ro" # Print scope1.c::bar::funclocal, which is 4 gdb_test "print bar::funclocal" "\\\$$decimal = 4" if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } - gdb_test "print 'scope1.c'::bar::funclocal" "\\\$$decimal = 4" "print 'scope1.c'::bar::funclocal" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::bar::funclocal" + gdb_test "print 'scope1.c'::bar::funclocal" "\\\$$decimal = 4" "print 'scope1.c'::bar::funclocal" } proc_with_prefix test_at_foo {} { @@ -105,34 +105,34 @@ proc_with_prefix test_at_foo {} { gdb_test "next" ".*bar \\(\\);" # Print scope0.c::filelocal, which is 1 - gdb_test "print 'scope0.c'::filelocal" "\\\$$decimal = 1" "print 'scope0.c'::filelocal at foo" "No symbol \"scope0.c\" in current context.*" "print '$srcdir/$subdir/scope0.c'::filelocal" + gdb_test "print 'scope0.c'::filelocal" "\\\$$decimal = 1" "print 'scope0.c'::filelocal at foo" # Print scope0.c::filelocal_bss, which is 101 - gdb_test "print 'scope0.c'::filelocal_bss" "\\\$$decimal = 101" "print 'scope0.c'::filelocal_bss in test_at_foo" "No symbol \"scope0.c\" in current context.*" "print '$srcdir/$subdir/scope0.c'::filelocal_bss" + gdb_test "print 'scope0.c'::filelocal_bss" "\\\$$decimal = 101" "print 'scope0.c'::filelocal_bss in test_at_foo" # Print scope0.c::filelocal_ro, which is 201 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } - gdb_test "print 'scope0.c'::filelocal_ro" "\\\$$decimal = 201" "print 'scope0.c'::filelocal_ro" "No symbol \"scope0.c\" in current context.*" "print '$srcdir/$subdir/scope0.c'::filelocal_ro" + gdb_test "print 'scope0.c'::filelocal_ro" "\\\$$decimal = 201" "print 'scope0.c'::filelocal_ro" # Print scope1.c::filelocal, which is 2 gdb_test "print filelocal" "\\\$$decimal = 2" "print filelocal at foo" if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } - gdb_test "print 'scope1.c'::filelocal" "\\\$$decimal = 2" "print 'scope1.c'::filelocal at foo" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::filelocal" + gdb_test "print 'scope1.c'::filelocal" "\\\$$decimal = 2" "print 'scope1.c'::filelocal at foo" gdb_test "print filelocal_bss" "\\\$$decimal = 102" \ "print filelocal_bss at foo" if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } - gdb_test "print 'scope1.c'::filelocal_bss" "\\\$$decimal = 102" "print 'scope1.c'::filelocal_bss at foo" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::filelocal_bss" + gdb_test "print 'scope1.c'::filelocal_bss" "\\\$$decimal = 102" "print 'scope1.c'::filelocal_bss at foo" gdb_test "print filelocal_ro" "\\\$$decimal = 202" \ "print filelocal_ro at foo" if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } - gdb_test "print 'scope1.c'::filelocal_ro" "\\\$$decimal = 202" "print 'scope1.c'::filelocal_ro at foo" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::filelocal_ro" + gdb_test "print 'scope1.c'::filelocal_ro" "\\\$$decimal = 202" "print 'scope1.c'::filelocal_ro at foo" # Print scope1.c::foo::funclocal, which is 3 @@ -143,7 +143,7 @@ proc_with_prefix test_at_foo {} { "print foo::funclocal at foo" if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } - gdb_test "print 'scope1.c'::foo::funclocal" "\\\$$decimal = 3" "print 'scope1.c'::foo::funclocal at foo" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::foo::funclocal" + gdb_test "print 'scope1.c'::foo::funclocal" "\\\$$decimal = 3" "print 'scope1.c'::foo::funclocal at foo" # Print scope1.c::foo::funclocal_bss, which is 103 @@ -155,7 +155,7 @@ proc_with_prefix test_at_foo {} { "print foo::funclocal_bss at foo" if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } - gdb_test "print 'scope1.c'::foo::funclocal_bss" "\\\$$decimal = 103" "print 'scope1.c'::foo::funclocal_bss at foo" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::foo::funclocal_bss" + gdb_test "print 'scope1.c'::foo::funclocal_bss" "\\\$$decimal = 103" "print 'scope1.c'::foo::funclocal_bss at foo" # Print scope1.c::foo::funclocal_ro, which is 203 @@ -167,7 +167,7 @@ proc_with_prefix test_at_foo {} { "print foo::funclocal_ro at foo" if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } - gdb_test "print 'scope1.c'::foo::funclocal_ro" "\\\$$decimal = 203" "print 'scope1.c'::foo::funclocal_ro at foo" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::foo::funclocal_ro" + gdb_test "print 'scope1.c'::foo::funclocal_ro" "\\\$$decimal = 203" "print 'scope1.c'::foo::funclocal_ro at foo" # Print scope1.c::bar::funclocal, which is 4 @@ -176,7 +176,7 @@ proc_with_prefix test_at_foo {} { "print bar::funclocal at foo" if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } - gdb_test "print 'scope1.c'::bar::funclocal" "\\\$$decimal = 4" "print 'scope1.c'::bar::funclocal at foo" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::bar::funclocal" + gdb_test "print 'scope1.c'::bar::funclocal" "\\\$$decimal = 4" "print 'scope1.c'::bar::funclocal at foo" } @@ -190,64 +190,64 @@ proc_with_prefix test_at_bar {} { gdb_test "next" # Print scope0.c::filelocal, which is 1 - gdb_test "print 'scope0.c'::filelocal" "\\\$$decimal = 1" "print 'scope0.c'::filelocal at bar" "No symbol \"scope0.c\" in current context.*" "print '$srcdir/$subdir/scope0.c'::filelocal" + gdb_test "print 'scope0.c'::filelocal" "\\\$$decimal = 1" "print 'scope0.c'::filelocal at bar" # Print scope0.c::filelocal_bss, which is 101 - gdb_test "print 'scope0.c'::filelocal_bss" "\\\$$decimal = 101" "print 'scope0.c'::filelocal_bss in test_at_bar" "No symbol \"scope0.c\" in current context.*" "print '$srcdir/$subdir/scope0.c'::filelocal_bss" + gdb_test "print 'scope0.c'::filelocal_bss" "\\\$$decimal = 101" "print 'scope0.c'::filelocal_bss in test_at_bar" # Print scope0.c::filelocal_ro, which is 201 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } - gdb_test "print 'scope0.c'::filelocal_ro" "\\\$$decimal = 201" "print 'scope0.c'::filelocal_ro at bar" "No symbol \"scope0.c\" in current context.*" "print '$srcdir/$subdir/scope0.c'::filelocal_ro" + gdb_test "print 'scope0.c'::filelocal_ro" "\\\$$decimal = 201" "print 'scope0.c'::filelocal_ro at bar" # Print scope1.c::filelocal, which is 2 gdb_test "print filelocal" "\\\$$decimal = 2" "print filelocal at bar" if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } - gdb_test "print 'scope1.c'::filelocal" "\\\$$decimal = 2" "print 'scope1.c'::filelocal at bar" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::filelocal" + gdb_test "print 'scope1.c'::filelocal" "\\\$$decimal = 2" "print 'scope1.c'::filelocal at bar" # Print scope1.c::filelocal_bss, which is 102 gdb_test "print filelocal_bss" "\\\$$decimal = 102" "print filelocal_bss at bar" if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } - gdb_test "print 'scope1.c'::filelocal_bss" "\\\$$decimal = 102" "print 'scope1.c'::filelocal_bss at bar" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::filelocal_bss" + gdb_test "print 'scope1.c'::filelocal_bss" "\\\$$decimal = 102" "print 'scope1.c'::filelocal_bss at bar" # Print scope1.c::filelocal_ro, which is 202 gdb_test "print filelocal_ro" "\\\$$decimal = 202" "print filelocal_ro in test_at_bar" if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } - gdb_test "print 'scope1.c'::filelocal_ro" "\\\$$decimal = 202" "print 'scope1.c'::filelocal_ro at bar" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::filelocal_ro" + gdb_test "print 'scope1.c'::filelocal_ro" "\\\$$decimal = 202" "print 'scope1.c'::filelocal_ro at bar" # Print scope1.c::foo::funclocal, which is 3 gdb_test "print foo::funclocal" "\\\$$decimal = 3" "print foo::funclocal at bar" if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } - gdb_test "print 'scope1.c'::foo::funclocal" "\\\$$decimal = 3" "print 'scope1.c'::foo::funclocal at bar" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::foo::funclocal" + gdb_test "print 'scope1.c'::foo::funclocal" "\\\$$decimal = 3" "print 'scope1.c'::foo::funclocal at bar" # Print scope1.c::foo::funclocal_bss, which is 103 gdb_test "print foo::funclocal_bss" "\\\$$decimal = 103" "print foo::funclocal_bss at bar" if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } - gdb_test "print 'scope1.c'::foo::funclocal_bss" "\\\$$decimal = 103" "print 'scope1.c'::foo::funclocal_bss at bar" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::foo::funclocal_bss" + gdb_test "print 'scope1.c'::foo::funclocal_bss" "\\\$$decimal = 103" "print 'scope1.c'::foo::funclocal_bss at bar" # Print scope1.c::foo::funclocal_ro, which is 203 gdb_test "print foo::funclocal_ro" "\\\$$decimal = 203" "print foo::funclocal_ro at bar" if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } - gdb_test "print 'scope1.c'::foo::funclocal_ro" "\\\$$decimal = 203" "print 'scope1.c'::foo::funclocal_ro at bar" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::foo::funclocal_ro" + gdb_test "print 'scope1.c'::foo::funclocal_ro" "\\\$$decimal = 203" "print 'scope1.c'::foo::funclocal_ro at bar" # Print scope1.c::bar::funclocal, which is 4 gdb_test "print funclocal" "\\\$$decimal = 4" "print funclocal at bar" gdb_test "print bar::funclocal" "\\\$$decimal = 4" "print bar::funclocal at bar" if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } - gdb_test "print 'scope1.c'::bar::funclocal" "\\\$$decimal = 4" "print 'scope1.c'::bar::funclocal at bar" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::bar::funclocal" + gdb_test "print 'scope1.c'::bar::funclocal" "\\\$$decimal = 4" "print 'scope1.c'::bar::funclocal at bar" # Print scope1.c::bar::funclocal_bss, which is 104 gdb_test "print funclocal_bss" "\\\$$decimal = 104" "print funclocal_bss at bar" gdb_test "print bar::funclocal_bss" "\\\$$decimal = 104" "print bar::funclocal_bss at bar" if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } - gdb_test "print 'scope1.c'::bar::funclocal_bss" "\\\$$decimal = 104" "print 'scope1.c'::bar::funclocal_bss at bar" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::bar::funclocal_bss" + gdb_test "print 'scope1.c'::bar::funclocal_bss" "\\\$$decimal = 104" "print 'scope1.c'::bar::funclocal_bss at bar" } # This test has little to do with local scopes, but it is in scope.exp anyway. -- 2.30.2