@@ -295,7 +295,7 @@ breakpoint of TYPE.")
295295 frame process buffers source-window debuggee-path debuggee-args
296296 buffer-types-to-update buffers-to-update
297297 threads selected-thread persist-thread selected-frame
298- breakpoints
298+ breakpoints killed-inferior
299299 (watchers-tick most-negative-fixnum) (watchers (make-hash-table :test 'equal )) root-watchers
300300 (hide-access-spec gdb-watchers-hide-access-specifiers))
301301(defvar gdb--sessions nil
@@ -1993,6 +1993,7 @@ it from the list."
19931993 thread))))
19941994
19951995 (t
1996+ (setf (gdb--session-killed-inferior session) nil ) ; ; NOTE(nox): Inferior is running, so it is not killed
19961997 (cl-pushnew 'gdb--threads (gdb--session-buffer-types-to-update session))
19971998 (gdb--conditional-switch thread '(no-selected-thread)))))))
19981999
@@ -2008,7 +2009,8 @@ it from the list."
20082009 (when (eq thread (gdb--session-selected-thread session))
20092010 (cl-pushnew 'gdb--frames (gdb--session-buffer-types-to-update session)))
20102011
2011- (gdb--conditional-switch (gdb--best-frame-to-switch-to thread) '(running same-thread))))
2012+ (unless (gdb--session-killed-inferior session)
2013+ (gdb--conditional-switch (gdb--best-frame-to-switch-to thread) '(running same-thread)))))
20122014
20132015(defun gdb--breakpoint-changed (number-str type disp enabled-str addr func fullname line-str at
20142016 pending thread cond times ignore-count what )
@@ -2474,6 +2476,7 @@ If ARG is non-nil, stop all threads unconditionally."
24742476 ; ; Due to the non-stop mode, GDB sometimes crashes when rerunning an inferior that was killed while
24752477 ; ; it had some threads running. This ensures all threads are stopped before killing the inferior.
24762478 ; ;
2479+ (setf (gdb--session-killed-inferior session) t )
24772480 (gdb--command " -exec-interrupt --all" )
24782481 (cl-loop do (accept-process-output (gdb--session-process session) 0.5 )
24792482 if (cl-loop for thread in (gdb--session-threads session)
0 commit comments