Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] [gdb/testsuite] Fix timeout in gdb.mi/mi-dprintf-modified.exp
@ 2026-10-29 17:36 Tom de Vries
  2026-10-30 12:57 ` Guinevere Larsen
  0 siblings, 1 reply; 3+ messages in thread
From: Tom de Vries @ 2026-10-29 17:36 UTC (permalink / raw)
  To: gdb-patches

With a gdb 17.2 based package, I ran into a timeout in test-case
gdb.mi/mi-dprintf-modified.exp:
...
(gdb)
PASS: $exp: get number for dprintf breakpoint
Expecting: ^(220-exec-next[
]+)?(.*[
]+[(]gdb[)]
[ ]*)
220-exec-next
220^running
*running,thread-id="all"
(gdb)
=library-loaded,id="/home/abuild/rpmbuild/BUILD/gdb-17.2/build-x86_64-suse-linux/gdb/testsuite.unix.-m64/outputs/gdb.mi/mi-dprintf-modified/mi-dprintf-modified-lib",target-name="/home/abuild/rpmbuild/BUILD/gdb-17.2/build-x86_64-suse-linux/gdb/testsuite.unix.-m64/outputs/gdb.mi/mi-dprintf-modified/mi-dprintf-modified-lib",host-name="/home/abuild/rpmbuild/BUILD/gdb-17.2/build-x86_64-suse-linux/gdb/testsuite.unix.-m64/outputs/gdb.mi/mi-dprintf-modified/mi-dprintf-modified-lib",symbols-loaded="0",thread-group="i1",ranges=[{from="0x00007ffff7fc7000",to="0x00007ffff7fca000"}]
*stopped,reason="end-stepping-range",frame={addr="0x000055555555480e",func="main",args=[],file="/home/abuild/rpmbuild/BUILD/gdb-17.2/gdb/testsuite/gdb.mi/mi-dprintf-modified.c",fullname="/home/abuild/rpmbuild/BUILD/gdb-17.2/gdb/testsuite/gdb.mi/mi-dprintf-modified.c",line="44",arch="i386:x86-64"},thread-id="1",stopped-threads="all",core="3"
(gdb)
PASS: $exp: next over dlopen
FAIL: $exp: wait for 'next' to complete (timeout)
...

This can be reliably reproduced on current trunk using:
...
-mi_gdb_test "220-exec-next" ".*" "next over dlopen"
+send_gdb "220-exec-next\n"
+sleep 1
+mi_gdb_test "" ".*" "next over dlopen"
...

The problem is the ".*", which consumes an MI prompt.

Fix this by anchoring the regexp on the output before the prompt.

Tested on x86_64-linux.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=34915
---
 gdb/testsuite/gdb.mi/mi-dprintf-modified.exp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gdb/testsuite/gdb.mi/mi-dprintf-modified.exp b/gdb/testsuite/gdb.mi/mi-dprintf-modified.exp
index 641c4c552ae..edb4c968643 100644
--- a/gdb/testsuite/gdb.mi/mi-dprintf-modified.exp
+++ b/gdb/testsuite/gdb.mi/mi-dprintf-modified.exp
@@ -74,7 +74,8 @@ set bpnum [mi_get_valueof "/d" "\$bpnum" "INVALID" \
 	       "get number for dprintf breakpoint"]
 
 # Use 'next' to step over loading the shared library.
-mi_gdb_test "220-exec-next" ".*" "next over dlopen"
+set re_last_line [string_to_regexp {*running,thread-id="all"}]
+mi_gdb_test "220-exec-next" ".*$re_last_line" "next over dlopen"
 
 # Now wait for the 'stopped' notification.  While we wait we should
 # see a 'library-loaded' notification for the loading of the shared

base-commit: 3d34f4b057169a79b10e43b33c2156f839d5b92c
-- 
2.51.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] [gdb/testsuite] Fix timeout in gdb.mi/mi-dprintf-modified.exp
  2026-10-29 17:36 [PATCH] [gdb/testsuite] Fix timeout in gdb.mi/mi-dprintf-modified.exp Tom de Vries
@ 2026-10-30 12:57 ` Guinevere Larsen
  2026-10-30 16:19   ` Tom de Vries
  0 siblings, 1 reply; 3+ messages in thread
From: Guinevere Larsen @ 2026-10-30 12:57 UTC (permalink / raw)
  To: Tom de Vries, gdb-patches

On 10/29/26 2:36 PM, Tom de Vries wrote:
> With a gdb 17.2 based package, I ran into a timeout in test-case
> gdb.mi/mi-dprintf-modified.exp:
> ...
> (gdb)
> PASS: $exp: get number for dprintf breakpoint
> Expecting: ^(220-exec-next[
> ]+)?(.*[
> ]+[(]gdb[)]
> [ ]*)
> 220-exec-next
> 220^running
> *running,thread-id="all"
> (gdb)
> =library-loaded,id="/home/abuild/rpmbuild/BUILD/gdb-17.2/build-x86_64-suse-linux/gdb/testsuite.unix.-m64/outputs/gdb.mi/mi-dprintf-modified/mi-dprintf-modified-lib",target-name="/home/abuild/rpmbuild/BUILD/gdb-17.2/build-x86_64-suse-linux/gdb/testsuite.unix.-m64/outputs/gdb.mi/mi-dprintf-modified/mi-dprintf-modified-lib",host-name="/home/abuild/rpmbuild/BUILD/gdb-17.2/build-x86_64-suse-linux/gdb/testsuite.unix.-m64/outputs/gdb.mi/mi-dprintf-modified/mi-dprintf-modified-lib",symbols-loaded="0",thread-group="i1",ranges=[{from="0x00007ffff7fc7000",to="0x00007ffff7fca000"}]
> *stopped,reason="end-stepping-range",frame={addr="0x000055555555480e",func="main",args=[],file="/home/abuild/rpmbuild/BUILD/gdb-17.2/gdb/testsuite/gdb.mi/mi-dprintf-modified.c",fullname="/home/abuild/rpmbuild/BUILD/gdb-17.2/gdb/testsuite/gdb.mi/mi-dprintf-modified.c",line="44",arch="i386:x86-64"},thread-id="1",stopped-threads="all",core="3"
> (gdb)
> PASS: $exp: next over dlopen
> FAIL: $exp: wait for 'next' to complete (timeout)
> ...
>
> This can be reliably reproduced on current trunk using:
> ...
> -mi_gdb_test "220-exec-next" ".*" "next over dlopen"
> +send_gdb "220-exec-next\n"
> +sleep 1
> +mi_gdb_test "" ".*" "next over dlopen"
> ...
>
> The problem is the ".*", which consumes an MI prompt.

Hi Tom! Thanks for working on this

I have checked that this patch does solve the issue but the explanation 
is confusing. It is technically correct to say that the problem is ".*" 
consuming an MI prompt, but I think the following is a better explanation:

    The problem is that ".*" may consume past the prompt and read the 
messages that the following
    gdb_test_multiple expects to consume, if they are produced fast enough.


Apart from this nit, I think this patch is a great fix

Reviewed-By: Guinevere Larsen <guinevere@redhat.com>

-- 
Cheers,
Guinevere Larsen
it/its
she/her (deprecated)

>
> Fix this by anchoring the regexp on the output before the prompt.
>
> Tested on x86_64-linux.
>
> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=34915
> ---
>   gdb/testsuite/gdb.mi/mi-dprintf-modified.exp | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/gdb/testsuite/gdb.mi/mi-dprintf-modified.exp b/gdb/testsuite/gdb.mi/mi-dprintf-modified.exp
> index 641c4c552ae..edb4c968643 100644
> --- a/gdb/testsuite/gdb.mi/mi-dprintf-modified.exp
> +++ b/gdb/testsuite/gdb.mi/mi-dprintf-modified.exp
> @@ -74,7 +74,8 @@ set bpnum [mi_get_valueof "/d" "\$bpnum" "INVALID" \
>   	       "get number for dprintf breakpoint"]
>   
>   # Use 'next' to step over loading the shared library.
> -mi_gdb_test "220-exec-next" ".*" "next over dlopen"
> +set re_last_line [string_to_regexp {*running,thread-id="all"}]
> +mi_gdb_test "220-exec-next" ".*$re_last_line" "next over dlopen"
>   
>   # Now wait for the 'stopped' notification.  While we wait we should
>   # see a 'library-loaded' notification for the loading of the shared
>
> base-commit: 3d34f4b057169a79b10e43b33c2156f839d5b92c


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] [gdb/testsuite] Fix timeout in gdb.mi/mi-dprintf-modified.exp
  2026-10-30 12:57 ` Guinevere Larsen
