Main
Links
Games
Main
Download
Documentation
Development
Bug list

The built-in debugger

Concepts and basic functionality

The built-in debugger takes advantage of a built-in command interpreter (which is not to be confused with the SCI command interpreter). It's appearance is going to vary in between versions (at the time of this writing, it runs on the terminal FreeSCI was started on, in text mode; later versions will likely integrate the debugger to the graphics screen), but all versions of FreeSCI will come with a working debugger[1]. Consult the documentation of your specific release for details on how to invoke it, if it is not activated automatically.

If activated, the debugger is called in between operation fetching and operation execution. It will show the command that is to be executed next, predicting the action done by send, super, and self calls where possible, and displaying any parameters to calling operations. It will also display the current register values and the number of operations that have been executed. It then waits for user input.

In order to simply execute the next operation, execute the "s" command. This will do one step of execution. If you want to execute more than one command, invoke "s [number-of-steps]". Other ways to step forward are "snk" (Step until the Next Kernel function is invoked) and "function/sret/" (Step until the interpreter RETurns from this function).

Speaking of functions, the FreeSCI interpreter also keeps a list of the call stack. This is similar to what the Sierra SCI interpreter provides as the "send stack", but it also includes call, calle and callb commands. Please note that callk commands are not included (some kernel functions actually call functions in user space). To display this list, invoke "bt". This function will list all calls on the stack, the parameters they carried, from where they were invoked, and the called object[2] and selector (where applicable).

Selectors are not only used for functions, of course, they are also used as variables. To inspect the selectors of the current object, use the "obj" operation. Sometimes you might want to inspect how a send operation influenced an object; do so by calling "accobj", which will show the selectors of the object indexed by the accumulator register (as used in sends).

For a complete listing of debugging commands, refer to the next chapter.

Debugger commands

The FreeSCI built-in debugger provides the following commands:

debuglog [mode]

FreeSCI keeps an internal list of flags for specific areas of the game that should be watched more closely. The 'debuglog' command activates or deactivates debug output for each of those areas. Each area is described by a letter; to activate debugging for that area, use "debuglog +x", where x is the area you want to debug. "debuglog -x" deactivates debugging for that area. To activate or deactivate multiple areas, concatenate their single-letter descriptions. Run "debuglog" without parameters to get a listing of all active modes. The modes and describing letters are listed below.

a: The audio subsystem
b: The Bresenham line algorithm functions
c: Character and string handling
d: System graphics display and management
f: Function calls
F: File IO
g: Graphics
l: List and node handling
m: Memory management
M: Menu system
p: The command parser
s: Base setter: Draws the bases of each actor as colored rectangles
S: Said specs
t: Time functions
u: Unimplemented functionality
*: Everything at once. Use with care.

list (string+)

If called without parameters, it lists all things it can list. Among these are:

vars: Global interpreter variables
cmds: All available commands
restypes: All resource types
selectors: All selectors
syscalls: All kernel functions
[resource]: All resources of that type (ex: "list view")

Console interaction with dmalloc

The FreeSCI console proivdes an interface to the dmalloc memory debugger/profiler, if the interpreter was compiled with dmalloc support enabled. The following commands are provided:

Notes

[1]

That's what I hope, anyway.

[2]

This is note quite correct: The object listed is, in fact, the object which is used as the base object for execution. This only makes a difference if the super operation is executed, but it may be confusing. Consider it a bug.

[3]

Well, this is debatable.

[4]

Not really meaningful; only used while pic resources are drawn.