Mercurial > hg > xemacs-beta
comparison lisp/edebug/edebug.el @ 136:b980b6286996 r20-2b2
Import from CVS: tag r20-2b2
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:31:12 +0200 |
parents | 9b50b4588a93 |
children | 28f395d8dc7a |
comparison
equal
deleted
inserted
replaced
135:4636a6841cd6 | 136:b980b6286996 |
---|---|
27 ;;; Commentary: | 27 ;;; Commentary: |
28 | 28 |
29 ;; LCD Archive Entry: | 29 ;; LCD Archive Entry: |
30 ;; edebug|Daniel LaLiberte|liberte@cs.uiuc.edu | 30 ;; edebug|Daniel LaLiberte|liberte@cs.uiuc.edu |
31 ;; |A source level debugger for Emacs Lisp. | 31 ;; |A source level debugger for Emacs Lisp. |
32 ;; |$Date: 1997/04/13 03:13:54 $|$Revision: 1.4 $|~/modes/edebug.el| | 32 ;; |$Date: 1997/04/24 03:59:43 $|$Revision: 1.5 $|~/modes/edebug.el| |
33 | 33 |
34 ;; This minor mode allows programmers to step through Emacs Lisp | 34 ;; This minor mode allows programmers to step through Emacs Lisp |
35 ;; source code while executing functions. You can also set | 35 ;; source code while executing functions. You can also set |
36 ;; breakpoints, trace (stopping at each expression), evaluate | 36 ;; breakpoints, trace (stopping at each expression), evaluate |
37 ;; expressions as if outside Edebug, reevaluate and display a list of | 37 ;; expressions as if outside Edebug, reevaluate and display a list of |
85 ;; For the early revision history, see edebug-history. | 85 ;; For the early revision history, see edebug-history. |
86 | 86 |
87 ;;; Code: | 87 ;;; Code: |
88 | 88 |
89 (defconst edebug-version | 89 (defconst edebug-version |
90 (let ((raw-version "$Revision: 1.4 $")) | 90 (let ((raw-version "$Revision: 1.5 $")) |
91 (substring raw-version (string-match "[0-9.]*" raw-version) | 91 (substring raw-version (string-match "[0-9.]*" raw-version) |
92 (match-end 0)))) | 92 (match-end 0)))) |
93 | 93 |
94 (require 'backquote) | 94 (require 'backquote) |
95 | 95 |
126 'edebug-print-circle | 126 'edebug-print-circle |
127 )))) | 127 )))) |
128 | 128 |
129 ;;; Options | 129 ;;; Options |
130 | 130 |
131 (defgroup edebug nil | |
132 "A source-level debugger for Emacs Lisp" | |
133 :group 'lisp) | |
134 | |
135 | |
131 (defvar edebug-setup-hook nil | 136 (defvar edebug-setup-hook nil |
132 "*Functions to call before edebug is used. | 137 "*Functions to call before edebug is used. |
133 Each time it is set to a new value, Edebug will call those functions | 138 Each time it is set to a new value, Edebug will call those functions |
134 once and then `edebug-setup-hook' is reset to nil. You could use this | 139 once and then `edebug-setup-hook' is reset to nil. You could use this |
135 to load up Edebug specifications associated with a package you are | 140 to load up Edebug specifications associated with a package you are |
136 using but only when you also use Edebug.") | 141 using but only when you also use Edebug.") |
137 | 142 |
138 (defvar edebug-all-defs nil | 143 (defcustom edebug-all-defs nil |
139 "*If non-nil, evaluation of any defining forms will instrument for Edebug. | 144 "*If non-nil, evaluation of any defining forms will instrument for Edebug. |
140 This applies to `eval-defun', `eval-region', `eval-buffer', and | 145 This applies to `eval-defun', `eval-region', `eval-buffer', and |
141 `eval-current-buffer'. `eval-region' is also called by | 146 `eval-current-buffer'. `eval-region' is also called by |
142 `eval-last-sexp', and `eval-print-last-sexp'. | 147 `eval-last-sexp', and `eval-print-last-sexp'. |
143 | 148 |
144 You can use the command `edebug-all-defs' to toggle the value of this | 149 You can use the command `edebug-all-defs' to toggle the value of this |
145 variable. You may wish to make it local to each buffer with | 150 variable. You may wish to make it local to each buffer with |
146 \(make-local-variable 'edebug-all-defs) in your | 151 \(make-local-variable 'edebug-all-defs) in your |
147 `emacs-lisp-mode-hook'.") | 152 `emacs-lisp-mode-hook'." |
148 | 153 :type 'boolean |
149 (defvar edebug-all-forms nil | 154 :group 'edebug) |
155 | |
156 (defcustom edebug-all-forms nil | |
150 "*Non-nil evaluation of all forms will instrument for Edebug. | 157 "*Non-nil evaluation of all forms will instrument for Edebug. |
151 This doesn't apply to loading or evaluations in the minibuffer. | 158 This doesn't apply to loading or evaluations in the minibuffer. |
152 Use the command `edebug-all-forms' to toggle the value of this option.") | 159 Use the command `edebug-all-forms' to toggle the value of this option." |
153 | 160 :type 'boolean |
154 (defvar edebug-eval-macro-args nil | 161 :group 'edebug) |
162 | |
163 (defcustom edebug-eval-macro-args nil | |
155 "*Non-nil means all macro call arguments may be evaluated. | 164 "*Non-nil means all macro call arguments may be evaluated. |
156 If this variable is nil, the default, Edebug will *not* wrap | 165 If this variable is nil, the default, Edebug will *not* wrap |
157 macro call arguments as if they will be evaluated. | 166 macro call arguments as if they will be evaluated. |
158 For each macro, a `edebug-form-spec' overrides this option. | 167 For each macro, a `edebug-form-spec' overrides this option. |
159 So to specify exceptions for macros that have some arguments evaluated | 168 So to specify exceptions for macros that have some arguments evaluated |
160 and some not, you should specify an `edebug-form-spec'. | 169 and some not, you should specify an `edebug-form-spec'. |
161 | 170 |
162 This option is going away soon.") | 171 This option is going away soon." |
163 | 172 :type 'boolean |
164 (defvar edebug-stop-before-symbols nil | 173 :group 'edebug) |
174 | |
175 (defcustom edebug-stop-before-symbols nil | |
165 "*Non-nil causes Edebug to stop before symbols as well as after. | 176 "*Non-nil causes Edebug to stop before symbols as well as after. |
166 In any case, a breakpoint or interrupt may stop before a symbol. | 177 In any case, a breakpoint or interrupt may stop before a symbol. |
167 | 178 |
168 This option is going away soon.") | 179 This option is going away soon." |
169 | 180 :type 'boolean |
170 (defvar edebug-save-windows t | 181 :group 'edebug) |
182 | |
183 (defcustom edebug-save-windows t | |
171 "*If non-nil, Edebug saves and restores the window configuration. | 184 "*If non-nil, Edebug saves and restores the window configuration. |
172 That takes some time, so if your program does not care what happens to | 185 That takes some time, so if your program does not care what happens to |
173 the window configurations, it is better to set this variable to nil. | 186 the window configurations, it is better to set this variable to nil. |
174 | 187 |
175 If the value is a list, only the listed windows are saved and | 188 If the value is a list, only the listed windows are saved and |
176 restored. | 189 restored. |
177 | 190 |
178 `edebug-toggle-save-windows' may be used to change this variable.") | 191 `edebug-toggle-save-windows' may be used to change this variable." |
179 | 192 :type '(choice boolean (repeat string)) |
180 (defvar edebug-save-displayed-buffer-points nil | 193 :group 'edebug) |
194 | |
195 (defcustom edebug-save-displayed-buffer-points nil | |
181 "*If non-nil, save and restore point in all displayed buffers. | 196 "*If non-nil, save and restore point in all displayed buffers. |
182 | 197 |
183 Saving and restoring point in other buffers is necessary if you are | 198 Saving and restoring point in other buffers is necessary if you are |
184 debugging code that changes the point of a buffer which is displayed | 199 debugging code that changes the point of a buffer which is displayed |
185 in a non-selected window. If Edebug or the user then selects the | 200 in a non-selected window. If Edebug or the user then selects the |
186 window, the buffer's point will be changed to the window's point. | 201 window, the buffer's point will be changed to the window's point. |
187 | 202 |
188 Saving and restoring point in all buffers is expensive, since it | 203 Saving and restoring point in all buffers is expensive, since it |
189 requires selecting each window twice, so enable this only if you need | 204 requires selecting each window twice, so enable this only if you need |
190 it.") | 205 it." |
191 | 206 :type 'boolean |
192 (defvar edebug-initial-mode 'step | 207 :group 'edebug) |
208 | |
209 (defcustom edebug-initial-mode 'step | |
193 "*Initial execution mode for Edebug, if non-nil. If this variable | 210 "*Initial execution mode for Edebug, if non-nil. If this variable |
194 is non-@code{nil}, it specifies the initial execution mode for Edebug | 211 is non-@code{nil}, it specifies the initial execution mode for Edebug |
195 when it is first activated. Possible values are step, next, go, | 212 when it is first activated. Possible values are step, next, go, |
196 Go-nonstop, trace, Trace-fast, continue, and Continue-fast.") | 213 Go-nonstop, trace, Trace-fast, continue, and Continue-fast." |
197 | 214 :type '(choice (const step) (const next) (const go) |
198 (defvar edebug-trace nil | 215 (const Go-nonstop) (const trace) |
216 (const Trace-fast) (const continue) | |
217 (const continue-fast)) | |
218 :group 'edebug) | |
219 | |
220 (defcustom edebug-trace nil | |
199 "*Non-nil means display a trace of function entry and exit. | 221 "*Non-nil means display a trace of function entry and exit. |
200 Tracing output is displayed in a buffer named `*edebug-trace*', one | 222 Tracing output is displayed in a buffer named `*edebug-trace*', one |
201 function entry or exit per line, indented by the recursion level. | 223 function entry or exit per line, indented by the recursion level. |
202 | 224 |
203 You can customize by replacing functions `edebug-print-trace-before' | 225 You can customize by replacing functions `edebug-print-trace-before' |
204 and `edebug-print-trace-after'.") | 226 and `edebug-print-trace-after'." |
205 | 227 :type 'boolean |
206 (defvar edebug-test-coverage nil | 228 :group 'edebug) |
229 | |
230 (defcustom edebug-test-coverage nil | |
207 "*If non-nil, Edebug tests coverage of all expressions debugged. | 231 "*If non-nil, Edebug tests coverage of all expressions debugged. |
208 This is done by comparing the result of each expression | 232 This is done by comparing the result of each expression |
209 with the previous result. Coverage is considered OK if two different | 233 with the previous result. Coverage is considered OK if two different |
210 results are found. | 234 results are found. |
211 | 235 |
212 Use `edebug-display-freq-count' to display the frequency count and | 236 Use `edebug-display-freq-count' to display the frequency count and |
213 coverage information for a definition.") | 237 coverage information for a definition." |
214 | 238 :type 'boolean |
215 (defvar edebug-continue-kbd-macro nil | 239 :group 'edebug) |
240 | |
241 (defcustom edebug-continue-kbd-macro nil | |
216 "*If non-nil, continue defining or executing any keyboard macro. | 242 "*If non-nil, continue defining or executing any keyboard macro. |
217 Use this with caution since it is not debugged.") | 243 Use this with caution since it is not debugged." |
218 | 244 :type 'boolean |
219 | 245 :group 'edebug) |
220 (defvar edebug-print-length 50 | 246 |
221 "*Default value of `print-length' to use while printing results in Edebug.") | 247 |
222 (defvar edebug-print-level 50 | 248 (defcustom edebug-print-length 50 |
223 "*Default value of `print-level' to use while printing results in Edebug.") | 249 "*Default value of `print-length' to use while printing results in Edebug." |
224 (defvar edebug-print-circle t | 250 :type 'integer |
225 "*Default value of `print-circle' to use while printing results in Edebug.") | 251 :group 'edebug) |
226 | 252 (defcustom edebug-print-level 50 |
227 (defvar edebug-unwrap-results nil | 253 "*Default value of `print-level' to use while printing results in Edebug." |
254 :type 'integer | |
255 :group 'edebug) | |
256 (defcustom edebug-print-circle t | |
257 "*Default value of `print-circle' to use while printing results in Edebug." | |
258 :type 'boolean | |
259 :group 'edebug) | |
260 | |
261 (defcustom edebug-unwrap-results nil | |
228 "*Non-nil if Edebug should unwrap results of expressions. | 262 "*Non-nil if Edebug should unwrap results of expressions. |
229 This is useful when debugging macros where the results of expressions | 263 This is useful when debugging macros where the results of expressions |
230 are instrumented expressions. But don't do this when results might be | 264 are instrumented expressions. But don't do this when results might be |
231 circular or an infinite loop will result.") | 265 circular or an infinite loop will result." |
232 | 266 :type 'boolean |
233 (defvar edebug-on-error t | 267 :group 'edebug) |
268 | |
269 (defcustom edebug-on-error t | |
234 "*Value bound to `debug-on-error' while Edebug is active. | 270 "*Value bound to `debug-on-error' while Edebug is active. |
235 | 271 |
236 If `debug-on-error' is non-nil, that value is still used. | 272 If `debug-on-error' is non-nil, that value is still used. |
237 | 273 |
238 If the value is a list of signal names, Edebug will stop when any of | 274 If the value is a list of signal names, Edebug will stop when any of |
239 these errors are signaled from Lisp code whether or not the signal is | 275 these errors are signaled from Lisp code whether or not the signal is |
240 handled by a `condition-case'. This option is useful for debugging | 276 handled by a `condition-case'. This option is useful for debugging |
241 signals that *are* handled since they would otherwise be missed. | 277 signals that *are* handled since they would otherwise be missed. |
242 After execution is resumed, the error is signaled again.") | 278 After execution is resumed, the error is signaled again." |
243 | 279 :type '(choice boolean (repeat string)) |
244 (defvar edebug-on-quit t | 280 :group 'edebug) |
245 "*Value bound to `debug-on-quit' while Edebug is active.") | 281 |
246 | 282 (defcustom edebug-on-quit t |
247 (defvar edebug-global-break-condition nil | 283 "*Value bound to `debug-on-quit' while Edebug is active." |
284 :type 'boolean | |
285 :group 'edebug) | |
286 | |
287 (defcustom edebug-global-break-condition nil | |
248 "*If non-nil, an expression to test for at every stop point. | 288 "*If non-nil, an expression to test for at every stop point. |
249 If the result is non-nil, then break. Errors are ignored.") | 289 If the result is non-nil, then break. Errors are ignored." |
290 :type 'sexp | |
291 :group 'edebug) | |
250 | 292 |
251 ;;; Form spec utilities. | 293 ;;; Form spec utilities. |
252 | 294 |
253 ;;;###autoload | 295 ;;;###autoload |
254 (defmacro def-edebug-spec (symbol spec) | 296 (defmacro def-edebug-spec (symbol spec) |