ForthOS Debugger

Introduction

FortOS offers a symbolic debugger, optionally with source code referencing. It is implemented by inserting debug traps in the generated code, and optionally tabulating source code locations against object code addresses.

Activating

All the debugger words are in the "extensions" vocabulary.

To enable debug traps, invoke the "[+debug]" word; as expected by the presence of the braces, this is an immediate word and debug code generation can be enabled or disabled at points within a definition. "[-debug]" disables debug code generation.

Source-to-object tabulation is kept if the "+g" word is invoked. "-g" turns it back off. Several words of storage are used for each word parsed in the input stream, so global use across large amounts of source could result in surprisingly large memory consumption.

Breakpoints

To cause the debugger to be entered when WORD is reached, simply enter "debug WORD". If you later want to delete this breakpoint, "undebug WORD" can be used. If you want to clear all breakpoints, "Undebug" (initial capital) does the trick.

If any breakpoints are active, the debugger will also be entered when an abort occurs. An easy trick to catch only aborts is to enter "debug @". Fetch, being a code word, does not have any debug trapping and thus doesn't care that its address is recorded in the debugger table. However, when an abort happens, the debugger thinks it has breakpoints active, and thus will drop you into debugger mode.

Debugger Commands

Once you're in the debugger, the following commands are available. Generally, just striking the key will result in the given action, unless specifically noted.