From: Tom de Vries <tdevries@suse.de>
To: Tom Tromey <tom@tromey.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH] Fix "set debug parser"
Date: Mon, 28 Apr 2025 12:50:08 +0200 [thread overview]
Message-ID: <d23b7174-63bf-40cb-b55f-539a207eafac@suse.de> (raw)
In-Reply-To: <20250426231242.926679-1-tom@tromey.com>
On 4/27/25 01:12, Tom Tromey wrote:
> +gdb_test_no_output "set debug parse 1"
> +set saw_start 0
> +gdb_test_multiple "print 23" "print with debugging" -lbl {
> + "Starting parse" {
> + set saw_start 1
> + exp_continue
> + }
> + -re ".$decimal = 23" {
> + gdb_assert $saw_start $gdb_test_name
> + }
> +}
Hi Tom,
I looked at the test-case part, and noticed a few things:
- the "Starting parse" is without -re prefix (I didn't realize that was
allowed)
- the gdb_test_multiple doesn't consume the prompt, which causes
problems for subsequent tests (currently none)
- the matching strings allow sub-line matching.
I initially fixed the prompt consumption part by adding -wrap to '-re
".$decimal = 23"', but that makes it a two-line pattern which doesn't
work with line-by-line matching.
So, I get to this fixup patch:
...
diff --git a/gdb/testsuite/gdb.base/exprs.exp
b/gdb/testsuite/gdb.base/exprs.exp
index 81e78e50e62..99bb277913c 100644
--- a/gdb/testsuite/gdb.base/exprs.exp
+++ b/gdb/testsuite/gdb.base/exprs.exp
@@ -287,12 +287,17 @@ gdb_test "print v_short =}{= 3" \
gdb_test_no_output "set debug parse 1"
set saw_start 0
+set saw_val 0
gdb_test_multiple "print 23" "print with debugging" -lbl {
- "Starting parse" {
+ -re "\r\nStarting parse(?=\r\n)" {
set saw_start 1
exp_continue
}
- -re ".$decimal = 23" {
- gdb_assert $saw_start $gdb_test_name
+ -re "\r\n.$decimal = 23(?=\r\n)" {
+ set saw_val 1
+ exp_continue
+ }
+ -re -wrap "" {
+ gdb_assert { $saw_start && $saw_val } $gdb_test_name
}
}
...
I suppose I would do:
...
set re_var [string_to_regexp "$"]$decimal
...
and use it here:
...
-re "\r\n$re_var = 23(?=\r\n)" {
...
but I guess that's personal preference.
Thanks,
- Tom
next prev parent reply other threads:[~2025-04-28 10:50 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-26 23:12 Tom Tromey
2025-04-28 10:50 ` Tom de Vries [this message]
2025-04-28 22:29 ` Tom Tromey
2025-04-29 7:42 ` Tom de Vries
2025-05-02 20:30 ` Simon Marchi
2025-05-03 14:26 ` Simon Marchi
2025-05-03 17:26 ` Tom Tromey
2025-05-03 17:25 ` 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=d23b7174-63bf-40cb-b55f-539a207eafac@suse.de \
--to=tdevries@suse.de \
--cc=gdb-patches@sourceware.org \
--cc=tom@tromey.com \
/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