This article may be too technical for most readers to understand. Please help improve it to make it understandable to non-experts, without removing the technical details. (November 2014) (Learn how and when to remove this template message)
|Original author(s)||Tim Paterson|
|Operating system||DOS, MS-DOS, OS/2, Microsoft Windows|
|License||Proprietary commercial software|
Debug can act as an assembler, disassembler, or hex dump program allowing users to interactively examine memory contents (in assembly language, hexadecimal or ASCII), make changes, and selectively execute COM, EXE and other file types. It also has several subcommands which are used to access specific disk sectors, I/O ports and memory addresses.
Traditionally, all computers and operating systems have included a maintenance function, used to determine whether a program is working correctly. Debug was written by Tim Paterson to serve this purpose in QDOS. When Paterson began working for Microsoft in the early 1980s he brought the program with him. Debug was part of DOS 1.00 and has been included in MS-DOS and Microsoft Windows. DOS debug has several limitations:
- It can only access 16-bit registers and not 32-bit extended registers.
- When the "n" subcommand for naming files is used, the filename is stored from offset DS:5D to DS:67 (the Program Segment Prefix File Control Block area), meaning that the program can only save files in FAT 8.3 filename format.
Enhanced DEBUG package includes a 32-bit clone "DEBUGX" version supporting 32-bit DPMI programs as well. Andreas "Japheth" Grech, the author of the HX DOS extender, developed enhanced DEBUG versions 0.98…1.25, and former PC DOS developer Vernon Brooks added versions 1.26…1.32.
debug [[drive:][path] filename [parameters]]
When Debug is started without any parameters the Debug prompt, a "-" appears. The user can then enter one of several one or two-letter subcommands, including "a" to enter the assembler mode, "d" to perform a hexadecimal dump, "t" to trace and "u" to unassemble (disassemble) a program in memory. Debug can also be used as a "debug script" interpreter using the following syntax.
debug < filename
Using for non-debugging purposes
The Debug utility was useful for editing binary files in an environment where only MS-DOS is installed without anything else. It can also be used to edit disk sectors, which was one method of removing boot-sector viruses in the MS-DOS era.
- According to Microsoft Macro Assembler Reference, inline assembly is not supported for x64.
- Daniel B. Sedory. "A Guide to DEBUG". Retrieved 2014-11-29.
- "TOPS-20 Command manual" (PDF).
- Paul Vojta. "DEBUG README". Archived from the original on 2007-08-24. Retrieved 2007-06-25.
- Vernon Brooks (2014-04-08). "Enhanced DEBUG for PC DOS and MS-DOS". PC DOS Retro. Retrieved 2014-05-08.
- "Microsoft TechNet Debug article". Retrieved 2008-04-23.
- Kip R. Irvine (2010). "Using Debug". Assembly language for Intel-based computers (PDF) (6th ed.). Prentice Hall. ISBN 978-0136022121. Retrieved 2014-03-18.