gdbstub: Add preliminary pieces needed for GDB stub-mode

Thoroughly inspired by pull request #5, but not taking it as-is. Will
need to implement the various GDB commands later (incl. single-step).
check: Don't hook GDB into check