RP2040 Mecrisp Stellaris: Viewing Data Stack Values in GDB

This information applies to Mecrisp Stellaris Forth running on a rp2040 platform such as Rpi Pico.

Top of Stack (TOS) is stored in register r6. So a simple "i r r6" or "print $r6" will get you the TOS value.

The rest of the data stack is stored in RAM, with a point to the top value stored in register r7. The data stack is 32 bit cells, so "x /8dw $r7" will show the next eight values of the stack. Use "x /8hw $r7" if you want them printed as hex values instead of decimal.

Just keep in mind that whenever you pause execution while the interpreter seems to be idle, the interpreter is actually running various procedures to check for serial communication, so it might have some of its own stack data on top of yours.

Proxied content from gemini://gem.librehacker.com/gemlog/tech/20220414-0.gmi

Gemini request details:

Original URL
Status code
Proxied by

Be advised that no attempt was made to verify the remote SSL certificate.