On Sun, 29 Nov 2026 at 19:48, John David Anglin <[email protected]> wrote:
>
> Tested on hppa-unknown-linux-gnu.
>
> Okay?

OK thanks


>
> Dave
> ---
>
> libstdc++: Close remote target on eof and batch match in gdb-test.exp
>
> In gdb-test.exp, gdb-test and gdb_batch_check lacked eof clauses when
> waiting on GDB, and gdb_batch_check returned without closing the target
> connection upon matching the expected pattern.  Over large testsuite runs
> this leaks file descriptors and PTYs, which triggers a bug in Tcl/expect
> on big-endian targets and causes cascading timeouts that break the rest
> of the testsuite.
>
> Handle eof cleanly by calling remote_close target, and close the target
> connection before returning from gdb_batch_check on a match.
>
> 2026-11-29  John David Anglin  <[email protected]>
>
> libstdc++-v3/ChangeLog:
>
>         * testsuite/lib/gdb-test.exp (gdb-test): Handle eof and call
>         remote_close target.
>         (gdb_batch_check): Call remote_close target on pattern match and
>         handle eof.
>
> diff --git a/libstdc++-v3/testsuite/lib/gdb-test.exp 
> b/libstdc++-v3/testsuite/lib/gdb-test.exp
> index e80bbd8d11a..6a0994b7edf 100644
> --- a/libstdc++-v3/testsuite/lib/gdb-test.exp
> +++ b/libstdc++-v3/testsuite/lib/gdb-test.exp
> @@ -261,6 +261,12 @@ proc gdb-test { marker {selector {}} {load_xmethods 0} } 
> {
>             exp_continue
>         }
>
> +       eof {
> +           unsupported "$testname"
> +           remote_close target
> +           return
> +       }
> +
>         timeout {
>             unsupported "$testname"
>             remote_close target
> @@ -287,6 +293,7 @@ proc gdb_batch_check {command pattern} {
>
>      remote_expect target [timeout_value] {
>         -re $pattern {
> +           remote_close target
>             return 1
>         }
>
> @@ -295,6 +302,11 @@ proc gdb_batch_check {command pattern} {
>             exp_continue
>         }
>
> +       eof {
> +           remote_close target
> +           return 0
> +       }
> +
>         timeout {
>             remote_close target
>             return 0

Reply via email to