Jump to content

Debug (command)

From Alfawiki
DEBUG.EXE
Company typeSoftware utility
IndustrySoftware debugging tools
Founded1980s
FounderTim Paterson
ProductsDebugger, assembler, disassembler, hexadecimal viewer
Websitedocs.microsoft.com/en-us/windows-server/administration/windows-commands/debug

The line-based debugger DEBUG.EXE serves as an external utility within operating systems such as DOS, OS/2, and 16-/32-bit Microsoft Windows editions. DEBUG operates as an assembler, disassembler, and hexadecimal viewer, allowing users to inspect memory contents in assembly language, hexadecimal, or ASCII formats. It also permits data modification and execution of COM, EXE, and various other file types. The tool offers specialized commands for interacting with disk sectors, I/O ports, and specific memory locations.

Overview

Originally developed by Tim Paterson to support debugging and maintenance tasks in 86-DOS, DEBUG was incorporated into Microsoft’s offerings when Paterson joined the company in the early 1980s. Since its inclusion in MS-DOS/PC DOS starting with version , DEBUG has been bundled with these systems and certain Windows releases. Initially named DEBUG.COM, the utility was renamed DEBUG.EXE beginning with MS-DOS 3.2.

In Windows XP and subsequent versions, DEBUG remains available through the MS-DOS subsystem to preserve backward compatibility; however, 16-bit DOS commands are not supported on 64-bit Windows platforms.

Key restrictions of the MS-DOS/PC DOS DEBUG include:

  • Assembly and disassembly capabilities are limited to Intel 8086 instruction sets.
  • Only 16-bit registers are accessible; 32-bit register extensions are unsupported.
  • File names must adhere to the FAT 8.3 naming convention due to storage constraints.

Advanced DEBUG iterations appear in Novell DOS 7, OpenDOS 7.01, and DR-DOS 7.02 and later versions. These implementations reintroduce Digital Research's Symbolic Instruction Debugger (SID/SID86) functionality while maintaining compatibility with MS-DOS. Enhancements include support for instructions up to Pentium-class processors (both 16- and 32-bit), an extended command mode (/X) featuring numerous additional commands, sophisticated command-line syntax with macro capabilities, symbolic debugging using named registers and symbol tables, arithmetic operations, number base conversions, and a disassembler that supports inline comments. Some variants utilize DOS Protected Mode Services (DPMS) to enable stealth-mode protected debugging.

The FreeDOS version of DEBUG was created by Paul Vojta and is distributed under the MIT License.

A 32-bit compatible clone known as "DEBUGX" extends support to DPMI programs. Andreas "Japheth" Grech developed enhanced versions ranging from 0.98 to 1.25, while Vernon C. Brooks, a former PC DOS developer, contributed updates from versions 1.26 through 1.32.

Syntax

DEBUG [[drive:][path] filename [parameters]]

Launching DEBUG without any parameters presents a prompt indicated by a "-". Users can input single- or double-letter subcommands such as "A" to enter assembler mode, "D" for a hexadecimal dump, "T" to perform program tracing, or "U" to unassemble (disassemble) code residing in memory. Additionally, DEBUG can act as a "DEBUG script" interpreter using this format:

DEBUG < filename

Script files may contain a combination of DEBUG subcommands and assembly instructions, facilitating the creation or modification of binary files through batch file automation.

Use Beyond Debugging

DEBUG proves useful for binary file editing within minimal DOS environments and for direct manipulation of disk sectors—a method commonly employed to eliminate boot-sector viruses.

Availability

While official technical documentation for DEBUG was discontinued after MS-DOS version 3.3, the command itself continued to be included in standard distributions, unlike utilities such as EXE2BIN.

Other operating systems

Several operating systems, including Intel's ISIS-II and iRMX 86, as well as DEC's TOPS-10 and TOPS-20, feature a DEBUG command. Additionally, THEOS/OASIS, Zilog's Z80-RIO, Stratus's OpenVOS, along with PC-MOS and the AROS, incorporate this command within their environments.

See also

External links