]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
Convert gdb.base/watchpoint-hw-attach.exp to spawn_wait_for_attach
authorPedro Alves <pedro@palves.net>
Wed, 3 Apr 2024 21:34:47 +0000 (22:34 +0100)
committerPedro Alves <pedro@palves.net>
Wed, 11 Jun 2025 13:54:21 +0000 (14:54 +0100)
commitbcacc8e58cd86bf9cbbeb75c5103aed5e6f84cb4
treec12174322bf1e9ae3dc55ffdf92161ce81c94807
parentda82701f3123b6cbf36758c06b00f25b62634d52
Convert gdb.base/watchpoint-hw-attach.exp to spawn_wait_for_attach

On Cygwin, starting an inferior under GDB, and detaching it, quitting
GDB, and then closing the shell, like so:

  (gdb) start
  (gdb) detach
  (gdb) quit
  # close shell

... hangs the parent shell of GDB (not GDB!) until the inferior
process that was detached (as it is still using the same terminal GDB
was using) exits too.

This leads to odd failures in gdb.base/watchpoint-hw-attach.exp like
so:

 detach
 Detaching from program: .../outputs/gdb.base/watchpoint-hw-attach/watchpoint-hw-attach, process 16580
 [Inferior 1 (process 16580) detached]
 (gdb) FAIL: gdb.base/watchpoint-hw-attach.exp: detach

Fix this by converting the testcase to spawn the inferior outside GDB,
with spawn_wait_for_attach.

With this patch, the testcase passes cleanly on Cygwin, for me.

Approved-By: Tom Tromey <tom@tromey.com>
Change-Id: I8e3884073a510d6fd2fff611e1d26fc808adc4fa
gdb/testsuite/gdb.base/watchpoint-hw-attach.exp