[PATCH] gdb/testsuite: Avoid infinite loop in gdb.reverse/step-reverse.exp

Andrew Burgess aburgess@redhat.com
Thu Jun 1 09:32:33 GMT 2023


Thiago Jung Bauermann via Gdb-patches <gdb-patches@sourceware.org>
writes:

> This testcase sometimes gets stuck in a loop for hours when running in our
> CI. The problem is that due to an issue unrelated to reverse debugging the
> inferior exits early, and because of the overly generic ".*" pattern the
> testcase keeps sending the "next" command without noticing that the
> inferior is gone.
>
> gdb_test_multiple has a pattern to detect that "The program is not being
> run.", but since it is placed after the patterns from the caller it won't
> be triggered. It also has a timeout pattern, but for some reason I don't
> understand it often doesn't trigger.

The timeout is triggered between successful matches.  So each time the
test matches the '-re -wrap ".*"' this counts as a successful match and
the timeout is reset.

Thanks,
Andrew

>
> Since the test binary is compiled with debug information, fix by changing
> the pattern to match the source code line number that is shown by GDB right
> after the "step" command.
> ---
>  gdb/testsuite/gdb.reverse/step-reverse.exp | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/gdb/testsuite/gdb.reverse/step-reverse.exp b/gdb/testsuite/gdb.reverse/step-reverse.exp
> index 729218d4cb8c..766ca02910af 100644
> --- a/gdb/testsuite/gdb.reverse/step-reverse.exp
> +++ b/gdb/testsuite/gdb.reverse/step-reverse.exp
> @@ -261,7 +261,7 @@ if { "$step_out" == 1 } {
>  	-re -wrap "NEXT OVER THIS RECURSION.*" {
>  	    set step_out 0
>  	}
> -	-re -wrap ".*" {
> +	-re -wrap "^\[0-9\].*"  {
>  	    send_gdb "next\n"
>  	    exp_continue
>  	}
> @@ -286,7 +286,7 @@ gdb_test_multiple "next" "step over recursion inside the recursion" {
>  	gdb_assert {"$seen_recursive_call" == 1} \
>  	    "step over recursion inside the recursion"
>      }
> -    -re -wrap ".*" {
> +    -re -wrap "^\[0-9\].*" {
>  	send_gdb "next\n"
>  	exp_continue
>      }



More information about the Gdb-patches mailing list