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 <tom@tromey.com>
This commit is contained in:
Stefano Moioli 2023-12-06 01:42:19 +01:00 committed by Tom Tromey
parent 80ffe72264
commit fa659800b0

View file

@ -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;
}