1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-22 05:31:01 -08:00
This commit is contained in:
Joakim Verona 2012-09-12 22:22:29 +02:00
commit aac9139d11
37 changed files with 469 additions and 241 deletions

View file

@ -96,6 +96,9 @@ The value used here is passed to `quit-restore-window'."
(defvar debugger-previous-window nil
"This is the window last showing the debugger buffer.")
(defvar debugger-previous-window-height nil
"The last recorded height of `debugger-previous-window'.")
(defvar debugger-previous-backtrace nil
"The contents of the previous backtrace (including text properties).
This is to optimize `debugger-make-xrefs'.")
@ -107,10 +110,6 @@ This is to optimize `debugger-make-xrefs'.")
(defvar debugger-outer-track-mouse)
(defvar debugger-outer-last-command)
(defvar debugger-outer-this-command)
;; unread-command-char is obsolete,
;; but we still save and restore it
;; in case some user program still tries to set it.
(defvar debugger-outer-unread-command-char)
(defvar debugger-outer-unread-command-events)
(defvar debugger-outer-unread-post-input-method-events)
(defvar debugger-outer-last-input-event)
@ -162,8 +161,6 @@ first will be printed into the backtrace buffer."
(unless noninteractive
(message "Entering debugger..."))
(let (debugger-value
(debug-on-error nil)
(debug-on-quit nil)
(debugger-previous-state
(if (get-buffer "*Backtrace*")
(with-current-buffer (get-buffer "*Backtrace*")
@ -184,8 +181,6 @@ first will be printed into the backtrace buffer."
(debugger-outer-track-mouse track-mouse)
(debugger-outer-last-command last-command)
(debugger-outer-this-command this-command)
(debugger-outer-unread-command-char
(with-no-warnings unread-command-char))
(debugger-outer-unread-command-events unread-command-events)
(debugger-outer-unread-post-input-method-events
unread-post-input-method-events)
@ -220,8 +215,6 @@ first will be printed into the backtrace buffer."
(cursor-in-echo-area nil))
(unwind-protect
(save-excursion
(with-no-warnings
(setq unread-command-char -1))
(when (eq (car debugger-args) 'debug)
;; Skip the frames for backtrace-debug, byte-code,
;; and implement-debug-on-entry.
@ -236,7 +229,17 @@ first will be printed into the backtrace buffer."
. (,(when debugger-previous-window
`(previous-window . ,debugger-previous-window)))))
(setq debugger-window (selected-window))
(setq debugger-previous-window debugger-window)
(if (eq debugger-previous-window debugger-window)
(when debugger-jumping-flag
;; Try to restore previous height of debugger
;; window.
(condition-case nil
(window-resize
debugger-window
(- debugger-previous-window-height
(window-total-size debugger-window)))
(error nil)))
(setq debugger-previous-window debugger-window))
(debugger-mode)
(debugger-setup-buffer debugger-args)
(when noninteractive
@ -264,6 +267,9 @@ first will be printed into the backtrace buffer."
(recursive-edit))))
(when (and (window-live-p debugger-window)
(eq (window-buffer debugger-window) debugger-buffer))
;; Record height of debugger window.
(setq debugger-previous-window-height
(window-total-size debugger-window))
;; Unshow debugger-buffer.
(quit-restore-window debugger-window debugger-bury-or-kill))
;; Restore previous state of debugger-buffer in case we were
@ -288,8 +294,6 @@ first will be printed into the backtrace buffer."
(setq track-mouse debugger-outer-track-mouse)
(setq last-command debugger-outer-last-command)
(setq this-command debugger-outer-this-command)
(with-no-warnings
(setq unread-command-char debugger-outer-unread-command-char))
(setq unread-command-events debugger-outer-unread-command-events)
(setq unread-post-input-method-events
debugger-outer-unread-post-input-method-events)
@ -591,16 +595,7 @@ Applies to the frame whose line point is on in the backtrace."
(cursor-in-echo-area debugger-outer-cursor-in-echo-area))
(set-match-data debugger-outer-match-data)
(prog1
(let ((save-ucc (with-no-warnings unread-command-char)))
(unwind-protect
(progn
(with-no-warnings
(setq unread-command-char debugger-outer-unread-command-char))
(prog1 (progn ,@body)
(with-no-warnings
(setq debugger-outer-unread-command-char unread-command-char))))
(with-no-warnings
(setq unread-command-char save-ucc))))
(progn ,@body)
(setq debugger-outer-match-data (match-data))
(setq debugger-outer-load-read-function load-read-function)
(setq debugger-outer-overriding-terminal-local-map

View file

@ -235,11 +235,6 @@ If the result is non-nil, then break. Errors are ignored."
;;; Form spec utilities.
(defmacro def-edebug-form-spec (symbol spec-form)
"For compatibility with old version."
(def-edebug-spec symbol (eval spec-form)))
(make-obsolete 'def-edebug-form-spec 'def-edebug-spec "22.1")
(defun get-edebug-spec (symbol)
;; Get the spec of symbol resolving all indirection.
(let ((edebug-form-spec nil)
@ -2248,47 +2243,14 @@ error is signaled again.
(debug-on-quit edebug-on-quit)
;; Lexical bindings must be uncompiled for this to work.
(cl-lexical-debug t)
(edebug-outside-overriding-local-map overriding-local-map)
(edebug-outside-overriding-terminal-local-map
overriding-terminal-local-map)
;; Save the outside value of executing macro. (here??)
(edebug-outside-executing-macro executing-kbd-macro)
(edebug-outside-pre-command-hook
(edebug-var-status 'pre-command-hook))
(edebug-outside-post-command-hook
(edebug-var-status 'post-command-hook)))
(cl-lexical-debug t))
(unwind-protect
(let (;; Don't keep reading from an executing kbd macro
;; within edebug unless edebug-continue-kbd-macro is
;; non-nil. Again, local binding may not be best.
(executing-kbd-macro
(if edebug-continue-kbd-macro executing-kbd-macro))
;; Don't get confused by the user's keymap changes.
(overriding-local-map nil)
(overriding-terminal-local-map nil)
(signal-hook-function 'edebug-signal)
;; Disable command hooks. This is essential when
;; a hook function is instrumented - to avoid infinite loop.
;; This may be more than we need, however.
(pre-command-hook nil)
(post-command-hook nil))
(let ((signal-hook-function 'edebug-signal))
(setq edebug-execution-mode (or edebug-next-execution-mode
edebug-initial-mode
edebug-execution-mode)
edebug-next-execution-mode nil)
(edebug-enter edebug-function edebug-args edebug-body))
;; Reset global variables in case outside value was changed.
(setq executing-kbd-macro edebug-outside-executing-macro)
(edebug-restore-status
'post-command-hook edebug-outside-post-command-hook)
(edebug-restore-status
'pre-command-hook edebug-outside-pre-command-hook)))
(edebug-enter edebug-function edebug-args edebug-body))))
(let* ((edebug-data (get edebug-function 'edebug))
(edebug-def-mark (car edebug-data)) ; mark at def start
@ -2804,7 +2766,6 @@ MSG is printed after `::::} '."
;; in versions where the variable is *not* built-in.
;; Emacs 18 FIXME
(defvar edebug-outside-unread-command-char)
;; Emacs 19.
(defvar edebug-outside-last-command-event)
@ -2814,15 +2775,6 @@ MSG is printed after `::::} '."
(defvar edebug-outside-last-nonmenu-event)
(defvar edebug-outside-track-mouse)
;; Disable byte compiler warnings about unread-command-char and -event
;; (maybe works with byte-compile-version 2.22 at least)
(defvar edebug-unread-command-char-warning)
(defvar edebug-unread-command-event-warning)
(eval-when-compile ; FIXME
(setq edebug-unread-command-char-warning
(get 'unread-command-char 'byte-obsolete-variable))
(put 'unread-command-char 'byte-obsolete-variable nil))
(defun edebug-recursive-edit ()
;; Start up a recursive edit inside of edebug.
;; The current buffer is the edebug-buffer, which is put into edebug-mode.
@ -2844,14 +2796,24 @@ MSG is printed after `::::} '."
(edebug-outside-map (current-local-map))
(edebug-outside-standard-output standard-output)
(edebug-outside-overriding-local-map overriding-local-map)
(edebug-outside-overriding-terminal-local-map
overriding-terminal-local-map)
;; Save the outside value of executing macro. (here??)
(edebug-outside-executing-macro executing-kbd-macro)
(edebug-outside-pre-command-hook
(edebug-var-status 'pre-command-hook))
(edebug-outside-post-command-hook
(edebug-var-status 'post-command-hook))
(edebug-outside-standard-output standard-output)
(edebug-outside-standard-input standard-input)
(edebug-outside-defining-kbd-macro defining-kbd-macro)
(edebug-outside-last-command last-command)
(edebug-outside-this-command this-command)
(edebug-outside-unread-command-char unread-command-char) ; FIXME
(edebug-outside-current-prefix-arg current-prefix-arg)
(edebug-outside-last-input-event last-input-event)
@ -2867,9 +2829,6 @@ MSG is printed after `::::} '."
;; We could set these to the values for previous edebug call.
(last-command last-command)
(this-command this-command)
;; Assume no edebug command sets unread-command-char.
(unread-command-char -1)
(current-prefix-arg nil)
;; More for Emacs 19
@ -2879,7 +2838,17 @@ MSG is printed after `::::} '."
(last-nonmenu-event nil)
(track-mouse nil)
;; Bind again to outside values.
;; Don't keep reading from an executing kbd macro
;; within edebug unless edebug-continue-kbd-macro is
;; non-nil. Again, local binding may not be best.
(executing-kbd-macro
(if edebug-continue-kbd-macro executing-kbd-macro))
;; Don't get confused by the user's keymap changes.
(overriding-local-map nil)
(overriding-terminal-local-map nil)
;; Bind again to outside values.
(debug-on-error edebug-outside-debug-on-error)
(debug-on-quit edebug-outside-debug-on-quit)
@ -2887,6 +2856,12 @@ MSG is printed after `::::} '."
(defining-kbd-macro
(if edebug-continue-kbd-macro defining-kbd-macro))
;; Disable command hooks. This is essential when
;; a hook function is instrumented - to avoid infinite loop.
;; This may be more than we need, however.
(pre-command-hook nil)
(post-command-hook nil)
;; others??
)
@ -2933,7 +2908,6 @@ MSG is printed after `::::} '."
last-command-event edebug-outside-last-command-event
last-command edebug-outside-last-command
this-command edebug-outside-this-command
unread-command-char edebug-outside-unread-command-char
current-prefix-arg edebug-outside-current-prefix-arg
last-input-event edebug-outside-last-input-event
last-event-frame edebug-outside-last-event-frame
@ -2942,9 +2916,13 @@ MSG is printed after `::::} '."
standard-output edebug-outside-standard-output
standard-input edebug-outside-standard-input
defining-kbd-macro edebug-outside-defining-kbd-macro
))
))
defining-kbd-macro edebug-outside-defining-kbd-macro)
(setq executing-kbd-macro edebug-outside-executing-macro)
(edebug-restore-status
'post-command-hook edebug-outside-post-command-hook)
(edebug-restore-status
'pre-command-hook edebug-outside-pre-command-hook))))
;;; Display related functions
@ -3562,7 +3540,6 @@ Return the result of the last expression."
(last-command-event edebug-outside-last-command-event)
(last-command edebug-outside-last-command)
(this-command edebug-outside-this-command)
(unread-command-char edebug-outside-unread-command-char)
(unread-command-events edebug-outside-unread-command-events)
(current-prefix-arg edebug-outside-current-prefix-arg)
(last-input-event edebug-outside-last-input-event)
@ -3602,7 +3579,6 @@ Return the result of the last expression."
edebug-outside-last-command-event last-command-event
edebug-outside-last-command last-command
edebug-outside-this-command this-command
edebug-outside-unread-command-char unread-command-char
edebug-outside-unread-command-events unread-command-events
edebug-outside-current-prefix-arg current-prefix-arg
edebug-outside-last-input-event last-input-event
@ -4240,7 +4216,7 @@ It is removed when you hit any char."
(let ((buffer-read-only nil))
(undo-boundary)
(edebug-display-freq-count)
(setq unread-command-char (read-char))
(setq unread-command-events (append unread-command-events (read-event)))
;; Yuck! This doesn't seem to work at all for me.
(undo)))
@ -4357,13 +4333,6 @@ With prefix argument, make it a temporary breakpoint."
;; Extension for bytecomp to resolve undefined function references.
;; Requires new byte compiler.
;; Reenable byte compiler warnings about unread-command-char and -event.
;; Disabled before edebug-recursive-edit.
(eval-when-compile
(if edebug-unread-command-char-warning
(put 'unread-command-char 'byte-obsolete-variable
edebug-unread-command-char-warning)))
(eval-when-compile
;; The body of eval-when-compile seems to get evaluated with eval-defun.
;; We only want to evaluate when actually byte compiling.