Slate debugger changes

0 views
Skip to first unread message

Timmy Douglas

unread,
Jan 3, 2009, 11:39:46 PM1/3/09
to slate-language
I added windows to the ui code and I'm working on improving the
debugger. I took some features out from the old version, but this
version is a little more stable and easy to use (I hope). I'm
wondering if anyone has some comments on the output. The changes are
in my branch in the git repository. This debugging session doesn't
really make sense, it just shows the 'bt' and frame feature. I'm open
to ideas for new features.
Here is a sample:

timmy@timmy-desktop:~/src/slate/cslatevm$ ./slate slate.image
Old Memory size: 419430400 bytes
New Memory size: 10485760 bytes
Image size: 12915632 bytes
Defining accessor 'StartupArguments' on: NoRole
Nil
Slate 4> load: 'src/lib/debugger.slate'.
Loading P'src/lib/debugger.slate'
Defining accessor 'printName' on: 'Debugger traitsWindow'
Defining accessor 'condition' on: NoRole
Defining accessor 'condition:' on: NoRole, NoRole
Defining accessor 'restarts' on: NoRole
Defining accessor 'restarts:' on: NoRole, NoRole
Defining accessor 'interpreter' on: NoRole
Defining accessor 'interpreter:' on: NoRole, NoRole
Defining accessor 'resource' on: NoRole
Defining accessor 'resource:' on: NoRole, NoRole
Defining accessor 'parser' on: NoRole
Defining accessor 'parser:' on: NoRole, NoRole
Defining accessor 'printer' on: NoRole
Defining accessor 'printer:' on: NoRole, NoRole
Defining accessor 'namespace' on: NoRole
Defining accessor 'namespace:' on: NoRole, NoRole
Defining accessor 'frameList' on: NoRole
Defining accessor 'frameList:' on: NoRole, NoRole
Defining accessor 'currentFrame' on: NoRole
Defining accessor 'currentFrame:' on: NoRole, NoRole
Defining accessor 'baseFramePointer' on: NoRole
Defining accessor 'baseFramePointer:' on: NoRole, NoRole
Defining accessor 'slateFrameSize' on: NoRole
Defining accessor 'slateFrameSize:' on: NoRole, NoRole
Defining accessor 'maxBacktraceSize' on: NoRole
Defining accessor 'maxBacktraceSize:' on: NoRole, NoRole
Defining accessor 'basePrompt' on: NoRole
Defining accessor 'basePrompt:' on: NoRole, NoRole
Defining function 'surroundings' on: 'Debugger traits'
Defining accessor 'printName' on: 'DebuggingFrame traitsWindow'
Defining accessor 'resultStackLocation' on: NoRole
Defining accessor 'resultStackLocation:' on: NoRole, NoRole
Defining accessor 'instructionPointer' on: NoRole
Defining accessor 'instructionPointer:' on: NoRole, NoRole
Defining accessor 'method' on: NoRole
Defining accessor 'method:' on: NoRole, NoRole
Defining accessor 'framePointer' on: NoRole
Defining accessor 'framePointer:' on: NoRole, NoRole
Defining accessor 'lexicalContext' on: NoRole
Defining accessor 'lexicalContext:' on: NoRole, NoRole
Defining function 'surroundings' on: 'DebuggingFrame traits'
Defining function 'refreshWorkspace' on: 'Debugger traits'
Defining function 'on:' on: 'Debugger traits', NoRole
Defining function 'newFor:' on: 'Debugger traits', NoRole
Defining function 'invokeDebugger' on: 'Condition traits'
Defining function 'findRestarts' on: 'Debugger traits'
GC Freed 1949 words and coalesced 142 times
GC tenured 981 objects (10433 words)
Defining function 'describeRestarts' on: 'Debugger traits'
Defining function 'stackItem:' on: 'Debugger traits', NoRole
Defining function 'buildFrames' on: 'Debugger traits'
GC Freed 3438 words and coalesced 155 times
GC tenured 852 objects (8204 words)
Defining function 'prompt' on: 'Debugger traits'
Defining function 'signalRestartAt:' on: 'Debugger traits', NoRole
Defining function 'printBacktrace' on: 'Debugger traits'
Defining function 'frame:' on: 'Debugger traits', NoRole
GC Freed 5052 words and coalesced 295 times
GC tenured 806 objects (10459 words)
Defining function 'printFrame' on: 'Debugger traits'
Defining function 'printHelp' on: 'Debugger traits'
Defining function 'installMethods' on: 'Debugger traits'
Defining function 'enter' on: 'Debugger traits'
Nil
Slate 5> 1 + a.
Defining function 'frame' on: NoRole
Defining function 'frame:' on: NoRole, NoRole
Defining function 'backtrace' on: NoRole
Defining function 'bt' on: NoRole
Defining function 'restarts' on: NoRole
Defining function 'restart:' on: NoRole, NoRole
Defining function ':' on: NoRole, NoRole
Defining function 'help' on: NoRole
The following condition was signaled:
The method #a was not found for the following arguments:
{(...)}

