]> 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>
Mon, 9 Jun 2025 17:09:21 +0000 (18:09 +0100)
commitf927ba07d25133dfb1c7395b9fa07225f62faa8c
treedc914f8c42c2afb64d72e690f36624f58749001e
parent7a3ca126fe6b43a04a7a47930b0f6dac41e9f299
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 (and it 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.

Change-Id: I8e3884073a510d6fd2fff611e1d26fc808adc4fa
gdb/testsuite/gdb.base/watchpoint-hw-attach.exp