[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1 Debugging


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.1 Inspecting

ANS Forth defines some "Programming Tools", words to inspect the stack, memory, compiled code and what words are defined.

.S ( -- )

displays the stacks. There are two stacks: integer and floating point.

? ( addr -- )

Displays the integer at address addr, equivalent to ‘ .’, thus sensitive to ‘BASE’.

DUMP ( addr u -- )

Displays u bytes of memory starting at address addr. You can easily cause a segmentation fault or something like that by accessing memory that doesn’t belong to the pfe-process.

SEE ( ``spaces name'' -- )

decompiles the following word trying to display a reasonable indented source text. If you define your own control structures or use extended control-flow patterns, the indentation may be suboptimal.

WORDS ( -- )

[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.2 Single stepping

pfe includes a simple debugging and profiling facility: You can single step though a definition after saying ‘DEBUG definition’. Next time the ‘definition’ gets executed the single stepper takes control.

When this happens you see the top stack items displayed in one line. The topmost stack item is the first in line, the second and following stack items are displayed throughout the end of the line. This line is empty if the stack is empty when the word in question executes.

On the next line you see the first word to become executed inside ‘definition’.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.2.1 Single Stepper Keys

You see a prompt ‘>’ right of the first displayed word. At this prompt you have several options. Choose one by typing one key:


[Top] [Contents] [Index] [ ? ]

About This Document

This document was generated on November 5, 2024 using texi2html 5.0.

The buttons in the navigation panels have the following meaning:

Button Name Go to From 1.2.3 go to
[ << ] FastBack Beginning of this chapter or previous chapter 1
[ < ] Back Previous section in reading order 1.2.2
[ Up ] Up Up section 1.2
[ > ] Forward Next section in reading order 1.2.4
[ >> ] FastForward Next chapter 2
[Top] Top Cover (top) of document  
[Contents] Contents Table of contents  
[Index] Index Index  
[ ? ] About About (help)  

where the Example assumes that the current position is at Subsubsection One-Two-Three of a document of the following structure:


This document was generated on November 5, 2024 using texi2html 5.0.