fcc icon indicating copy to clipboard operation
fcc copied to clipboard

Implement SEE

Open nbkolchin opened this issue 3 years ago • 3 comments

> see .
Decompiling .
Segmentation fault (core dumped)

$ ./forth
  ok
> : t 1 . ;
  ok
> see t
Decompiling t
Segmentation fault (core dumped)

Reproduced for 088d089104c08ee1f4d52d2716512f98d2394fc6 commit on Linux 64, fcc build with GCC 11.1.

nbkolchin avatar Nov 02 '21 08:11 nbkolchin

I can reproduce. It "works" for native words, by saying you can't SEE them. But it coredumps on Forth words.

There's a telling comment in the original C code:

// TODO: This is broken in the new style, but I'm ignoring it.

I'm no longer sure what I meant by that. Still investigating.

bshepherdson avatar Nov 03 '21 03:11 bshepherdson

I think this is a change in the header format that wasn't properly reflected in see; it's crashing trying to print the name of something nameless, I think.

bshepherdson avatar Nov 03 '21 04:11 bshepherdson

I started on rewriting this in Forth rather than assembly.

The sticky part is teaching SEE how to unpack "superinstructions". There are some hundred of these, and they all need unpacking for SEE. Even in my trivial test example word : see-test 1 + ; this came up. That word is actually compiled to

docol
super_dolit_plus_exit
1

so while this is possible in principle, it's a lot of effort.

I'm inclined to just drop SEE support. Sorry :( Feel free to reopen if that's not acceptable.

bshepherdson avatar Nov 03 '21 18:11 bshepherdson