File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -2464,8 +2464,19 @@ If ARG is non-nil, stop all threads unconditionally."
24642464 (interactive )
24652465 (gdb--with-valid-session
24662466 (when (gdb--session-threads session)
2467- (gdb--command " kill" nil nil 'no-resume )
2468- t )))
2467+ ; ; NOTE(nox): Workaround for GDB bug
2468+ ; ;
2469+ ; ; Due to the non-stop mode, GDB sometimes crashes when rerunning an inferior that was killed while
2470+ ; ; it had some threads running. This ensures all threads are stopped before killing the inferior.
2471+ ; ;
2472+ (gdb--command " -exec-interrupt --all" )
2473+ (cl-loop do (accept-process-output (gdb--session-process session) 0.5 )
2474+ if (cl-loop for thread in (gdb--session-threads session)
2475+ unless (string= " stopped" (gdb--thread-state thread)) return nil
2476+ finally return t )
2477+ return nil )
2478+
2479+ (gdb--command " -target-disconnect" ))))
24692480
24702481(defun gdb-select ()
24712482 " Select inferred frame or thread."
You can’t perform that action at this time.
0 commit comments