Mercurial > emacs
annotate lisp/cedet/semantic/debug.el @ 105663:2b51dcf71b63
Whitespace.
author | Juanma Barranquero <lekktu@gmail.com> |
---|---|
date | Sun, 18 Oct 2009 19:47:38 +0000 |
parents | 51bc239bdc37 |
children | 3fe6da4a95a9 |
rev | line source |
---|---|
104468
3e6235dcb480
lisp/cedet/semantic/java.el: File moved here from bovine/ subdirectory.
Chong Yidong <cyd@stupidchicken.com>
parents:
104421
diff
changeset
|
1 ;;; semantic/debug.el --- Language Debugger framework |
104421 | 2 |
105285 | 3 ;; Copyright (C) 2003, 2004, 2005, 2008, 2009 Free Software Foundation, Inc. |
104421 | 4 |
5 ;; Author: Eric M. Ludlam <zappo@gnu.org> | |
6 | |
7 ;; This file is part of GNU Emacs. | |
8 | |
9 ;; GNU Emacs is free software: you can redistribute it and/or modify | |
10 ;; it under the terms of the GNU General Public License as published by | |
11 ;; the Free Software Foundation, either version 3 of the License, or | |
12 ;; (at your option) any later version. | |
13 | |
14 ;; GNU Emacs is distributed in the hope that it will be useful, | |
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 ;; GNU General Public License for more details. | |
18 | |
19 ;; You should have received a copy of the GNU General Public License | |
20 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. | |
21 | |
22 ;;; Commentary: | |
23 ;; | |
24 ;; To provide better support for debugging parsers, this framework | |
25 ;; provides the interface for debugging. The work of parsing and | |
26 ;; controlling and stepping through the parsing work must be implemented | |
27 ;; by the parser. | |
28 ;; | |
105336 | 29 ;; Fortunately, the nature of language support files means that the parser |
104421 | 30 ;; may not need to be instrumented first. |
31 ;; | |
32 ;; The debugger uses EIEIO objects. One object controls the user | |
33 ;; interface, including stepping, data-view, queries. A second | |
34 ;; object implemented here represents the parser itself. A third represents | |
35 ;; a parser independent frame which knows how to highlight the parser buffer. | |
36 ;; Each parser must implement the interface and override any methods as needed. | |
37 ;; | |
38 | |
105652
51bc239bdc37
* cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
105377
diff
changeset
|
39 (eval-when-compile (require 'cl)) |
104421 | 40 (require 'semantic) |
41 (require 'eieio) | |
104470
6ccad1511df1
Minor whitespace changes and `require' fixes.
Chong Yidong <cyd@stupidchicken.com>
parents:
104468
diff
changeset
|
42 (eval-when-compile (require 'semantic/find)) |
104421 | 43 |
44 ;;; Code: | |
104470
6ccad1511df1
Minor whitespace changes and `require' fixes.
Chong Yidong <cyd@stupidchicken.com>
parents:
104468
diff
changeset
|
45 |
6ccad1511df1
Minor whitespace changes and `require' fixes.
Chong Yidong <cyd@stupidchicken.com>
parents:
104468
diff
changeset
|
46 ;;;###autoload |
104421 | 47 (defvar semantic-debug-parser-source nil |
48 "For any buffer, the file name (no path) of the parser. | |
49 This would be a parser for a specific language, not the source | |
50 to one of the parser generators.") | |
104470
6ccad1511df1
Minor whitespace changes and `require' fixes.
Chong Yidong <cyd@stupidchicken.com>
parents:
104468
diff
changeset
|
51 ;;;###autoload |
104421 | 52 (make-variable-buffer-local 'semantic-debug-parser-source) |
53 | |
104470
6ccad1511df1
Minor whitespace changes and `require' fixes.
Chong Yidong <cyd@stupidchicken.com>
parents:
104468
diff
changeset
|
54 ;;;###autoload |
104421 | 55 (defvar semantic-debug-parser-class nil |
56 "Class to create when building a debug parser object.") | |
104470
6ccad1511df1
Minor whitespace changes and `require' fixes.
Chong Yidong <cyd@stupidchicken.com>
parents:
104468
diff
changeset
|
57 ;;;###autoload |
104421 | 58 (make-variable-buffer-local 'semantic-debug-parser-class) |
59 | |
60 (defvar semantic-debug-enabled nil | |
61 "Non-nil when debugging a parser.") | |
62 | |
63 ;;; Variables used during a debug session. | |
64 (defvar semantic-debug-current-interface nil | |
65 "The debugger interface currently active for this buffer.") | |
66 | |
67 (defvar semantic-debug-current-parser nil | |
68 "The parser current active for this buffer.") | |
69 | |
70 ;;; User Interface Portion | |
71 ;; | |
72 (defclass semantic-debug-interface () | |
73 ((parser-buffer :initarg :parser-buffer | |
74 :type buffer | |
75 :documentation | |
76 "The buffer containing the parser we are debugging.") | |
77 (parser-local-map :initarg :parser-local-map | |
78 :type keymap | |
79 :documentation | |
80 "The local keymap originally in the PARSER buffer.") | |
81 (parser-location :type marker | |
82 :documentation | |
83 "A marker representing where we are in the parser buffer.") | |
84 (source-buffer :initarg :source-buffer | |
85 :type buffer | |
86 :documentation | |
87 "The buffer containing the source we are parsing. | |
88 The :parser-buffer defines a parser that can parse the text in the | |
89 :source-buffer.") | |
90 (source-local-map :initarg :source-local-map | |
91 :type keymap | |
92 :documentation | |
93 "The local keymap originally in the SOURCE buffer.") | |
94 (source-location :type marker | |
95 :documentation | |
96 "A marker representing where we are in the parser buffer.") | |
97 (data-buffer :initarg :data-buffer | |
98 :type buffer | |
99 :documentation | |
100 "Buffer being used to display some useful data. | |
101 These buffers are brought into view when layout occurs.") | |
102 (current-frame :type semantic-debug-frame | |
103 :documentation | |
104 "The currently displayed frame.") | |
105 (overlays :type list | |
106 :initarg nil | |
107 :documentation | |
108 "Any active overlays being used to show the debug position.") | |
109 ) | |
110 "Controls action when in `semantic-debug-mode'") | |
111 | |
112 ;; Methods | |
113 (defmethod semantic-debug-set-frame ((iface semantic-debug-interface) frame) | |
114 "Set the current frame on IFACE to FRAME." | |
115 (if frame | |
116 (oset iface current-frame frame) | |
117 (slot-makeunbound iface 'current-frame))) | |
118 | |
119 (defmethod semantic-debug-set-parser-location ((iface semantic-debug-interface) point) | |
120 "Set the parser location in IFACE to POINT." | |
121 (save-excursion | |
122 (set-buffer (oref iface parser-buffer)) | |
123 (if (not (slot-boundp iface 'parser-location)) | |
124 (oset iface parser-location (make-marker))) | |
125 (move-marker (oref iface parser-location) point)) | |
126 ) | |
127 | |
128 (defmethod semantic-debug-set-source-location ((iface semantic-debug-interface) point) | |
129 "Set the source location in IFACE to POINT." | |
130 (save-excursion | |
131 (set-buffer (oref iface source-buffer)) | |
132 (if (not (slot-boundp iface 'source-location)) | |
133 (oset iface source-location (make-marker))) | |
134 (move-marker (oref iface source-location) point)) | |
135 ) | |
136 | |
137 (defmethod semantic-debug-interface-layout ((iface semantic-debug-interface)) | |
138 "Layout windows in the current frame to facilitate debugging." | |
139 (delete-other-windows) | |
140 ;; Deal with the data buffer | |
141 (when (slot-boundp iface 'data-buffer) | |
142 (let ((lines (/ (frame-height (selected-frame)) 3)) | |
143 (cnt (save-excursion | |
144 (set-buffer (oref iface data-buffer)) | |
145 (count-lines (point-min) (point-max)))) | |
146 ) | |
147 ;; Set the number of lines to 1/3, or the size of the data buffer. | |
148 (if (< cnt lines) (setq cnt lines)) | |
104468
3e6235dcb480
lisp/cedet/semantic/java.el: File moved here from bovine/ subdirectory.
Chong Yidong <cyd@stupidchicken.com>
parents:
104421
diff
changeset
|
149 |
104421 | 150 (split-window-vertically cnt) |
151 (switch-to-buffer (oref iface data-buffer)) | |
152 ) | |
153 (other-window 1)) | |
154 ;; Parser | |
155 (switch-to-buffer (oref iface parser-buffer)) | |
156 (when (slot-boundp iface 'parser-location) | |
157 (goto-char (oref iface parser-location))) | |
158 (split-window-vertically) | |
159 (other-window 1) | |
160 ;; Source | |
161 (switch-to-buffer (oref iface source-buffer)) | |
162 (when (slot-boundp iface 'source-location) | |
163 (goto-char (oref iface source-location))) | |
164 ) | |
165 | |
166 (defmethod semantic-debug-highlight-lexical-token ((iface semantic-debug-interface) token) | |
167 "For IFACE, highlight TOKEN in the source buffer . | |
168 TOKEN is a lexical token." | |
169 (set-buffer (oref iface :source-buffer)) | |
170 | |
171 (object-add-to-list iface 'overlays | |
172 (semantic-lex-highlight-token token)) | |
173 | |
174 (semantic-debug-set-source-location iface (semantic-lex-token-start token)) | |
175 ) | |
176 | |
177 (defmethod semantic-debug-highlight-rule ((iface semantic-debug-interface) nonterm &optional rule match) | |
178 "For IFACE, highlight NONTERM in the parser buffer. | |
179 NONTERM is the name of the rule currently being processed that shows up | |
180 as a nonterminal (or tag) in the source buffer. | |
181 If RULE and MATCH indicies are specified, highlight those also." | |
182 (set-buffer (oref iface :parser-buffer)) | |
104468
3e6235dcb480
lisp/cedet/semantic/java.el: File moved here from bovine/ subdirectory.
Chong Yidong <cyd@stupidchicken.com>
parents:
104421
diff
changeset
|
183 |
104421 | 184 (let* ((rules (semantic-find-tags-by-class 'nonterminal (current-buffer))) |
185 (nt (semantic-find-first-tag-by-name nonterm rules)) | |
186 (o nil) | |
187 ) | |
188 (when nt | |
189 ;; I know it is the first symbol appearing in the body of this token. | |
190 (goto-char (semantic-tag-start nt)) | |
104468
3e6235dcb480
lisp/cedet/semantic/java.el: File moved here from bovine/ subdirectory.
Chong Yidong <cyd@stupidchicken.com>
parents:
104421
diff
changeset
|
191 |
104421 | 192 (setq o (semantic-make-overlay (point) (progn (forward-sexp 1) (point)))) |
193 (semantic-overlay-put o 'face 'highlight) | |
194 | |
195 (object-add-to-list iface 'overlays o) | |
196 | |
197 (semantic-debug-set-parser-location iface (semantic-overlay-start o)) | |
198 | |
199 (when (and rule match) | |
200 | |
201 ;; Rule, an int, is the rule inside the nonterminal we are following. | |
202 (re-search-forward ":\\s-*") | |
203 (while (/= 0 rule) | |
204 (re-search-forward "^\\s-*|\\s-*") | |
205 (setq rule (1- rule))) | |
206 | |
207 ;; Now find the match inside the rule | |
208 (while (/= 0 match) | |
209 (forward-sexp 1) | |
210 (skip-chars-forward " \t") | |
211 (setq match (1- match))) | |
212 | |
213 ;; Now highlight the thingy we find there. | |
214 (setq o (semantic-make-overlay (point) (progn (forward-sexp 1) (point)))) | |
215 (semantic-overlay-put o 'face 'highlight) | |
216 | |
217 (object-add-to-list iface 'overlays o) | |
218 | |
219 ;; If we have a match for a sub-rule, have the parser position | |
220 ;; move so we can see it in the output window for very long rules. | |
221 (semantic-debug-set-parser-location iface (semantic-overlay-start o)) | |
222 | |
223 )))) | |
224 | |
225 (defmethod semantic-debug-unhighlight ((iface semantic-debug-interface)) | |
226 "Remove all debugging overlays." | |
227 (mapc 'semantic-overlay-delete (oref iface overlays)) | |
228 (oset iface overlays nil)) | |
229 | |
230 ;; Call from the parser at a breakpoint | |
231 (defvar semantic-debug-user-command nil | |
232 "The command the user is requesting.") | |
233 | |
234 (defun semantic-debug-break (frame) | |
235 "Stop parsing now at FRAME. | |
236 FRAME is an object that represents the parser's view of the | |
237 current state of the world. | |
238 This function enters a recursive edit. It returns | |
239 on an `exit-recursive-edit', or if someone uses one | |
240 of the `semantic-debug-mode' commands. | |
241 It returns the command specified. Parsers need to take action | |
242 on different types of return values." | |
243 (save-window-excursion | |
244 ;; Set up displaying information | |
245 (semantic-debug-mode t) | |
246 (unwind-protect | |
247 (progn | |
248 (semantic-debug-frame-highlight frame) | |
249 (semantic-debug-interface-layout semantic-debug-current-interface) | |
250 (condition-case nil | |
251 ;; Enter recursive edit... wait for user command. | |
252 (recursive-edit) | |
253 (error nil))) | |
254 (semantic-debug-unhighlight semantic-debug-current-interface) | |
255 (semantic-debug-mode nil)) | |
256 ;; Find the requested user state. Do something. | |
257 (let ((returnstate semantic-debug-user-command)) | |
258 (setq semantic-debug-user-command nil) | |
259 returnstate) | |
260 )) | |
261 | |
262 ;;; Frame | |
263 ;; | |
264 ;; A frame can represent the state at a break point. | |
265 (defclass semantic-debug-frame () | |
266 ( | |
267 ) | |
268 "One frame representation.") | |
269 | |
270 (defmethod semantic-debug-frame-highlight ((frame semantic-debug-frame)) | |
271 "Highlight one parser frame." | |
104468
3e6235dcb480
lisp/cedet/semantic/java.el: File moved here from bovine/ subdirectory.
Chong Yidong <cyd@stupidchicken.com>
parents:
104421
diff
changeset
|
272 |
104421 | 273 ) |
274 | |
275 (defmethod semantic-debug-frame-info ((frame semantic-debug-frame)) | |
276 "Display info about this one parser frame." | |
104468
3e6235dcb480
lisp/cedet/semantic/java.el: File moved here from bovine/ subdirectory.
Chong Yidong <cyd@stupidchicken.com>
parents:
104421
diff
changeset
|
277 |
104421 | 278 ) |
279 | |
280 ;;; Major Mode | |
281 ;; | |
282 (defvar semantic-debug-mode-map | |
283 (let ((km (make-sparse-keymap))) | |
284 (define-key km "n" 'semantic-debug-next) | |
285 (define-key km " " 'semantic-debug-next) | |
286 (define-key km "s" 'semantic-debug-step) | |
287 (define-key km "u" 'semantic-debug-up) | |
288 (define-key km "d" 'semantic-debug-down) | |
289 (define-key km "f" 'semantic-debug-fail-match) | |
290 (define-key km "h" 'semantic-debug-print-state) | |
291 (define-key km "s" 'semantic-debug-jump-to-source) | |
292 (define-key km "p" 'semantic-debug-jump-to-parser) | |
293 (define-key km "q" 'semantic-debug-quit) | |
294 (define-key km "a" 'semantic-debug-abort) | |
295 (define-key km "g" 'semantic-debug-go) | |
296 (define-key km "b" 'semantic-debug-set-breakpoint) | |
297 ;; Some boring bindings. | |
298 (define-key km "e" 'eval-expression) | |
104468
3e6235dcb480
lisp/cedet/semantic/java.el: File moved here from bovine/ subdirectory.
Chong Yidong <cyd@stupidchicken.com>
parents:
104421
diff
changeset
|
299 |
104421 | 300 km) |
301 "Keymap used when in semantic-debug-node.") | |
302 | |
303 (defun semantic-debug-mode (onoff) | |
304 "Turn `semantic-debug-mode' on and off. | |
305 Argument ONOFF is non-nil when we are entering debug mode. | |
306 \\{semantic-debug-mode-map}" | |
307 (let ((iface semantic-debug-current-interface)) | |
308 (if onoff | |
309 ;; Turn it on | |
310 (save-excursion | |
311 (set-buffer (oref iface parser-buffer)) | |
312 ;; Install our map onto this buffer | |
313 (use-local-map semantic-debug-mode-map) | |
314 ;; Make the buffer read only | |
315 (toggle-read-only 1) | |
104468
3e6235dcb480
lisp/cedet/semantic/java.el: File moved here from bovine/ subdirectory.
Chong Yidong <cyd@stupidchicken.com>
parents:
104421
diff
changeset
|
316 |
104421 | 317 (set-buffer (oref iface source-buffer)) |
318 ;; Use our map in the source buffer also | |
319 (use-local-map semantic-debug-mode-map) | |
320 ;; Make the buffer read only | |
321 (toggle-read-only 1) | |
322 ;; Hooks | |
104513
a6a812dd2d88
* cedet/semantic/lex.el (semantic-lex-reset-hooks): Doc fix.
Chong Yidong <cyd@stupidchicken.com>
parents:
104470
diff
changeset
|
323 (run-hooks 'semantic-debug-mode-hook) |
104421 | 324 ) |
325 ;; Restore old mode information | |
326 (save-excursion | |
327 (set-buffer | |
328 (oref semantic-debug-current-interface parser-buffer)) | |
329 (use-local-map | |
330 (oref semantic-debug-current-interface parser-local-map)) | |
331 ) | |
332 (save-excursion | |
333 (set-buffer | |
334 (oref semantic-debug-current-interface source-buffer)) | |
335 (use-local-map | |
336 (oref semantic-debug-current-interface source-local-map)) | |
337 ) | |
104513
a6a812dd2d88
* cedet/semantic/lex.el (semantic-lex-reset-hooks): Doc fix.
Chong Yidong <cyd@stupidchicken.com>
parents:
104470
diff
changeset
|
338 (run-hooks 'semantic-debug-exit-hook) |
104421 | 339 ))) |
340 | |
341 (defun semantic-debug () | |
342 "Parse the current buffer and run in debug mode." | |
343 (interactive) | |
344 (if semantic-debug-current-interface | |
345 (error "You are already in a debug session")) | |
346 (if (not semantic-debug-parser-class) | |
347 (error "This major mode does not support parser debugging")) | |
348 ;; Clear the cache to force a full reparse. | |
349 (semantic-clear-toplevel-cache) | |
350 ;; Do the parse | |
351 (let ((semantic-debug-enabled t) | |
352 ;; Create an interface | |
353 (semantic-debug-current-interface | |
354 (let ((parserb (semantic-debug-find-parser-source))) | |
355 (semantic-debug-interface | |
356 "Debug Interface" | |
357 :parser-buffer parserb | |
358 :parser-local-map (save-excursion | |
359 (set-buffer parserb) | |
360 (current-local-map)) | |
361 :source-buffer (current-buffer) | |
362 :source-local-map (current-local-map) | |
363 ))) | |
364 ;; Create a parser debug interface | |
365 (semantic-debug-current-parser | |
366 (funcall semantic-debug-parser-class "parser")) | |
367 ) | |
368 ;; We could recurse into a parser while debugging. | |
369 ;; Is that a problem? | |
370 (semantic-fetch-tags) | |
371 ;; We should turn the auto-parser back on, but don't do it for | |
372 ;; now until the debugger is working well. | |
373 )) | |
374 | |
375 (defun semantic-debug-find-parser-source () | |
376 "Return a buffer containing the parser source file for the current buffer. | |
377 The parser needs to be on the load path, or this routine returns nil." | |
378 (if (not semantic-debug-parser-source) | |
379 (error "No parser is associated with this buffer")) | |
380 (let ((parser (locate-library semantic-debug-parser-source t))) | |
381 (if parser | |
382 (find-file-noselect parser) | |
383 (error "Cannot find parser source. It should be on the load-path")))) | |
384 | |
385 ;;; Debugger commands | |
386 ;; | |
387 (defun semantic-debug-next () | |
388 "Perform one parser operation. | |
389 In the recursive parser, this steps past one match rule. | |
390 In other parsers, this may be just like `semantic-debug-step'." | |
391 (interactive) | |
392 (let ((parser semantic-debug-current-parser)) | |
393 (semantic-debug-parser-next parser) | |
394 (exit-recursive-edit) | |
395 ) | |
396 ) | |
397 | |
398 (defun semantic-debug-step () | |
399 "Perform one parser operation." | |
400 (interactive) | |
401 (let ((parser semantic-debug-current-parser)) | |
402 (semantic-debug-parser-step parser) | |
403 (exit-recursive-edit) | |
404 ) | |
405 ) | |
406 | |
407 (defun semantic-debug-up () | |
408 "Move highlighting representation up one level." | |
409 (interactive) | |
410 (message "Not implemented yet.") | |
411 ) | |
412 | |
413 (defun semantic-debug-down () | |
414 "Move highlighting representation down one level." | |
415 (interactive) | |
416 (message "Not implemented yet.") | |
417 ) | |
418 | |
419 (defun semantic-debug-fail-match () | |
420 "Artificially fail the current match." | |
421 (interactive) | |
422 (let ((parser semantic-debug-current-parser)) | |
423 (semantic-debug-parser-fail parser) | |
424 (exit-recursive-edit) | |
425 ) | |
426 ) | |
427 | |
428 (defun semantic-debug-print-state () | |
429 "Show interesting parser state." | |
430 (interactive) | |
431 (let ((parser semantic-debug-current-parser)) | |
432 (semantic-debug-parser-print-state parser) | |
433 ) | |
434 ) | |
435 | |
436 (defun semantic-debug-jump-to-source () | |
437 "Move cursor to the source code being parsed at the current lexical token." | |
438 (interactive) | |
439 (let* ((interface semantic-debug-current-interface) | |
440 (buf (oref interface source-buffer))) | |
441 (if (get-buffer-window buf) | |
442 (progn | |
443 (select-frame (window-frame (get-buffer-window buf))) | |
444 (select-window (get-buffer-window buf))) | |
445 ;; Technically, this should do a window layout operation | |
446 (switch-to-buffer buf)) | |
447 ) | |
448 ) | |
449 | |
450 (defun semantic-debug-jump-to-parser () | |
451 "Move cursor to the parser being debugged." | |
452 (interactive) | |
453 (let* ((interface semantic-debug-current-interface) | |
454 (buf (oref interface parser-buffer))) | |
455 (if (get-buffer-window buf) | |
456 (progn | |
457 (select-frame (window-frame (get-buffer-window buf))) | |
458 (select-window (get-buffer-window buf))) | |
459 ;; Technically, this should do a window layout operation | |
460 (switch-to-buffer buf)) | |
461 ) | |
462 ) | |
463 | |
464 (defun semantic-debug-quit () | |
465 "Exit debug mode, blowing all stack, and leaving the parse incomplete. | |
466 Do not update any tokens already parsed." | |
467 (interactive) | |
468 (let ((parser semantic-debug-current-parser)) | |
469 (semantic-debug-parser-quit parser) | |
470 (exit-recursive-edit) | |
471 ) | |
472 ) | |
473 | |
474 (defun semantic-debug-abort () | |
475 "Abort one level of debug mode, blowing all stack." | |
476 (interactive) | |
477 (let ((parser semantic-debug-current-parser)) | |
478 (semantic-debug-parser-abort parser) | |
479 (exit-recursive-edit) | |
480 ) | |
481 ) | |
482 | |
483 (defun semantic-debug-go () | |
484 "Continue parsing till finish or breakpoint." | |
485 (interactive) | |
486 (let ((parser semantic-debug-current-parser)) | |
487 (semantic-debug-parser-go parser) | |
488 (exit-recursive-edit) | |
489 ) | |
490 ) | |
491 | |
492 (defun semantic-debug-set-breakpoint () | |
493 "Set a breakpoint at the current rule location." | |
494 (interactive) | |
495 (let ((parser semantic-debug-current-parser) | |
496 ;; Get the location as semantic tokens. | |
497 (location (semantic-current-tag)) | |
498 ) | |
499 (if location | |
500 (semantic-debug-parser-break parser location) | |
501 (error "Not on a rule")) | |
502 ) | |
503 ) | |
504 | |
505 | |
506 ;;; Debugger superclass | |
507 ;; | |
508 (defclass semantic-debug-parser () | |
509 ( | |
510 ) | |
511 "Represents a parser and its state. | |
512 When implementing the debug parser you can add extra functionality | |
513 by overriding one of the command methods. Be sure to use | |
514 `call-next-method' so that the debug command is saved, and passed | |
515 down to your parser later." | |
516 :abstract t) | |
517 | |
518 (defmethod semantic-debug-parser-next ((parser semantic-debug-parser)) | |
519 "Execute next for this PARSER." | |
520 (setq semantic-debug-user-command 'next) | |
521 ) | |
522 | |
523 (defmethod semantic-debug-parser-step ((parser semantic-debug-parser)) | |
524 "Execute a step for this PARSER." | |
525 (setq semantic-debug-user-command 'step) | |
526 ) | |
527 | |
528 (defmethod semantic-debug-parser-go ((parser semantic-debug-parser)) | |
529 "Continue executiong in this PARSER until the next breakpoint." | |
530 (setq semantic-debug-user-command 'go) | |
531 ) | |
532 | |
533 (defmethod semantic-debug-parser-fail ((parser semantic-debug-parser)) | |
534 "Continue executiong in this PARSER until the next breakpoint." | |
535 (setq semantic-debug-user-command 'fail) | |
536 ) | |
537 | |
538 (defmethod semantic-debug-parser-quit ((parser semantic-debug-parser)) | |
539 "Continue executiong in this PARSER until the next breakpoint." | |
540 (setq semantic-debug-user-command 'quit) | |
541 ) | |
542 | |
543 (defmethod semantic-debug-parser-abort ((parser semantic-debug-parser)) | |
544 "Continue executiong in this PARSER until the next breakpoint." | |
545 (setq semantic-debug-user-command 'abort) | |
546 ) | |
547 | |
548 (defmethod semantic-debug-parser-print-state ((parser semantic-debug-parser)) | |
549 "Print state for this PARSER at the current breakpoint." | |
550 (with-slots (current-frame) semantic-debug-current-interface | |
551 (when current-frame | |
552 (semantic-debug-frame-info current-frame) | |
553 ))) | |
554 | |
555 (defmethod semantic-debug-parser-break ((parser semantic-debug-parser)) | |
556 "Set a breakpoint for this PARSER." | |
557 ) | |
558 | |
559 ;; Stack stuff | |
560 (defmethod semantic-debug-parser-frames ((parser semantic-debug-parser)) | |
561 "Return a list of frames for the current parser. | |
562 A frame is of the form: | |
563 ( .. .what ? .. ) | |
564 " | |
565 (error "Parser has not implemented frame values") | |
566 ) | |
567 | |
568 | |
569 (provide 'semantic/debug) | |
570 | |
104470
6ccad1511df1
Minor whitespace changes and `require' fixes.
Chong Yidong <cyd@stupidchicken.com>
parents:
104468
diff
changeset
|
571 ;; Local variables: |
6ccad1511df1
Minor whitespace changes and `require' fixes.
Chong Yidong <cyd@stupidchicken.com>
parents:
104468
diff
changeset
|
572 ;; generated-autoload-file: "loaddefs.el" |
6ccad1511df1
Minor whitespace changes and `require' fixes.
Chong Yidong <cyd@stupidchicken.com>
parents:
104468
diff
changeset
|
573 ;; generated-autoload-feature: semantic/loaddefs |
6ccad1511df1
Minor whitespace changes and `require' fixes.
Chong Yidong <cyd@stupidchicken.com>
parents:
104468
diff
changeset
|
574 ;; generated-autoload-load-name: "semantic/debug" |
6ccad1511df1
Minor whitespace changes and `require' fixes.
Chong Yidong <cyd@stupidchicken.com>
parents:
104468
diff
changeset
|
575 ;; End: |
6ccad1511df1
Minor whitespace changes and `require' fixes.
Chong Yidong <cyd@stupidchicken.com>
parents:
104468
diff
changeset
|
576 |
105377 | 577 ;; arch-tag: 6f189d2d-8a65-45a5-a7f0-9894625eb860 |
104468
3e6235dcb480
lisp/cedet/semantic/java.el: File moved here from bovine/ subdirectory.
Chong Yidong <cyd@stupidchicken.com>
parents:
104421
diff
changeset
|
578 ;;; semantic/debug.el ends here |