From: Pedro Alves <pedro@palves.net>
To: gdb-patches@sourceware.org
Subject: [PATCH 2/5] gdb.base/scope.exp: Remove bogus gdb_test questions
Date: Wed, 30 Mar 2022 20:29:26 +0100 [thread overview]
Message-ID: <20220330192929.3161015-3-pedro@palves.net> (raw)
In-Reply-To: <20220330192929.3161015-1-pedro@palves.net>
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.26.2
next prev parent reply other threads:[~2022-03-30 19:29 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-30 19:29 [PATCH 0/5] Make gdb_test's question non-optional if specified Pedro Alves
2022-03-30 19:29 ` [PATCH 1/5] Remove gdb_test questions that GDB doesn't ask Pedro Alves
2022-03-30 19:29 ` Pedro Alves [this message]
2022-03-30 19:29 ` [PATCH 3/5] Fix bogus gdb_test invocations Pedro Alves
2022-03-30 19:29 ` [PATCH 4/5] Avoid having to unload file in gdb.server/connect-with-no-symbol-file.exp Pedro Alves
2022-03-30 19:29 ` [PATCH 5/5] Make gdb_test's question non-optional if specified Pedro Alves
2022-04-07 20:31 ` Bruno Larsen
2022-04-08 12:18 ` Pedro Alves
2022-05-17 10:13 ` [PATCH 5/6] gdb.base/skip.exp: Don't abuse gdb_test's question support (Re: [PATCH 5/5] Make gdb_test's question non-optional if specified) Pedro Alves
2022-05-16 16:01 ` [PATCH 5/5] Make gdb_test's question non-optional if specified Tom Tromey
2022-05-17 11:25 ` Pedro Alves
2022-05-17 22:48 ` Tom Tromey
2022-05-18 11:01 ` [pushed] Support -prompt and -lbl in gdb_test (Re: [PATCH 5/5] Make gdb_test's question non-optional if specified) Pedro Alves
2022-05-18 12:15 ` Tom de Vries
2022-05-18 12:36 ` Pedro Alves
2022-05-18 14:13 ` Pedro Alves
2022-05-18 14:49 ` Tom de Vries
2022-05-18 20:34 ` Tom Tromey
2022-05-19 12:42 ` Pedro Alves
2022-05-23 10:48 ` Tom de Vries
2022-05-23 12:01 ` Tom de Vries
2022-05-23 12:50 ` [committed][gdb/testsuite] Fix -prompt handling in gdb_test Tom de Vries
2022-05-23 12:53 ` [pushed] Support -prompt and -lbl in gdb_test (Re: [PATCH 5/5] Make gdb_test's question non-optional if specified) Pedro Alves
2022-05-17 11:41 ` [PATCH 5/5] Make gdb_test's question non-optional if specified Simon Marchi
2022-05-17 12:04 ` Pedro Alves
2022-05-16 16:02 ` [PATCH 0/5] " Tom Tromey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220330192929.3161015-3-pedro@palves.net \
--to=pedro@palves.net \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).