Crosscut

Daily Thought - 2024-08-27

Hey, I'm Hanno! These are my daily thoughts on Crosscut, the programming language I'm creating. If you have any questions, comments, or feedback, please get in touch!

This thought was published before Crosscut was called Crosscut! If it refers to "Caterpillar", that is the old name, just so you know.

< back to list

I've been talking about call stack reconstruction, starting with a simple case. Let's move on to a slightly more complicated one.

Let's say you have the stack frame of function a on the call stack, its active expression is a call to function b, but the next stack frame belongs to function c. This is not right. We have detected a gap! At the very least, a single stack frame (for b) is missing.

So before showing the active functions in the debugger, we add the missing b. And we know that only tail call elimination removes stack frames, so the active expression is the last one. From there we can repeat the check: is that last expression a call to c? If not, there still is a gap, and we can keep adding missing functions until it's closed.

<< previous thoughtnext thought >>

Hey, you! Want to subscribe to my daily thoughts? Just let me know (maybe include a nice message, if you're up for it), and I'll send you an email whenever I post a new one.