[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Toolbar problems with GDB mode.

From: Nick Roberts
Subject: Re: Toolbar problems with GDB mode.
Date: Fri, 10 Jan 2003 21:55:43 +0000

 > Actually it does make sense.  To reconnect to an embedded target, it is
 > convinient to quit the debugger and later restart it.  If one is
 > debugging something difficult, keeping output from previous sessions
 > in the gdb buffer is helpful.
 > Note, it is usually not a quit followed directly after a restart,
 > but rather quit, edit some files, compile, upload new loadmodule to
 > the target, reboot the target, restart debugger.
 > Can't you both have it in a buffer delete hook and in the sentinel?

I can use a local kill-buffer-hook to record gud-minor-mode type and then
reset things in gud-sentinel. This seems to do everything you want.
I will install these changes unless someone objects. 


gdb-ui.el - (gdb-quit) Remove.
            (gdb-reset) New function.

(defun gdb-reset ()
  "Exit a debugging session cleanly by killing the gdb buffers and resetting
 the source buffers."
  (gdb-delete-frames '())
  (dolist (buffer (buffer-list))
    (if (not (eq buffer gud-comint-buffer))
          (set-buffer buffer)
          (if (eq gud-minor-mode 'gdba)
              (if (string-match "^\*.+*$" (buffer-name))
                  (kill-buffer nil)
                (if (display-graphic-p)
                    (remove-images (point-min) (point-max))
                  (remove-strings (point-min) (point-max)))
                (setq left-margin-width 0)
                (setq gud-minor-mode nil)
                (kill-local-variable 'tool-bar-map)
                (setq gud-running nil)
                (if (get-buffer-window (current-buffer))
                    (set-window-margins (get-buffer-window

gud.el - (gud-sentinel) Reset buffers.
         (gud-reset) New function.
         (gud-kill-buffer-hook) New function.

--- gud.el.~1.170.~     Sun Dec 22 00:01:30 2002
+++ gud.el      Fri Jan 10 21:36:06 2003
@@ -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
@@ -2455,6 +2462,23 @@
             ;; Restore old buffer, but don't restore old point
             ;; 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.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]