SCI Kernel Documentation/Debugging Functions

From SCI Wiki
Jump to navigationJump to search

Official SCI Documentation

Chapter: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | Index


Debugging Functions

Author: Jeff Stephenson

Revision by: David Slayback

 


Debugging Functions

There a number of functions designed for debugging Script programs by providing information about the state of the program.


(SetDebug)

Pop up the debugging window. At the top of the window, in red, is the name (if any) of the object self. Below it is the op-code about to be executed. In columns on the right side of the window are the top five values on the stack and the top five parameters. On the left are the contents of the accumulator (acc), the address of the next instruction (the instruction pointer, or ip), and the address of the top of the stack (the stack pointer, or sp).

A number of instructions may be issued while in the debugger (Note that the debugger is case-sensitive, ie. Q != q):

<shft><shft>-Z Put the debugging window away. This also can be used to pop the debugging window up while the program is running.
q Quit. Exit to DOS. Using <shft><shft>- to pop up the debugger and q to quit will generally get you out of the program even if your code is broken.
s Toggle the send stack on/off.
Enter Step to the next instruction, tracing into the procedure or method referenced by a call or send instruction.
Tab Step to the next instruction treating a call or a send as an indivisible instruction (don't trace into them).
tn Display the value of temporary variable number n.
ln Display the value of local variable number n.
gn Display the value of global variable number n.
i Open an inspector window, allowing you to inspect the values of the properties of objects. See InspectObj below.
o Look at all objects.
O Look at all objects with their hex addresses given. The actual address to inspect is <addr>+$0006.
a Look at object in the accumulator.
c Look at current object on top of send stack.


(InspectObj object)

Open an inspector window on object. This displays the property names and values for the object. Typing 'i' when this is displayed prompts for a property name, whose value will be displayed either as a number, string, or another object depending on what it is. If another object, 'i' can be typed again to inspect its properties, and so on until the interpreter runs out of stack.


(ShowSends)

Show the current send stack. This allows you to see how you got where you are. Entries in the display are of the form (object selector:) where object is the object to which a message whose selector was selector: was sent. The top line in the display is the most recent send, the line below that is the send to the method which made that send, and so on to the bottom line, which is the initial send from the main loop in the base script.


(ShowObjs withID)

Display all static and dynamic objects which are currently in the heap. If withID is TRUE, show the object IDs as well.


(ShowFree)

Displays the free memory blocks in the heap in the form number-of-bytes@address.


(MemoryInfo LargestPtr)

Returns the size (in bytes) of the largest block of memory available in the heap.


(MemoryInfo LargestHandle)

Return the size (in bytes) of the largest hunk available in hunk space. If the largest available hunk is greater than 64K, returns 64K.


(MemoryInfo FreeHeap)

Return the amount of memory (in bytes) which is free in the heap.


(MemoryInfo FreeHunk)

Return the amount of memory (in paragraphs, or 16 byte blocks) which is free in hunk space.


(StackUsage MStackSize)

Return the stack size of the PMachine stack.


(StackUsage MStackMax)

Return the maximum stack size reached so far of the PMachine stack.


(StackUsage MStackCur)

Return the current stack size of the PMachine stack.


(StackUsage PStackSize)

Return the stack size of the Processor stack.


(StackUsage PStackMax)

Return the maximum stack size reached so far of the Processor stack.


(StackUsage PStackCur)

Return the current stack size of the Processor stack.

 

Notes


 

Table of Contents

 

< Previous: File Functions Next: Index >