Finished debug system

This should work, but we'll need to test it before we can use it to test
real code.