aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPedro Alves <pedro@palves.net>2024-04-03 22:14:51 +0100
committerPedro Alves <pedro@palves.net>2025-06-09 18:49:19 +0100
commit4ad4852d4a1f6159ca92fb02cedb94b74be3c0cc (patch)
treefcec8bc47f8220602f0f351d91cf54f94655e666
parentda204a21787ebc06c23137646b19fa3836927a59 (diff)
downloadbinutils-users/palves/windows-non-stop-v2-plus.zip
binutils-users/palves/windows-non-stop-v2-plus.tar.gz
binutils-users/palves/windows-non-stop-v2-plus.tar.bz2
Announce attach should be earlier (submit separately)users/palves/windows-non-stop-v2-plus
If GDB ever hangs in the loop before the actual detach, it's nice to say: While working on the previous patch, I noticed: (gdb) detach [windows events] continue_one_thread: continuing 0x24c4, debug_registers_changed=0, ContextFlags=0xc810001f [windows events] continue_one_thread: trap flag for 0x24c4, trap=0 [windows events] continue_one_thread: continuing 0x22dc, debug_registers_changed=0, ContextFlags=0xd010001f [windows events] continue_one_thread: trap flag for 0x22dc, trap=0 [windows events] continue_one_thread: continuing 0x208c, debug_registers_changed=0, ContextFlags=0x0 [windows events] continue_one_thread: continuing 0x264c, debug_registers_changed=0, ContextFlags=0x0 [windows events] break_out_process_thread: got unrelated event, code 1 [windows events] windows_continue: windows_continue -> continue_last_debug_event [windows events] continue_last_debug_event: ContinueDebugEvent (cpid=11400, ctid=0x24c4, DBG_CONTINUE) [windows events] break_out_process_thread: got CREATE_THREAD_DEBUG_EVENT for break thread [windows events] windows_continue: windows_continue -> continue_last_debug_event [windows events] continue_last_debug_event: ContinueDebugEvent (cpid=11400, ctid=0x19fc, DBG_CONTINUE) Detaching from program: /home/alves/rocm/gdb/build-cygwin-testsuite/outputs/gdb.base/watchpoint-hw-attach/watchpoint-hw-attach, process 11400 [Inferior 1 (process 11400) detached] [windows events] close: inferior_ptid=0 Note the "Detaching from program" message only appears after we've done a lot of things, including looping looking for an event. If that ever hangs, we never see the "Detaching" message. That doesn't seem very consistent. This commit moves the target_announce_detach call earlier, before we actually detach. We now get: (gdb) detach Detaching from program: /home/alves/rocm/gdb/build-cygwin-testsuite/outputs/gdb.base/watchpoint-hw-attach/watchpoint-hw-attach, process 11544 [windows events] continue_one_thread: continuing 0x3554, debug_registers_changed=0, ContextFlags=0xc810001f [windows events] continue_one_thread: trap flag for 0x3554, trap=0 [windows events] continue_one_thread: continuing 0x4320, debug_registers_changed=0, ContextFlags=0xd010001f [windows events] continue_one_thread: trap flag for 0x4320, trap=0 [windows events] continue_one_thread: continuing 0x3944, debug_registers_changed=0, ContextFlags=0xd010001f [windows events] continue_one_thread: trap flag for 0x3944, trap=0 [windows events] continue_one_thread: continuing 0x1710, debug_registers_changed=0, ContextFlags=0x0 [windows events] break_out_process_thread: got unrelated event, code 1 [windows events] windows_continue: windows_continue -> continue_last_debug_event [windows events] continue_last_debug_event: ContinueDebugEvent (cpid=11544, ctid=0x3554, DBG_CONTINUE) [windows events] break_out_process_thread: got CREATE_THREAD_DEBUG_EVENT for break thread [windows events] windows_continue: windows_continue -> continue_last_debug_event [windows events] continue_last_debug_event: ContinueDebugEvent (cpid=11544, ctid=0x438c, DBG_CONTINUE) [Inferior 1 (process 11544) detached] [windows events] close: inferior_ptid=0 Change-Id: I5c3b90cd8cb8755480c2e2b6e23e34fb9043e47e
-rw-r--r--gdb/windows-nat.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index afc01ee..5ee8573 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -3061,6 +3061,8 @@ windows_nat_target::continue_status_for_event_detaching
void
windows_nat_target::detach (inferior *inf, int from_tty)
{
+ target_announce_detach (from_tty);
+
DWORD continue_status = DBG_CONTINUE;
/* For any thread the core hasn't resumed, call prepare_resume with
@@ -3176,8 +3178,6 @@ windows_nat_target::detach (inferior *inf, int from_tty)
throw_winerror_with_name (msg.c_str (), *err);
}
- target_announce_detach (from_tty);
-
x86_cleanup_dregs ();
switch_to_no_thread ();
detach_inferior (inf);