Debuggers
###Related Tags:Single-stepping in a debugger and looking at registers is essential. Trying to write a program without one is like trying to build a robot blindfolded. It's very much worth the time to learn to use one. For 32/64-bit mode under a modern OS, see the debugging section at the bottom of the x86 tag wiki.
Under DOS:
- @ecm's IDebug, based on debug.exe from FreeDOS.
- Turbo Debugger is widely recommended, and maybe can be found for free
debug.exe in MS-DOS or FreeDOS is an option, although classic MS-DOS debug.exe is pretty terrible to actually program in, not having labels, only numeric addresses for jump targets and so on!
Full system (for bootloaders, or maybe DOS programs)
- Bochs is usually the gold standard, with a built-in debugger that's aware of segmentation. Manual. Note that it's an optional config feature; some builds might not come with it enabled. It's great for debugging the switch to 32-bit protected mode, and 64-bit mode. It can parse and dump your GDT and page tables, to help you spot mistakes in what you put there, and it knows what mode the CPU is in so it will disassemble in the right mode to match execution, helping you catch mistakes where code was assembled for the wrong bitness.
- QEMU: can act as a remote for GDB. GDB doesn't know about segmentation so this isn't ideal for real mode or during the switch to protected mode.
- DOSBox: There's a DOSBox-X fork with a built-in debugger, and the mainline DOSBox apparently also has a debugger built-in. (Curses-based text UI)
Related Tags: