changeset 49146:8e748161e8cf

(gud-kill-buffer-hook): Save gud-minor-mode type. (gud-reset): New function. Reset environment at end of debugging. (gud-sentinel): Call gud-reset or gdb-reset.
author Nick Roberts <nickrob@snap.net.nz>
date Sat, 11 Jan 2003 16:46:35 +0000
parents c9b0a36c96b5
children 8a40184e2f0e
files lisp/gud.el
diffstat 1 files changed, 25 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/gud.el	Sat Jan 11 16:45:15 2003 +0000
+++ b/lisp/gud.el	Sat Jan 11 16:46:35 2003 +0000
@@ -2427,10 +2427,17 @@
 	 ;; buffer killed
 	 ;; Stop displaying an arrow in a source file.
 	 (setq overlay-arrow-position nil)
-	 (set-process-buffer proc nil))
+	 (set-process-buffer proc nil)
+	 (if (eq gud-minor-mode-type 'gdba)
+	     (gdb-reset)
+	   (gud-reset)))
 	((memq (process-status proc) '(signal exit))
 	 ;; Stop displaying an arrow in a source file.
 	 (setq overlay-arrow-position nil)
+	 (with-current-buffer gud-comint-buffer
+	   (if (eq gud-minor-mode 'gdba)
+	       (gdb-reset)
+	     (gud-reset)))
 	 (let* ((obuf (current-buffer)))
 	   ;; save-excursion isn't the right thing if
 	   ;;  process-buffer is current-buffer
@@ -2456,6 +2463,23 @@
 	     ;; if obuf is the gud buffer.
 	     (set-buffer obuf))))))
 
+(defvar gud-minor-mode-type nil)
+
+(defun gud-kill-buffer-hook ()
+  (if gud-minor-mode
+      (setq gud-minor-mode-type gud-minor-mode)))
+
+(add-hook 'kill-buffer-hook 'gud-kill-buffer-hook)
+
+(defun gud-reset ()
+  (dolist (buffer (buffer-list))
+    (if (not (eq buffer gud-comint-buffer))
+	(save-excursion
+	  (set-buffer buffer)
+	  (when gud-minor-mode
+	    (setq gud-minor-mode nil)
+	    (kill-local-variable 'tool-bar-map))))))
+
 (defun gud-display-frame ()
   "Find and obey the last filename-and-line marker from the debugger.
 Obeying it means displaying in another window the specified file and line."