From: Stefano Moioli Date: Wed, 6 Dec 2023 00:42:19 +0000 (+0100) Subject: gdbserver/win32: fix crash on detach X-Git-Tag: binutils-2_42~616 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fa659800b009df1f0bdb0c5d24eec047fb9c3fa0;p=thirdparty%2Fbinutils-gdb.git gdbserver/win32: fix crash on detach this patch fixes a crash in gdbserver whenever a process is detached. the crash is caused by `detach` calling `remove_process` before `win32_clear_inferiors` error message: Detaching from process 184 ../../gdbserver/inferiors.cc:160: A problem internal to GDBserver has been detec ted. remove_process: Assertion `find_thread_process (process) == NULL' failed. This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information. Approved-By: Tom Tromey --- diff --git a/gdbserver/win32-low.cc b/gdbserver/win32-low.cc index 2711fb335f6..90d9510c7b9 100644 --- a/gdbserver/win32-low.cc +++ b/gdbserver/win32-low.cc @@ -734,9 +734,9 @@ win32_process_target::detach (process_info *process) return -1; DebugSetProcessKillOnExit (FALSE); + win32_clear_inferiors (); remove_process (process); - win32_clear_inferiors (); return 0; }