unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Nick Roberts <nick@nick.uklinux.net>
Cc: emacs-devel@gnu.org
Subject: Re: Toolbar problems with GDB mode.
Date: Fri, 10 Jan 2003 21:55:43 +0000	[thread overview]
Message-ID: <15903.16735.562173.992860@nick.uklinux.net> (raw)
In-Reply-To: <D2C8CE68-24B7-11D7-9137-00039363E640@swipnet.se>

 > 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. 

Nick

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))
	(save-excursion
	  (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
					 (current-buffer))
					left-margin-width
					right-margin-width))))))))

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	other threads:[~2003-01-10 21:55 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-03 17:50 Toolbar problems with GDB mode Jan D.
2003-01-03 20:05 ` Nick Roberts
2003-01-03 22:09   ` Jan D.
2003-01-04  0:25     ` Nick Roberts
2003-01-04 13:05       ` Jan D.
2003-01-04 19:54         ` Nick Roberts
2003-01-04 21:44           ` Jan D.
2003-01-06 20:05           ` Kevin Rodgers
2003-01-07 23:21             ` Nick Roberts
2003-01-10 16:23               ` Jan D.
2003-01-10 21:55                 ` Nick Roberts [this message]
2003-01-04 23:44     ` Richard Stallman
2003-01-05 23:20       ` Nick Roberts
2003-01-11 19:49         ` Stefan Monnier
2003-01-12  0:05           ` Nick Roberts
2003-01-12 20:13             ` Stefan Monnier
2003-01-04  9:57   ` Eli Zaretskii
2003-01-04 13:36     ` Jan D.

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=15903.16735.562173.992860@nick.uklinux.net \
    --to=nick@nick.uklinux.net \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).