Mercurial > emacs
comparison lisp/emacs-lisp/edebug.el @ 16308:2334a3d634c0
(edebug-original-signal): Don't define it.
(edebug-signal): Call signal, not edebug-original-signal.
(edebug-enter): Bind signal-hook-function instead of fsetting signal.
(edebug-recursive-edit): Clear or clear signal-hook-function.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Tue, 24 Sep 1996 06:54:18 +0000 |
parents | 0e4f99bad2ec |
children | b3b88a1ee6aa |
comparison
equal
deleted
inserted
replaced
16307:3c75845250f0 | 16308:2334a3d634c0 |
---|---|
6 ;; Keywords: lisp, tools, maint | 6 ;; Keywords: lisp, tools, maint |
7 | 7 |
8 ;; LCD Archive Entry: | 8 ;; LCD Archive Entry: |
9 ;; edebug|Daniel LaLiberte|liberte@cs.uiuc.edu | 9 ;; edebug|Daniel LaLiberte|liberte@cs.uiuc.edu |
10 ;; |A source level debugger for Emacs Lisp. | 10 ;; |A source level debugger for Emacs Lisp. |
11 ;; |$Date: 1996/07/24 16:36:41 $|$Revision: 3.8 $|~/modes/edebug.el| | 11 ;; |$Date: 1996/09/23 04:39:19 $|$Revision: 3.9 $|~/modes/edebug.el| |
12 | 12 |
13 ;; This file is part of GNU Emacs. | 13 ;; This file is part of GNU Emacs. |
14 | 14 |
15 ;; GNU Emacs is free software; you can redistribute it and/or modify | 15 ;; GNU Emacs is free software; you can redistribute it and/or modify |
16 ;; it under the terms of the GNU General Public License as published by | 16 ;; it under the terms of the GNU General Public License as published by |
83 ;; For the early revision history, see edebug-history. | 83 ;; For the early revision history, see edebug-history. |
84 | 84 |
85 ;;; Code: | 85 ;;; Code: |
86 | 86 |
87 (defconst edebug-version | 87 (defconst edebug-version |
88 (let ((raw-version "$Revision: 3.8 $")) | 88 (let ((raw-version "$Revision: 3.9 $")) |
89 (substring raw-version (string-match "[0-9.]*" raw-version) | 89 (substring raw-version (string-match "[0-9.]*" raw-version) |
90 (match-end 0)))) | 90 (match-end 0)))) |
91 | 91 |
92 (require 'backquote) | 92 (require 'backquote) |
93 | 93 |
2198 | 2198 |
2199 (defvar cl-lexical-debug) ;; Defined in cl.el | 2199 (defvar cl-lexical-debug) ;; Defined in cl.el |
2200 | 2200 |
2201 ;;; Handling signals | 2201 ;;; Handling signals |
2202 | 2202 |
2203 (if (not (fboundp 'edebug-original-signal)) | |
2204 (defalias 'edebug-original-signal (symbol-function 'signal))) | |
2205 ;; We should use advise for this!! | |
2206 | |
2207 (defun edebug-signal (edebug-signal-name edebug-signal-data) | 2203 (defun edebug-signal (edebug-signal-name edebug-signal-data) |
2208 "Signal an error. Args are SIGNAL-NAME, and associated DATA. | 2204 "Signal an error. Args are SIGNAL-NAME, and associated DATA. |
2209 A signal name is a symbol with an `error-conditions' property | 2205 A signal name is a symbol with an `error-conditions' property |
2210 that is a list of condition names. | 2206 that is a list of condition names. |
2211 A handler for any of those names will get to handle this signal. | 2207 A handler for any of those names will get to handle this signal. |
2221 error is signaled again." | 2217 error is signaled again." |
2222 (if (and (listp debug-on-error) (memq edebug-signal-name debug-on-error)) | 2218 (if (and (listp debug-on-error) (memq edebug-signal-name debug-on-error)) |
2223 (edebug 'error (cons edebug-signal-name edebug-signal-data))) | 2219 (edebug 'error (cons edebug-signal-name edebug-signal-data))) |
2224 ;; If we reach here without another non-local exit, then send signal again. | 2220 ;; If we reach here without another non-local exit, then send signal again. |
2225 ;; i.e. the signal is not continuable, yet. | 2221 ;; i.e. the signal is not continuable, yet. |
2226 (edebug-original-signal edebug-signal-name edebug-signal-data)) | 2222 (signal edebug-signal-name edebug-signal-data)) |
2227 | |
2228 | 2223 |
2229 ;;; Entering Edebug | 2224 ;;; Entering Edebug |
2230 | 2225 |
2231 (defun edebug-enter (edebug-function edebug-args edebug-body) | 2226 (defun edebug-enter (edebug-function edebug-args edebug-body) |
2232 ;; Entering FUNC. The arguments are ARGS, and the body is BODY. | 2227 ;; Entering FUNC. The arguments are ARGS, and the body is BODY. |
2265 ;; within edebug unless edebug-continue-kbd-macro is | 2260 ;; within edebug unless edebug-continue-kbd-macro is |
2266 ;; non-nil. Again, local binding may not be best. | 2261 ;; non-nil. Again, local binding may not be best. |
2267 (executing-kbd-macro | 2262 (executing-kbd-macro |
2268 (if edebug-continue-kbd-macro executing-kbd-macro)) | 2263 (if edebug-continue-kbd-macro executing-kbd-macro)) |
2269 | 2264 |
2265 (signal-hook-function 'edebug-signal) | |
2266 | |
2270 ;; Disable command hooks. This is essential when | 2267 ;; Disable command hooks. This is essential when |
2271 ;; a hook function is instrumented - to avoid infinite loop. | 2268 ;; a hook function is instrumented - to avoid infinite loop. |
2272 ;; This may be more than we need, however. | 2269 ;; This may be more than we need, however. |
2273 (pre-command-hook nil) | 2270 (pre-command-hook nil) |
2274 (post-command-hook nil)) | 2271 (post-command-hook nil)) |
2275 (setq edebug-execution-mode (or edebug-next-execution-mode | 2272 (setq edebug-execution-mode (or edebug-next-execution-mode |
2276 edebug-initial-mode | 2273 edebug-initial-mode |
2277 edebug-execution-mode) | 2274 edebug-execution-mode) |
2278 edebug-next-execution-mode nil) | 2275 edebug-next-execution-mode nil) |
2279 ;; Bind signal to edebug-signal only while Edebug is active. | 2276 (edebug-enter edebug-function edebug-args edebug-body)) |
2280 (fset 'signal 'edebug-signal) | |
2281 (unwind-protect | |
2282 (edebug-enter edebug-function edebug-args edebug-body) | |
2283 (fset 'signal (symbol-function 'edebug-original-signal)))) | |
2284 ;; Reset global variables in case outside value was changed. | 2277 ;; Reset global variables in case outside value was changed. |
2285 (setq executing-kbd-macro edebug-outside-executing-macro | 2278 (setq executing-kbd-macro edebug-outside-executing-macro |
2286 pre-command-hook edebug-outside-pre-command-hook | 2279 pre-command-hook edebug-outside-pre-command-hook |
2287 post-command-hook edebug-outside-post-command-hook | 2280 post-command-hook edebug-outside-post-command-hook |
2288 ))) | 2281 ))) |
2861 (if (and (eq edebug-execution-mode 'go) | 2854 (if (and (eq edebug-execution-mode 'go) |
2862 (not (memq edebug-arg-mode '(after error)))) | 2855 (not (memq edebug-arg-mode '(after error)))) |
2863 (message "Break")) | 2856 (message "Break")) |
2864 | 2857 |
2865 (setq buffer-read-only t) | 2858 (setq buffer-read-only t) |
2866 (fset 'signal (symbol-function 'edebug-original-signal)) | 2859 (setq signal-hook-function nil) |
2867 | 2860 |
2868 (edebug-mode) | 2861 (edebug-mode) |
2869 (unwind-protect | 2862 (unwind-protect |
2870 (recursive-edit) ; <<<<<<<<<< Recursive edit | 2863 (recursive-edit) ; <<<<<<<<<< Recursive edit |
2871 | 2864 |
2872 ;; Do the following, even if quit occurs. | 2865 ;; Do the following, even if quit occurs. |
2873 (fset 'signal 'edebug-signal) | 2866 (setq signal-hook-function 'edebug-signal) |
2874 (if edebug-backtrace-buffer | 2867 (if edebug-backtrace-buffer |
2875 (kill-buffer edebug-backtrace-buffer)) | 2868 (kill-buffer edebug-backtrace-buffer)) |
2876 ;; Could be an option to keep eval display up. | 2869 ;; Could be an option to keep eval display up. |
2877 (if edebug-eval-buffer (kill-buffer edebug-eval-buffer)) | 2870 (if edebug-eval-buffer (kill-buffer edebug-eval-buffer)) |
2878 | 2871 |
4476 edebug-mark-marker | 4469 edebug-mark-marker |
4477 edebug-input-pending-p | 4470 edebug-input-pending-p |
4478 edebug-sit-for | 4471 edebug-sit-for |
4479 edebug-prin1-to-string | 4472 edebug-prin1-to-string |
4480 edebug-format | 4473 edebug-format |
4481 edebug-original-signal | |
4482 ;; lemacs | 4474 ;; lemacs |
4483 zmacs-deactivate-region | 4475 zmacs-deactivate-region |
4484 popup-menu | 4476 popup-menu |
4485 ;; CL | 4477 ;; CL |
4486 cl-macroexpand-all | 4478 cl-macroexpand-all |