From: Lancelot SIX <lsix@lancelotsix.com>
To: Simon Marchi <simon.marchi@polymtl.ca>, gdb-patches@sourceware.org
Subject: Re: [PATCH] gdb: use gdb_test_multiple in gdb_breakpoint
Date: Wed, 4 Jan 2023 18:02:48 +0000 [thread overview]
Message-ID: <20230104180248.4bumo5mm4vvpjx6c@ubuntu.lan> (raw)
In-Reply-To: <20230104174038.aeau2an7tmufa3pj@ubuntu.lan>
Something like this should fix the issue:.
From 25585cc98812c90f819d78742243299a933ac879 Mon Sep 17 00:00:00 2001
From: Lancelot SIX <lancelot.six@amd.com>
Date: Wed, 4 Jan 2023 17:58:08 +0000
Subject: [PATCH] gdb: ensure test_name is initialized in gdb_breakpoint
A refactoring in 4b9728bec15 (gdb: use gdb_test_multiple in
gdb_breakpoint) left the $test_name variable initialized.
This patch fixes this.
---
gdb/testsuite/lib/gdb.exp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index ba16b2ab315..e17eace4cb1 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -639,8 +639,9 @@ proc gdb_breakpoint { linespec args } {
set print_pass 1
}
+ set test_name "gdb_breakpoint: set breakpoint at $linespec"
# The first two regexps are what we get with -g, the third is without -g.
- gdb_test_multiple "$break_command $linespec" "gdb_breakpoint: set breakpoint at $linespec" {
+ gdb_test_multiple "$break_command $linespec" $test_name {
-re "$break_message \[0-9\]* at .*: file .*, line $decimal.\r\n$gdb_prompt $" {}
-re "$break_message \[0-9\]*: file .*, line $decimal.\r\n$gdb_prompt $" {}
-re "$break_message \[0-9\]* at .*$gdb_prompt $" {}
--
2.34.1
Best,
Lancelot.
On Wed, Jan 04, 2023 at 05:40:38PM +0000, Lancelot SIX via Gdb-patches wrote:
> On Wed, Jan 04, 2023 at 11:22:55AM -0500, Simon Marchi via Gdb-patches wrote:
> >
> >
> > On 1/4/23 11:18, Lancelot SIX wrote:
> > >> Oh, right, I missed that. I folded the test name in the
> > >> gdb_test_multiple call (removed the test_name var) and used
> > >> $gdb_test_name in the fail call. I updated the patch locally. Should I
> > >> add your Reviewed-By after those changes?
> > >>
> > >> Simon
> > >>
> > >
> > > Yes, with those change, feel free to add
> > >
> > > Reviewed-By: Lancelot Six <lancelot.six@amd.com>
> > >
> > > Best,
> > > Lancelot.
> >
> > Thanks, pushed!
> >
> > Simon
>
> Hi,
>
> I just saw the resulting patch, and is seems that $test_name is
> (conditionally) used after the gdb_test_multiple:
>
> diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
> index 135ace68d5e..ba16b2ab315 100644
> --- a/gdb/testsuite/lib/gdb.exp
> +++ b/gdb/testsuite/lib/gdb.exp
> @@ -639,18 +639,15 @@ proc gdb_breakpoint { linespec args } {
> set print_pass 1
> }
>
> - set test_name "gdb_breakpoint: set breakpoint at $linespec"
> -
> - send_gdb "$break_command $linespec\n"
> # The first two regexps are what we get with -g, the third is without -g.
> - gdb_expect 30 {
> + gdb_test_multiple "$break_command $linespec" "gdb_breakpoint: set breakpoint at $linespec" {
> -re "$break_message \[0-9\]* at .*: file .*, line $decimal.\r\n$gdb_prompt $" {}
> -re "$break_message \[0-9\]*: file .*, line $decimal.\r\n$gdb_prompt $" {}
> -re "$break_message \[0-9\]* at .*$gdb_prompt $" {}
> -re "$break_message \[0-9\]* \\(.*\\) pending.*$gdb_prompt $" {
> if {$pending_response == "n"} {
> if { $print_fail } {
> - fail $test_name
> + fail $gdb_name_name
> }
> return 0
> }
> @@ -659,35 +656,6 @@ proc gdb_breakpoint { linespec args } {
> send_gdb "$pending_response\n"
> exp_continue
> }
> - -re "A problem internal to GDB has been detected" {
> - if { $print_fail } {
> - fail "$test_name (GDB internal error)"
> - }
> - gdb_internal_error_resync
> - return 0
> - }
> - -re "$gdb_prompt $" {
> - if { $print_fail } {
> - fail $test_name
> - }
> - return 0
> - }
> - eof {
> - perror "GDB process no longer exists"
> - global gdb_spawn_id
> - set wait_status [wait -i $gdb_spawn_id]
> - verbose -log "GDB process exited with wait status $wait_status"
> - if { $print_fail } {
> - fail "$test_name (eof)"
> - }
> - return 0
> - }
> - timeout {
> - if { $print_fail } {
> - fail "$test_name (timeout)"
> - }
> - return 0
> - }
> }
> if { $print_pass } {
> pass $test_name
>
> Just here ^ $test_name is used, but the patch does not set it anymore.
> Looks like that it should become something like:
>
> set test_name "gdb_breakpoint: set breakpoint at $linespec"
> gdb_test_multiple "$break_command $linespec" $test_name {
> # unchanged
> }
> if { $print_pass } {
> pass $test_name
> }
>
> Sorry I missed that earlier.
>
> Lancelot.
next prev parent reply other threads:[~2023-01-04 18:03 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-03 19:22 Simon Marchi
2023-01-04 9:15 ` Lancelot SIX
2023-01-04 16:11 ` Simon Marchi
2023-01-04 16:18 ` Lancelot SIX
2023-01-04 16:22 ` Simon Marchi
2023-01-04 17:40 ` Lancelot SIX
2023-01-04 18:02 ` Lancelot SIX [this message]
2023-01-04 19:05 ` Simon Marchi
2023-01-04 19:12 ` Lancelot SIX
2023-01-05 9:04 ` Tom de Vries
2023-01-05 16:28 ` Simon Marchi
2023-01-05 16:31 ` Tom de Vries
2023-01-05 16:36 ` Simon Marchi
2023-01-10 15:33 ` Pedro Alves
2023-01-10 15:50 ` Simon Marchi
2023-01-10 19:56 ` Pedro Alves
2023-01-10 20:42 ` Simon Marchi
2023-01-11 19:05 ` Pedro Alves
2023-01-11 19:42 ` Simon Marchi
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=20230104180248.4bumo5mm4vvpjx6c@ubuntu.lan \
--to=lsix@lancelotsix.com \
--cc=gdb-patches@sourceware.org \
--cc=simon.marchi@polymtl.ca \
/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).