Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [pushed 1/4] [gdb/testsuite] Avoid "with bad program name" in gdb.base/corefile.exp
Date: Fri,  6 Nov 2026 13:58:26 +0100	[thread overview]
Message-ID: <20261106125829.1450659-2-tdevries@suse.de> (raw)
In-Reply-To: <20261106125829.1450659-1-tdevries@suse.de>

[ This commit assumes the situation before commit b32f06001cf ("Change
`...'-style quoting in gdb"). ]

With test-case gdb.base/corefile.exp, I get:
...
$ grep "with bad program name" gdb.sum
PASS: $exp: coreopt=--core=: just core file (with bad program name)
PASS: $exp: coreopt=--core=: core file with white space in name (with bad program name)
PASS: $exp: coreopt=-core=: just core file (with bad program name)
PASS: $exp: coreopt=-core=: core file with white space in name (with bad program name)
PASS: $exp: coreopt=-c : just core file (with bad program name)
PASS: $exp: coreopt=-c : core file with white space in name (with bad program name)
...

The " (with bad program name)" is there to deal with truncation of the
filename in the "Core was generated by" message.

However, in this case there's no truncation.

The problem is that this regexp fails to match:
...
"Core was generated by `[string_to_regexp $binfile]'\\.\r\n.*\#0  \[^\r\n\]+\(\).*"
...

The $binfile references the local binfile variable, which is used to determine
whether $::binfile is used as argument to gdb, and if not, $binfile == "".

Fix this by using $::binfile instead.
---
 gdb/testsuite/gdb.base/corefile.exp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/testsuite/gdb.base/corefile.exp b/gdb/testsuite/gdb.base/corefile.exp
index 4f36dc58b29..2e6beab9928 100644
--- a/gdb/testsuite/gdb.base/corefile.exp
+++ b/gdb/testsuite/gdb.base/corefile.exp
@@ -60,7 +60,7 @@ proc start_gdb_with_corefile { testname coreopt corefile {binfile ""} } {
 	    -re -wrap "Couldn't find .* registers in core file.*" {
 		fail "$gdb_test_name (couldn't find regs)"
 	    }
-	    -re -wrap "Core was generated by `[string_to_regexp $binfile]'\\.\r\n.*\#0  \[^\r\n\]+\(\).*" {
+	    -re -wrap "Core was generated by `[string_to_regexp $::binfile]'\\.\r\n.*\#0  \[^\r\n\]+\(\).*" {
 		pass $gdb_test_name
 	    }
 	    -re -wrap "Core was generated by .*\r\n\#0  .*\(\).*" {
-- 
2.51.0


  reply	other threads:[~2026-11-06 12:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-06 12:58 [pushed 0/4] [gdb/testsuite] Handle updated quoting style in some test-cases Tom de Vries
2026-11-06 12:58 ` Tom de Vries [this message]
2026-11-06 12:58 ` [pushed 2/4] [gdb/testsuite] Fix regexps in gdb.base/corefile.exp Tom de Vries
2026-11-06 13:45   ` Tom de Vries
2026-11-06 12:58 ` [pushed 3/4] [gdb/testsuite] Handle updated quoting style in some test-cases Tom de Vries
2026-11-06 12:58 ` [pushed 4/4] [gdb/ada] Fix error message in ada_funcall_operation::evaluate Tom de Vries
2026-11-06 14:33 ` [pushed 0/4] [gdb/testsuite] Handle updated quoting style in some test-cases 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=20261106125829.1450659-2-tdevries@suse.de \
    --to=tdevries@suse.de \
    --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