ABSTRACT

Debuggers are as much a part of good programmers' lives as version control but are taught far less often. This chapter shows how to build an interactive single-stepping debugger for the simple virtual machine developed in the prevous chapter; in doing so, it also shows how to test interactive applications. One of the keys is to record where each instruction came from, so that we can show users the correct source code. Another is to modify the virtual machine to check a callback function to see when it's supposed to stop, which is another example of designing for testability.