In addition to a memory-saving function for adding foreign functions and a new system function for returning members in a list, Copper now has stack tracing!

Peculiarly enough, stack tracing in Copper is only half of the battle. When all of your functions are nameless, the only way to identify them is by asking what variable they are called from. The good news is that you can’t run a function in Copper without it being assigned to a variable, which has a name. The bad news is that, even though you get a stack trace, you still don’t know what triggered the error. For that, there’s a task trace. This tells you what the virtual machine was working on when everything crashed, and it provides alittle more context. The bummer is that it doesn’t tell you the stack frame where those tasks are occurring. In fact, the virtual machine doesn’t even know. The design of the virtual machine makes it fast and efficient but also kind of clueless with regards to what’s happening internally. In fact, adding the feature of stack tracing required that the stack frames be associated with a variable address – something otherwise never needed. This doesn’t slow it down, thankfully (since it’s a simple pointer and some reference-counting), and the payoff is well worth it.

You may have noticed in the picture above that I managed to figure out how to add color to my output. It’s for stdout only (using printf), but it’s cool. I had lots of fun picking colors.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s