The following restarts are available:
0) Abort evaluation of expression
1) Quit Slate

Enter 'help.' for instructions.
Debug [0..1]: bt.
<0> [defaultHandler]
<1> [tryHandlers]
<2> [signal]
<3> [notFoundOn: &optionals:]
<4> [evaluateIn: &optionals:]
<5> [(arity: 1)]
<6> [applyWith:]
<7> [(arity: 2)]
<8> [applyWith:with:]
<9> [(arity: 2)]
<10> [doWithIndex:]
<11> [collectWithIndex:into:]
<12> [collect:]
<13> [evaluateIn: &optionals:]
<14> [(arity: 0)]
<15> [on:do:]
<16> [(arity: 0)]
<17> [handlingCases:]
<18> [interpretHook:]
<19> [(arity: 0)]
<20> [enter]
<21> [start &resource:]
<22> [start]
<23> [(arity: 0)]
Debug [0..1]: help.
The debugger is a specialized evaluator that evaluates expressions
within the method currently being debugged. Certain messages are
provided for changing the state of the debugger, as follows:
: index. (or restart: index.) - signal the restart at the given index
backtrace (or "bt") - print the backtrace
frame - print the current frame
frame: N - set the current frame
restarts - print the currently available restarts
help - print this help listing
Debug [0..1]: frame: 6.
fp:22435
ip: 14/16
method: [applyWith:]
call count: 1714420
register count: 5
source: Nil
arg[0] = [(arity: 1)]
arg[1] = a
local[2] = True
local[3] = 1
register[4] = {a}
Decompiled:
(0) 12 #loadVariable 0
(2) 12 #loadVariable 1
(4) 8 #newArrayWith 4 1 1
(8) 0 #directSendMessage 3 #applyTo: 2 0 4
(14) 22 #returnRegister 3
Debug [0..1]: : 0.

Slate 6> 1 + 2
3
Slate 7>

Timmy Douglas

unread,
Jan 12, 2009, 11:08:19 PM1/12/09
to slate-language
I started (and commited) the beginnings of a slate gui debugger using
the cairo/xlib interface. Guille, hopefully this will help you get an
understanding of how you might approach it. See src/ui/debugger.slate.
You might want to put something like interpretHook: from repl.slate
around your evaluation code in order to get restarts at a high enough
level so that you stay in the gui instead of getting kicked back to
the base repl.

One weird thing that I didn't look into was that clicking the abort
button more than once worked... weird maybe I should close the window
because I would expect an error the second time that I activate a
restart.

Guille

unread,
Jan 13, 2009, 2:51:35 PM1/13/09
to slate-language
Ok, I commited a gtk debugger based on your example, it just prints
the stack. You can merge the repository with mine.
Reply all
Reply to author
Forward
0 new messages