10 |
write-state-long |
write-state-long |
11 |
write-state-short)) |
write-state-short)) |
12 |
|
|
13 |
|
;;; Procedures in this module print information about a stack frame. |
14 |
|
;;; The available information is as follows. |
15 |
|
;;; |
16 |
|
;;; * Source code location. |
17 |
|
;;; |
18 |
|
;;; For an evaluation frame, this is the location recorded at the time |
19 |
|
;;; that the expression being evaluated was read, if the 'positions |
20 |
|
;;; read option was enabled at that time. |
21 |
|
;;; |
22 |
|
;;; For an application frame, I'm not yet sure. Some applications |
23 |
|
;;; seem to have associated source expressions. |
24 |
|
;;; |
25 |
|
;;; * Whether frame is still evaluating its arguments. |
26 |
|
;;; |
27 |
|
;;; Only applies to an application frame. For example, an expression |
28 |
|
;;; like `(+ (* 2 3) 4)' goes through the following stages of |
29 |
|
;;; evaluation. |
30 |
|
;;; |
31 |
|
;;; (+ (* 2 3) 4) -- evaluation |
32 |
|
;;; [+ ... -- application; the car of the evaluation |
33 |
|
;;; has been evaluated and found to be a |
34 |
|
;;; procedure; before this procedure can |
35 |
|
;;; be applied, its arguments must be evaluated |
36 |
|
;;; [+ 6 ... -- same application after evaluating the |
37 |
|
;;; first argument |
38 |
|
;;; [+ 6 4] -- same application after evaluating all |
39 |
|
;;; arguments |
40 |
|
;;; 10 -- result |
41 |
|
;;; |
42 |
|
;;; * Whether frame is real or tail-recursive. |
43 |
|
;;; |
44 |
|
;;; If a frame is tail-recursive, its containing frame as shown by the |
45 |
|
;;; debugger backtrace doesn't really exist as far as the Guile |
46 |
|
;;; evaluator is concerned. The effect of this is that when a |
47 |
|
;;; tail-recursive frame returns, it looks as though its containing |
48 |
|
;;; frame returns at the same time. (And if the containing frame is |
49 |
|
;;; also tail-recursive, _its_ containing frame returns at that time |
50 |
|
;;; also, and so on ...) |
51 |
|
;;; |
52 |
|
;;; A `real' frame is one that is not tail-recursive. |
53 |
|
|
54 |
|
|
55 |
(define (write-state-short state) |
(define (write-state-short state) |
56 |
(let* ((frame (stack-ref (state-stack state) (state-index state))) |
(let* ((frame (stack-ref (state-stack state) (state-index state))) |
57 |
(source (frame-source frame)) |
(source (frame-source frame)) |