]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdbserver/win32: fix crash on detach
authorStefano Moioli <smxdev4@gmail.com>
Wed, 6 Dec 2023 00:42:19 +0000 (01:42 +0100)
committerTom Tromey <tromey@adacore.com>
Tue, 12 Dec 2023 20:19:30 +0000 (13:19 -0700)
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>
gdbserver/win32-low.cc

index 2711fb335f64af24dbfb98604644a4326bd8abca..90d9510c7b9a580024204edf62591ae39f832d75 100644 (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;
 }