@ 2026-10-30 16:19   ` Tom de Vries
  0 siblings, 0 replies; 3+ messages in thread
From: Tom de Vries @ 2026-10-30 16:19 UTC (permalink / raw)
  To: Guinevere Larsen, gdb-patches

On 10/30/26 1:57 PM, Guinevere Larsen wrote:
> On 10/29/26 2:36 PM, Tom de Vries wrote:
>> With a gdb 17.2 based package, I ran into a timeout in test-case
>> gdb.mi/mi-dprintf-modified.exp:
>> ...
>> (gdb)
>> PASS: $exp: get number for dprintf breakpoint
>> Expecting: ^(220-exec-next[
>> ]+)?(.*[
>> ]+[(]gdb[)]
>> [ ]*)
>> 220-exec-next
>> 220^running
>> *running,thread-id="all"
>> (gdb)
>> =library-loaded,id="/home/abuild/rpmbuild/BUILD/gdb-17.2/build-x86_64- 
>> suse-linux/gdb/testsuite.unix.-m64/outputs/gdb.mi/mi-dprintf-modified/ 
>> mi-dprintf-modified-lib",target-name="/home/abuild/rpmbuild/BUILD/ 
>> gdb-17.2/build-x86_64-suse-linux/gdb/testsuite.unix.-m64/outputs/ 
>> gdb.mi/mi-dprintf-modified/mi-dprintf-modified-lib",host-name="/home/ 
>> abuild/rpmbuild/BUILD/gdb-17.2/build-x86_64-suse-linux/gdb/ 
>> testsuite.unix.-m64/outputs/gdb.mi/mi-dprintf-modified/mi-dprintf- 
>> modified-lib",symbols-loaded="0",thread- 
>> group="i1",ranges=[{from="0x00007ffff7fc7000",to="0x00007ffff7fca000"}]
>> *stopped,reason="end-stepping- 
>> range",frame={addr="0x000055555555480e",func="main",args=[],file="/ 
>> home/abuild/rpmbuild/BUILD/gdb-17.2/gdb/testsuite/gdb.mi/mi-dprintf- 
>> modified.c",fullname="/home/abuild/rpmbuild/BUILD/gdb-17.2/gdb/ 
>> testsuite/gdb.mi/mi-dprintf- 
>> modified.c",line="44",arch="i386:x86-64"},thread-id="1",stopped- 
>> threads="all",core="3"
>> (gdb)
>> PASS: $exp: next over dlopen
>> FAIL: $exp: wait for 'next' to complete (timeout)
>> ...
>>
>> This can be reliably reproduced on current trunk using:
>> ...
>> -mi_gdb_test "220-exec-next" ".*" "next over dlopen"
>> +send_gdb "220-exec-next\n"
>> +sleep 1
>> +mi_gdb_test "" ".*" "next over dlopen"
>> ...
>>
>> The problem is the ".*", which consumes an MI prompt.
> 
> Hi Tom! Thanks for working on this
> 
> I have checked that this patch does solve the issue but the explanation 
> is confusing. It is technically correct to say that the problem is ".*" 
> consuming an MI prompt, but I think the following is a better explanation:
> 
>     The problem is that ".*" may consume past the prompt and read the 
> messages that the following
>     gdb_test_multiple expects to consume, if they are produced fast enough.
> 
> 
> Apart from this nit, I think this patch is a great fix
> 

Hi Guinevere,

thanks for the review.

I've copied your suggestion, and pushed.

Thanks,
- Tom

> Reviewed-By: Guinevere Larsen <guinevere@redhat.com>
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-10-30 16:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-29 17:36 [PATCH] [gdb/testsuite] Fix timeout in gdb.mi/mi-dprintf-modified.exp Tom de Vries
2026-10-30 12:57 ` Guinevere Larsen
2026-10-30 16:19   ` Tom de Vries

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox