Writing this post in response to the WeekendDevPuzzle of 2022-01-15. This thread has a bunch of submissions, and it's insightful to go over how we often think about debuggers. I'll be linking this post to this twitter thread, which may also contain some follow up twitter follow ups later.
Let's start with a simple piece of code. This is the program we'll be debugging. As you can see, it's a fairly simple piece of code. We will be setting a breakpoint on the crashtest
function, crashing the debugger and seeing what happens.
Let's start with running this program (we've compiled using gcc -o testdebugcrash testdebugcrash.c
). We'll be running this on Linux for now (the importance of this will be understood later).
![start-program](https://user-images.githubusercontent.com/1546858/149652729-dbfa2104-a