Jump to content

debug (command)

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by 121.241.168.85 (talk) at 02:47, 31 May 2011 (→‎See also). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Debug
Original author(s)Tim Paterson
Developer(s)Microsoft
Operating systemDOS, MS-DOS, OS/2, Microsoft Windows
TypeDebugger
WebsiteDebug

debug is a command in DOS, MS-DOS, OS/2 and Microsoft Windows (only x86 versions, not x64[1]) which runs the program debug.exe (or DEBUG.COM in older versions of DOS).[2] 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.[3] MS-DOS Debug runs at a 16-bit process level and therefore it is limited to 16-bit computer programs.[2] FreeDOS Debug has a "DEBUGX" version supporting 32-bit DPMI programs as well.[4]

Background

Traditionally, all computers and operating systems have included a maintenance function, used to determine whether a program is working correctly.[citation needed] 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. MS-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 meaning that the program can only save files in FAT 8.3 filename format.
  • MS-DOS Debug can only access conventional memory,[2] which is the first 640K in an IBM PC.

32-bit Debug clones, such as FreeDOS Debug, have been written.[4]

Syntax

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.[5] Debug can also be used as a "debug script" interpreter using the following syntax.

debug < FileName 

A script file may contain Debug subcommands and assembly language instructions.[6] This method can be used to create or edit binary files from batch files.[2]

Bold text==See also==

References

  1. ^ According to Microsoft Macro Assembler Reference, inline assembly is not supported for x64.
  2. ^ a b c d e Daniel B. Sedory. "A Guide to DEBUG". Retrieved 2007-05-25. {{cite web}}: Cite has empty unknown parameter: |1= (help)
  3. ^ Cite error: The named reference Using Debug was invoked but never defined (see the help page).
  4. ^ a b Paul Vojta. "FreeDOS DEBUG README". Retrieved 2007-06-25.
  5. ^ "Microsoft TechNet Debug article". Retrieved 2008-04-23.
  6. ^ "Using Debug" (PDF). Retrieved 2007-06-23.