public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: Pedro Alves <pedro@palves.net>, Tom Tromey <tom@tromey.com>
Cc: gdb-patches@sourceware.org
Subject: [committed][gdb/testsuite] Fix -prompt handling in gdb_test
Date: Mon, 23 May 2022 14:50:54 +0200	[thread overview]
Message-ID: <27f65f2b-c934-1a7a-70b7-faf9d6765789@suse.de> (raw)
In-Reply-To: <d0183e6f-dae2-8aea-55fb-d05d59ed7a27@suse.de>

[-- Attachment #1: Type: text/plain, Size: 2408 bytes --]

[ was: Re: [pushed] Support -prompt and -lbl in gdb_test (Re: [PATCH 
5/5] Make gdb_test's question non-optional if specified) ]

On 5/23/22 14:01, Tom de Vries wrote:
> On 5/23/22 12:48, Tom de Vries wrote:
>> On 5/18/22 13:01, Pedro Alves wrote:
>>> diff --git a/gdb/testsuite/gdb.base/ui-redirect.exp 
>>> b/gdb/testsuite/gdb.base/ui-redirect.exp
>>> index 13bc964f46c..4ed82ae63bf 100644
>>> --- a/gdb/testsuite/gdb.base/ui-redirect.exp
>>> +++ b/gdb/testsuite/gdb.base/ui-redirect.exp
>>> @@ -117,12 +117,10 @@ with_test_prefix "debugging" {
>>>       gdb_test "set logging enabled on" \
>>>       "Copying output to /dev/null.*Copying debug output to 
>>> /dev/null\\."
>>> -    set prompt "$gdb_prompt \\\[infrun\\\] fetch_inferior_event: 
>>> exit\r\n$"
>>> -    gdb_test_multiple "continue" "continue" -prompt $prompt {
>>> -    -re "Continuing.*\\\[infrun\\\] .*\\\[infrun\\\] .*Breakpoint 
>>> \[0-9\]+, foo.*$prompt$" {
>>> -        pass $gdb_test_name
>>> -    }
>>> -    }
>>> +    gdb_test \
>>> +    -prompt "$gdb_prompt \\\[infrun\\\] fetch_inferior_event: 
>>> exit\r\n$" \
>>> +    "continue" \
>>> +    "Continuing.*\\\[infrun\\\] .*\\\[infrun\\\] .*Breakpoint 
>>> \[0-9\]+, foo.*"
>>>       gdb_test "set debug infrun 0"
>>>       gdb_test "set logging enabled off" "Done logging to /dev/null\\."
>>
>> I'm running into:
>> ...
>>    [infrun] maybe_set_commit_resumed_all_targets: not requesting 
>> commit-resumed for target native, no resumed threads^M
>> (gdb) FAIL: gdb.base/ui-redirect.exp: debugging: continue
>> [infrun] fetch_inferior_event: exit^M
>> ...
>>
>> I'm assuming it's related to this change.
> 
> That's confirmed, reproduces reliably with read1, and is fixed by 
> reverting the patch.
> 
> Looks like this in gdb_test:
> ...
>      lappend "-prompt $prompt"
> ...
> has no effect.
> 
> This fixes it:
> ...
> diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
> index 720418beac2..a6780d8d634 100644
> --- a/gdb/testsuite/lib/gdb.exp
> +++ b/gdb/testsuite/lib/gdb.exp
> @@ -1393,7 +1393,7 @@ proc gdb_test { args } {
>       set user_code [join $user_code]
> 
>       set opts {}
> -    lappend "-prompt $prompt"
> +    lappend opts "-prompt" "$prompt"
>       if {$lbl} {
>          lappend opts "-lbl"
>       }
> ...
> 

Tested and committed.

Thanks,
- Tom

[-- Attachment #2: 0004-gdb-testsuite-Fix-prompt-handling-in-gdb_test.patch --]
[-- Type: text/x-patch, Size: 1046 bytes --]

[gdb/testsuite] Fix -prompt handling in gdb_test

With check-read1 I run into:
...
   [infrun] maybe_set_commit_resumed_all_targets: not requesting
commit-resumed for target native, no resumed threads^M
(gdb) FAIL: gdb.base/ui-redirect.exp: debugging: continue
[infrun] fetch_inferior_event: exit^M
...

The problem is that proc gdb_test doesn't pass down the -prompt option to proc
gdb_test_multiple, due to a typo making this lappend without effect:
...
    set opts {}
    lappend "-prompt $prompt"
...

Fix this by actually appending to opts.

Tested on x86_64-linux.

---
 gdb/testsuite/lib/gdb.exp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 720418beac2..a6780d8d634 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -1393,7 +1393,7 @@ proc gdb_test { args } {
     set user_code [join $user_code]
 
     set opts {}
-    lappend "-prompt $prompt"
+    lappend opts "-prompt" "$prompt"
     if {$lbl} {
 	lappend opts "-lbl"
     }

  reply	other threads:[~2022-05-23 12:50 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 ` [PATCH 2/5] gdb.base/scope.exp: Remove bogus gdb_test questions Pedro Alves
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               ` Tom de Vries [this message]
2022-05-23 12:53               ` 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=27f65f2b-c934-1a7a-70b7-faf9d6765789@suse.de \
    --to=tdevries@suse.de \
    --cc=gdb-patches@sourceware.org \
    --cc=pedro@palves.net \
    --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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).