Difference between revisions of "SCI Kernel Documentation/Debugging Functions"
(3 intermediate revisions by the same user not shown) | |||
Line 43: | Line 43: | ||
<blockquote> | <blockquote> | ||
− | {| valign="top" | + | {| |
+ | |- valign="top" | ||
|width= "100"|<shft><shft>-Z||Put the debugging window away. This also can be used to pop the debugging window up while the program is running. | |width= "100"|<shft><shft>-Z||Put the debugging window away. This also can be used to pop the debugging window up while the program is running. | ||
− | |- | + | |- valign="top" |
|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. | |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. | ||
− | |- | + | |- valign="top" |
|s||Toggle the send stack on/off. | |s||Toggle the send stack on/off. | ||
− | |- | + | |- valign="top" |
|Enter||Step to the next instruction, tracing into the procedure or method referenced by a call or send instruction. | |Enter||Step to the next instruction, tracing into the procedure or method referenced by a call or send instruction. | ||
− | |- | + | |- valign="top" |
|Tab||Step to the next instruction treating a call or a send as an indivisible instruction (don't trace into them). | |Tab||Step to the next instruction treating a call or a send as an indivisible instruction (don't trace into them). | ||
− | |- | + | |- valign="top" |
|tn||Display the value of temporary variable number n. | |tn||Display the value of temporary variable number n. | ||
− | |- | + | |- valign="top" |
|ln||Display the value of local variable number n. | |ln||Display the value of local variable number n. | ||
− | |- | + | |- valign="top" |
|gn||Display the value of global variable number n. | |gn||Display the value of global variable number n. | ||
− | |- | + | |- valign="top" |
− | |i||Open an inspector window, allowing you to inspect the values of the properties of objects. See InspectObj below. | + | |i||Open an inspector window, allowing you to inspect the values of the properties of objects. See [[#.28InspectObj_object.29|InspectObj]] below. |
− | |- | + | |- valign="top" |
|o||Look at all objects. | |o||Look at all objects. | ||
− | |- | + | |- valign="top" |
|O||Look at all objects with their hex addresses given. The actual address to inspect is <addr>+$0006. | |O||Look at all objects with their hex addresses given. The actual address to inspect is <addr>+$0006. | ||
− | |- | + | |- valign="top" |
|a||Look at object in the accumulator. | |a||Look at object in the accumulator. | ||
− | |- | + | |- valign="top" |
|c||Look at current object on top of send stack. | |c||Look at current object on top of send stack. | ||
|} | |} | ||
Line 73: | Line 74: | ||
</blockquote> | </blockquote> | ||
− | ===<br /> | + | ===<br /> (InspectObj object) === |
<blockquote> | <blockquote> | ||
+ | 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. | ||
+ | </blockquote> | ||
+ | |||
+ | ===<br /> (ShowSends) === | ||
+ | |||
+ | <blockquote> | ||
+ | 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. | ||
+ | </blockquote> | ||
+ | |||
+ | ===<br /> (ShowObjs withID) === | ||
+ | |||
+ | <blockquote> | ||
+ | Display all static and dynamic objects which are currently in the heap. If withID is TRUE, show the object IDs as well. | ||
+ | </blockquote> | ||
+ | |||
+ | ===<br /> (ShowFree) === | ||
+ | <blockquote> | ||
+ | Displays the free memory blocks in the heap in the form number-of-bytes@address. | ||
</blockquote> | </blockquote> | ||
− | ===<br /> | + | ===<br /> (MemoryInfo LargestPtr) === |
<blockquote> | <blockquote> | ||
+ | Returns the size (in bytes) of the largest block of memory available in the heap. | ||
+ | </blockquote> | ||
+ | ===<br /> (MemoryInfo LargestHandle) === | ||
+ | |||
+ | <blockquote> | ||
+ | Return the size (in bytes) of the largest hunk available in hunk space. If the largest available hunk is greater than 64K, returns 64K. | ||
</blockquote> | </blockquote> | ||
− | ===<br /> | + | ===<br /> (MemoryInfo FreeHeap) === |
<blockquote> | <blockquote> | ||
+ | Return the amount of memory (in bytes) which is free in the heap. | ||
+ | </blockquote> | ||
+ | |||
+ | ===<br /> (MemoryInfo FreeHunk) === | ||
+ | <blockquote> | ||
+ | Return the amount of memory (in paragraphs, or 16 byte blocks) which is free in hunk space. | ||
</blockquote> | </blockquote> | ||
+ | ===<br /> (StackUsage MStackSize) === | ||
+ | <blockquote> | ||
+ | Return the stack size of the PMachine stack. | ||
+ | </blockquote> | ||
+ | |||
+ | ===<br /> (StackUsage MStackMax) === | ||
+ | |||
+ | <blockquote> | ||
+ | Return the maximum stack size reached so far of the PMachine stack. | ||
+ | </blockquote> | ||
+ | |||
+ | ===<br /> (StackUsage MStackCur) === | ||
+ | |||
+ | <blockquote> | ||
+ | Return the current stack size of the PMachine stack. | ||
+ | </blockquote> | ||
+ | |||
+ | ===<br /> (StackUsage PStackSize) === | ||
+ | |||
+ | <blockquote> | ||
+ | Return the stack size of the Processor stack. | ||
+ | </blockquote> | ||
+ | |||
+ | ===<br /> (StackUsage PStackMax) === | ||
+ | |||
+ | <blockquote> | ||
+ | Return the maximum stack size reached so far of the Processor stack. | ||
+ | </blockquote> | ||
+ | |||
+ | ===<br /> (StackUsage PStackCur) === | ||
+ | |||
+ | <blockquote> | ||
+ | Return the current stack size of the Processor stack. | ||
+ | </blockquote> | ||
| |
Latest revision as of 18:28, 3 December 2015
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
< Previous: File Functions Next: Index >