From: Keith Seitz <keiths@redhat.com>
To: Tom de Vries <tdevries@suse.de>, gdb-patches@sourceware.org
Subject: Re: [PATCH 08/11] [gdb/testsuite] Refactor exception handling in gdb_test_multiple
Date: Tue, 1 Sep 2026 09:13:29 -0700 [thread overview]
Message-ID: <4f957a9a-d555-44c1-ad6b-93dc0cd7b013@redhat.com> (raw)
In-Reply-To: <20260824135855.1195963-9-tdevries@suse.de>
Hi,
On 8/24/26 6:58 AM, Tom de Vries wrote:
> Simplify gdb_test_multiple using return -options and try/finally.
>
> In the process, we also try to fix PR34553.
>
> I've added a test to verify this, but it'll be only useful after remote_expect
> gets fixed [1].
>
> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=34552
> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=34553
>
> [1] https://debbugs.gnu.org/cgi/bugreport.cgi?bug=81691
> ---
> gdb/testsuite/gdb.testsuite/gdb-test.exp | 51 ++++++++++++++++++++++++
> gdb/testsuite/lib/gdb.exp | 37 +++++++++--------
> 2 files changed, 69 insertions(+), 19 deletions(-)
>
> diff --git a/gdb/testsuite/gdb.testsuite/gdb-test.exp b/gdb/testsuite/gdb.testsuite/gdb-test.exp
> index dab65f21bdb..231f0755f58 100644
> --- a/gdb/testsuite/gdb.testsuite/gdb-test.exp
> +++ b/gdb/testsuite/gdb.testsuite/gdb-test.exp
> @@ -49,6 +49,57 @@ with_test_prefix "cmd with trailing control code" {
> }
> }
>
> +foreach_with_prefix variant {0 1 2} {
> + proc level_2_inner {} {
> + if {$::variant == 0} {
> + return -level 2 "return_level_2"
> + } elseif {$::variant == 1} {
> + send_gdb "print 1\n"
> + set prompt_re [string_to_regexp "(gdb) "]
> + remote_expect host 10 {
> + -re " = 1\r\n$prompt_re$" {
> + return -level 2 "return_level_2"
> + }
> + }
> + } else {
> + gdb_test_multiple "print 1" "" {
> + -re -wrap " = 1" {
> + return -level 2 "return_level_2"
> + }
> + }
> + }
> + return "inner"
> + }
> +
> + proc level_2_outer {} {
> + level_2_inner
> + return "outer"
> + }
> +
> + try {
> + set res "initial"
> + set res [level_2_outer]
> + } finally {
> + if {$variant == 0} {
> + # trivial case.
> + gdb_assert {$res == "return_level_2"}
> + } elseif {$variant == 1} {
> + # Remove_expect case.
Typo? Should this be "remote_expect" case?
Keith
> + if {$res == "outer"} {
> + # Dejagnu bug.
> + # https://debbugs.gnu.org/cgi/bugreport.cgi?bug=81691
> + setup_xfail *-*-*
> + }
> + gdb_assert {$res == "return_level_2"}
> + set variant1_res $res
> + } else {
> + # Gdb_test_multiple case. This should work if the remote_expect
> + # case works.
> + gdb_assert {$res == $variant1_res}
> + }
> + }
> +}
> +
> # Change the prompt.
> set prompt "(GDB) "
> set prompt_re "\\(GDB\\) $"
next prev parent reply other threads:[~2026-09-01 16:14 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-24 13:58 [PATCH 00/11] [gdb/testsuite] Refactor exception handling Tom de Vries
2026-08-24 13:58 ` [PATCH 01/11] [gdb/testsuite] Normalize indentation in with_test_prefix Tom de Vries
2026-09-02 19:41 ` Tom Tromey
2026-09-04 9:48 ` Tom de Vries
2026-08-24 13:58 ` [PATCH 02/11] [gdb/testsuite] Fix return -level 2 bug " Tom de Vries
2026-09-02 19:46 ` Tom Tromey
2026-08-24 13:58 ` [PATCH 03/11] [gdb/testsuite] Simplify foreach_with_prefix Tom de Vries
2026-08-24 13:58 ` [PATCH 04/11] [gdb/testsuite] Refactor exception handling in foreach_with_prefix Tom de Vries
2026-08-24 13:58 ` [PATCH 05/11] [gdb/testsuite] Add transparent_uplevel Tom de Vries
2026-09-01 16:16 ` Keith Seitz
2026-08-24 13:58 ` [PATCH 06/11] [gdb/testsuite] Refactor exception handling Tom de Vries
2026-08-24 13:58 ` [PATCH 07/11] [gdb/testsuite] Refactor exception handling in gdb_expect Tom de Vries
2026-08-24 13:58 ` [PATCH 08/11] [gdb/testsuite] Refactor exception handling in gdb_test_multiple Tom de Vries
2026-08-25 7:29 ` Tom de Vries
2026-09-01 16:13 ` Keith Seitz [this message]
2026-08-24 13:58 ` [PATCH 09/11] [gdb/testsuite] Refactor exception handling in lock_file_acquire/release Tom de Vries
2026-08-24 13:58 ` [PATCH 10/11] [gdb/testsuite] Refactor exception handling in tentative_rename Tom de Vries
2026-08-24 13:58 ` [PATCH 11/11] [gdb/testsuite] Refactor exception handling in with_stub_devices Tom de Vries
2026-09-01 16:10 ` Keith Seitz
2026-09-01 17:07 ` [PATCH 00/11] [gdb/testsuite] Refactor exception handling Keith Seitz
2026-09-02 19:57 ` 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=4f957a9a-d555-44c1-ad6b-93dc0cd7b013@redhat.com \
--to=keiths@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=tdevries@suse.de \
/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