0 votes
by Bart Nelson (500 points)
If you do something stupid like

: TT THEN ;

(in real life it's always part of a much more complex function)

then in VFX out of the box, you get:

 CS=0033 FS=0000 GS=0000
 RAX=0000:0000:0047:5A10 RBX=0000:0000:0000:0000
 RCX=0000:0000:0000:0000 RDX=0000:0000:0047:46B8
 RSI=0000:7FFF:77F0:5D90 RDI=0000:0000:1FD0:E000
 RBP=0000:7FFF:77F0:4D58 RSP=0000:7FFF:77EF:4D08
 R8 =0000:7FFF:77F0:5D90 R9 =0000:0000:1FD0:E000
 R10=0000:0000:0000:0000 R11=0000:0000:0000:0246
 R12=0000:7FFF:77EF:4C78 R13=0000:7FFF:77F0:5D50
 R8 =0000:7FFF:77F0:4D58 R9 =0000:7FFF:77EF:4D08
 RIP=0000:0000:0048:20A5 EFLAGS=0001:0246
--- RS top ---
 $0000:0000:0048:2C3F >C_RES_BRANCH
 $0000:0000:0042:FBDB DEFER
 $0000:0000:0042:1C41 THEN
 $0000:0000:0042:B1A3 (NDCS,)
 $0000:0000:0047:8464 NDCS-REF
 $0000:0000:0042:FBDB DEFER
 $0000:0000:0042:F622 (INTERPRET)
 $0000:0000:0042:FBDB DEFER
Signal number SIGSEGV
at address 0000:0000:0048:20A5, probably in >ARES

and you have to go right to the bottom to get a clue.

If you use Nick's critical error handler, you get instead:

Illegal memory access, probably in >ARES, called from:
>C_RES_BRANCH DEFER THEN (NDCS,) NDCS-REF DEFER (INTERPRET) DEFER

which at least gets you to the clue in the first line, and even more of a clue in the second line.

But inexperienced Forthers are initially unaware of how to interpret the trace.

It would be really good if VFX told you straight

"Suspected mismatched THEN in definition TT"

1 Answer

0 votes
by Stephen Pelc (4.4k points)
The obvious thing to do is to add two check boxes:
1) check to display registers
2) check for a horizontal return stack display
Additional analysis of the last word called, e.g. >ARES is likely
to be unproductive. e.g. try

  : TT  ELSE  ;
...