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.

Proxy Information
Original URL
gemini://librehacker.com/gemlog/tech/20220414-0.gmi
Status Code
Success (20)
Meta
text/gemini
Capsule Response Time
798.269637 milliseconds
Gemini-to-HTML Time
0.178025 milliseconds

This content has been proxied by September (ba2dc).