1#
2# Commands useful for debugging the Scheme48 VM.
3#
4
5#Set a breakpoint at label "raise".
6#Obtain the proper line number using "egrep -n raise: scheme48vm.c".
7break scheme48vm.c:5227
8
9display/i $pc
10
11define pcont
12echo template id = \
13output *(long *)((*(long *)(($ & ~3) + 8) & ~3) + 4) / 4
14echo \npc = \
15output (*(long *)(($ & ~3) + 4) / 4)
16echo \nparent = \
17output *(long *)($ & ~3)
18echo \nenv = \
19output *(long *)(($ & ~3) + 12)
20echo \ncount = \
21output *(long *)(($ & ~3) - 4) >> 10
22echo \n
23end
24#
25document pcont
26Print $ as a continuation.
27end
28
29
30define parent
31print *(long *)($ & ~3)
32pcont
33end
34#
35document parent
36Select parent continuation.
37end
38
39
40define preview
41set $cont = ScontS
42preview-loop
43end
44#
45define preview-loop
46output $cont
47echo \040
48output *(long *)((*(long *)(($cont & ~3) + 8) & ~3) + 4) / 4
49echo \n
50set $cont = *(long *)($cont & ~3)
51preview-loop
52end
53#
54document preview
55Display Scheme stack trace.  Look up the template uids in the .debug file.
56end
57
58
59define show-header
60echo Header length:\
61output $hdr >> 8
62echo \ type:\040
63output ($hdr & 127) >> 2
64echo \ tag:\040
65output $hdr & 3
66echo \n
67end
68
69define look
70output ($ - Snewspace_beginS)
71echo :\n
72set $hdr = *(long *)($ - 7)
73show-header
74output *(long *)($ - 3)
75echo \n
76output *(long *)($ + 1)
77echo \n
78output *(long *)($ + 5)
79echo \n
80end
81
82define go0
83print *(long *)($ - 3)
84end
85
86define bytes
87set $foo = RScode_pointerS
88output (int)*(unsigned char *)($foo + 0)
89echo \040
90output (int)*(unsigned char *)($foo + 1)
91echo \040
92output (int)*(unsigned char *)($foo + 2)
93echo \040
94output (int)*(unsigned char *)($foo + 3)
95echo \040
96output (int)*(unsigned char *)($foo + 4)
97echo \n
98end
99