Function: gdb-reset

gdb-reset is a byte-compiled function defined in gdb-mi.el.gz.

Signature

(gdb-reset)

Documentation

Exit a debugging session cleanly.

Kills the gdb buffers, and resets variables and the source buffers.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/gdb-mi.el.gz
;; Called from `gud-sentinel' in gud.el:
(defun gdb-reset ()
  "Exit a debugging session cleanly.
Kills the gdb buffers, and resets variables and the source buffers."
  ;; Save GDB history
  (comint-write-input-ring)
  ;; The gdb-inferior buffer has a pty hooked up to the main gdb
  ;; process.  This pty must be deleted explicitly.
  (let ((pty (get-process "gdb-inferior")))
    (if pty (delete-process pty)))
  ;; Find gdb-mi buffers and kill them.
  (dolist (buffer (buffer-list))
    (unless (eq buffer gud-comint-buffer)
      (with-current-buffer buffer
        (if (eq gud-minor-mode 'gdbmi)
            (if (string-match "\\` ?\\*.+\\*\\'" (buffer-name))
                (kill-buffer nil)
              (gdb-remove-breakpoint-icons (point-min) (point-max) t)
              (setq gud-minor-mode nil)
              (kill-local-variable 'tool-bar-map)
              (kill-local-variable 'gdb-define-alist))))))
  (setq gdb-disassembly-position nil)
  (setq overlay-arrow-variable-list
        (delq 'gdb-disassembly-position overlay-arrow-variable-list))
  (setq fringe-indicator-alist '((overlay-arrow . right-triangle)))
  (setq gdb-stack-position nil)
  (setq overlay-arrow-variable-list
        (delq 'gdb-stack-position overlay-arrow-variable-list))
  (setq gdb-thread-position nil)
  (setq overlay-arrow-variable-list
        (delq 'gdb-thread-position overlay-arrow-variable-list))
  (if (boundp 'speedbar-frame) (speedbar-timer-fn))
  (setq gud-running nil)
  (setq gdb-active-process nil)
  (remove-hook 'after-save-hook 'gdb-create-define-alist t)
  ;; Recover window configuration.
  (when (or (eq gdb-restore-window-configuration-after-quit t)
            (and (eq gdb-restore-window-configuration-after-quit
                     'if-gdb-show-main)
                 gdb-show-main)
            (and (eq gdb-restore-window-configuration-after-quit
                     'if-gdb-many-windows)
                 gdb-many-windows))
    (when gdb--window-configuration-before
      (window-state-put gdb--window-configuration-before)
      ;; This way we don't accidentally restore an outdated window
      ;; configuration.
      (setq gdb--window-configuration-before nil))))