SCI/FreeSCI/Debugger/Concepts and basic functionality

From ScummVM :: Wiki
< SCI‎ | FreeSCI‎ | Debugger
Jump to navigation Jump to search

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.

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.