Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

Debug (command)

From Wikipedia, the free encyclopedia
Line-oriented debug utility in DOS

DEBUG.COM (MS-DOS <= 2.0), DEBUG.EXE (MS-DOS >= 3.x)
Original authorTim Paterson
DevelopersMicrosoft,IBM,Digital Research,Novell,Caldera
Written inMS-DOS:x86 assembly language
Operating systemDOS,OS/2,Windows
TypeDebugger
LicenseMS-DOS v2.0, FreeDOS:MIT
OS/2, Windows:Proprietary software
WebsiteDebug

The line-orienteddebuggerDEBUG.EXE is an external command inoperating systems such asDOS,OS/2 andWindows (only in 16-bit/32-bit versions[1]).

DEBUG can act as anassembler,disassembler, orhex dump program allowing users to interactively examinememory contents (inassembly language,hexadecimal orASCII), make changes, and selectively executeCOM,EXE and other file types. It also has several subcommands which are used to access specificdisk sectors,I/O ports andmemory addresses.

Overview

[edit]
DEBUG.COM (among other commands) inIBM PC DOS 1.0.
TheMicrosoft Windows 95DEBUG.EXE command

Traditionally, allcomputers andoperating systems have included a maintenance function, used to determine whether a program is working correctly.[citation needed] DEBUG was originally written byTim Paterson to serve this purpose in86-DOS. When Paterson began working for Microsoft in the early 1980s he brought the program with him. DEBUG was part ofDOS 1.00 and has been included inMS-DOS/PC DOS and certain versions ofMicrosoft Windows. Originally namedDEBUG.COM, the executable was renamed intoDEBUG.EXE with MS-DOS 3.2.[2]

Windows XP and later versions includedDEBUG for theMS-DOS subsystem to maintain MS-DOS compatibility. The 16-bit DOS commands are not available on64-bit editions of Windows.[3]

The MS-DOS/PC DOS DEBUG has several limitations:

Enhanced DEBUG packages include the DEBUG command inNovell DOS 7,OpenDOS 7.01 andDR-DOS 7.02 and higher, a reimplementation ofDigital Research's formerSymbolic Instruction Debugger SID/SID86,[4] which came with former versions ofDR DOS.[5][6][7] It is fully compatible with the DEBUG command line syntax of MS-DOS/PC DOS, but offers many enhancements, including supporting 16-bit and 32-bit opcodes up to thePentium, an extended mode (/X) with dozens of additional commands and sub-modes, a much enhanced command line syntax with user-definable macros andsymbolic debugging facilities with named registers, loadedsymbol tables, mathematical operations andbase conversions, as well as acommenting disassembler.[8][7] Some versions also utilizedDPMS to function as a "stealth mode" protected-mode debugger.[9]

TheFreeDOS version of DEBUG was developed by Paul Vojta and is licensed under theMIT License.[10]

A 32-bit clone "DEBUGX" version supporting32-bitDPMI programs exists as well.[11] Andreas "Japheth" Grech, the author of theHX DOS extender, developed enhanced DEBUG versions 0.98 to 1.25, and formerPC DOS developer Vernon C. Brooks added versions 1.26 to 1.32.[12]

Syntax

[edit]
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 ahexadecimal dump, "T" to trace and "U" to unassemble (disassemble) a program in memory.[13]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.[14] This method can be used to create or editbinary files frombatch files.[2]

Debugging Subcommands

[edit]

The following is a list of the DEBUG commands available from DEBUG.EXE in MS-DOS 6.22 via the? command.

assemble     A [address]compare      C range addressdump         D [range]enter        E address [list]fill         F range listgo           G [=address] [addresses]hex          H value1 value2input        I portload         L [address] [drive] [firstsector] [number]move         M range addressname         N [pathname] [arglist]output       O port byteproceed      P [=address] [number]quit         Qregister     R [register]search       S range listtrace        T [=address] [value]unassemble   U [range]write        W [address] [drive] [firstsector] [number]allocate expanded memory        XA [#pages]deallocate expanded memory      XD [handle]map expanded memory pages       XM [Lpage] [Ppage] [handle]display expanded memory status  XS

The R command displays the current register status and values

AX=0000 BX=0000 CX=0000 DX=0000 SP=FFEE BP=0000 SI=0000 DI=0000  DS=2A63 ES=2A63 SS=2A63 CS=2A63 IP=0100 NV UP EI PL NZ NA PO NC2A63:0100 0F DB 0F

While D dumps the current memory displaying both hexadecimal and ASCII values

2A63:0100 0F 00 B9 8A FF F3 AE 47-61 03 1F 8B C3 48 12 B1 .......Ga....H..2A63:0110 04 8B C6 F7 0A 0A D0 D3-48 DA 2B D0 34 00 52 2A ........H.+.4.R\*2A63:0120 00 DB D2 D3 E0 03 F0 8E-DA 8B C7 16 C2 B6 01 16 ................2A63:0130 C0 16 F8 8E C2 AC 8A D0-00 00 4E AD 8B C8 46 8A ..........N...F.2A63:0140 C2 24 FE 3C B0 75 05 AC-F3 AA A0 0A EB 06 3C B2 .$.<.u........<.2A63:0150 75 6D 6D 13 A8 01 50 14-74 B1 BE 32 01 8D 8B 1E umm...P.t..2....2A63:0160 8E FC 12 A8 33 D2 29 E3-13 8B C2 03 C3 69 02 00 ....3.)......i..2A63:0170 0B F8 83 FF FF 74 11 26-01 1D E2 F3 81 00 94 FA .....t.&........

AndUnassemble displays the attempted disassembly of the same memory

2A63:0100 0F DB 0F  2A63:0101 00B98AFF ADD [BX+DI+FF8A],BH  2A63:0105 F3 REPZ   2A63:0106 AE SCASB   2A63:0107 47 INC DI  2A63:0108 61 DB 61  2A63:0109 031F ADD BX,[BX]  2A63:010B 8BC3 MOV AX,BX  2A63:010D 48 DEC AX  2A63:010E 12B1048B ADC DH,[BX+DI+8B04]  2A63:0112 C6F70A MOV BH,0A  2A63:0115 0AD0 OR DL,AL  2A63:0117 D348DA ROR WORD PTR [BX+SI-26],CL  2A63:011A 2BD0 SUB DX,AX  2A63:011C 3400 XOR AL,00  2A63:011E 52 PUSH DX  2A63:011F 2A00 SUB AL,[BX+SI]

Using for non-debugging purposes

[edit]

The DEBUG utility is useful for editing binary files in an environment where only DOS is installed without anything else. It can also be used to edit disk sectors, which is one method of removing boot-sector viruses.

Availability

[edit]

Although technical documentation for the DEBUG command was removed with the release of MS-DOS 3.3, the command was retained in the standard distribution, unlike what was done withEXE2BIN.[15]

Other operating systems

[edit]

Theoperating systemsIntelISIS-II[16] andiRMX 86,[17]DECTOPS-10[18] andTOPS-20,[19]THEOS/OASIS,[20]ZilogZ80-RIO,[21]StratusOpenVOS,[22]PC-MOS,[23] andAROS[24] also provide aDEBUG command.

See also

[edit]

References

[edit]
  1. ^According toMicrosoft Macro Assembler Reference, inline assembly is not supported for x64.
  2. ^abSedory, Daniel B."A Guide to DEBUG". Retrieved2014-11-29.
  3. ^MS-DOS subsystem commands
  4. ^SID-86 User's Guide for CP/M-86 (2 ed.).Digital Research. August 1982 [March 1982]. SID86UG.WS4.Archived from the original on 2019-10-20. Retrieved2020-02-06.[1] (NB. A retyped version of the manual by Emmanuel Roche with Q, SR, and Z commands added. This manual is for theCP/M-86 version, but theDR DOS version is similar.)
  5. ^Born, Günter[in German] (1993).DOS 6 Tuning (in German) (1 ed.).Markt & Technik.ISBN 3-87791-495-0. (NB. Has several pages on MS-DOS DEBUG.EXE as well as on theSymbolic Instruction Debugger SID.EXE inDR DOS 5.0/6.0.)
  6. ^Paul, Matthias R. (1997-05-24) [1991].DRDOSTIP.TXT — Tips und Tricks für DR DOS 3.41 - 5.0 (in German) (47 ed.).Archived from the original on 2016-11-07. Retrieved2016-11-07.{{cite book}}:|work= ignored (help) (NB. Has some information on Symbolic Instruction Debugger (SID86.EXE inDR DOS 3.41 and SID.EXE in DR DOS 5.0/6.0), the predecessor of the DR-DOS DEBUG.EXE.)
  7. ^abPaul, Matthias R. (2002-01-09)."SID86".Newsgroupcomp.os.cpm. Retrieved2018-04-08.[…] Since theDR-DOS 7.03 DEBUG is still based on the old SID86.EXE, I suggest to run DEBUG 1.51 and enter the extended help system with ?? from the debug prompt. This will give you eight screens full of syntax and feature help. Some of these features were also supported by older issues. […]
  8. ^Paul, Matthias R. (1997-07-30). "Kapitel II.5. Allgemeines: Undokumentierte Möglichkeiten von DEBUG" [Undocumented features of DEBUG].NWDOS-TIPs — Tips & Tricks rund um Novell DOS 7, mit Blick auf undokumentierte Details, Bugs und Workarounds. Release 157 (in German) (3 ed.).Archived from the original on 2017-09-10. Retrieved2014-09-06.{{cite book}}:|work= ignored (help) (NB. NWDOSTIP.TXT is a comprehensive work onNovell DOS 7 andOpenDOS 7.01, including the description of many undocumented features and internals. It is part of the author's yet larger MPDOSTIP.ZIP collection maintained up to 2001 and distributed on many sites at the time. The provided link points to a HTML-converted older version of the NWDOSTIP.TXT file.)
  9. ^Paul, Matthias R. (2001-04-09).NWDOS-TIPs — Tips & Tricks rund um Novell DOS 7, mit Blick auf undokumentierte Details, Bugs und Workarounds. Release 183 (in German) (3 ed.).{{cite book}}:|work= ignored (help)
  10. ^"FreeDOS 1.2 Updates Package - debug (FreeDOS Base)". Ibiblio.org. 2021-02-16. Retrieved2022-09-08.
  11. ^Vojta, Paul."DEBUG README". Archived fromthe original on 2007-08-24. Retrieved2007-06-25.
  12. ^Brooks, Vernon C. (2014-04-08)."Enhanced DEBUG for PC DOS and MS-DOS".PC DOS Retro.Archived from the original on 2020-02-21. Retrieved2014-05-08.
  13. ^"Microsoft TechNet Debug article". Retrieved2008-04-23.
  14. ^Irvine, Kip R. (2010). "Using Debug".Assembly language for Intel-based computers(PDF) (6th ed.).Prentice Hall.ISBN 978-0-13602212-1. Retrieved2014-03-18.
  15. ^Dror, Asael (1988-01-12). "Thank You, IBM".PC Magazine. p. 366.
  16. ^ISIS II Users Guide
  17. ^iRMX 86 Introduction And Operator's Reference Manual For Release 6
  18. ^TOPS-10 Operating System Commands Manual(PDF). Digital Equipment Corporation. August 1980. Archived fromthe original(PDF) on 2020-08-09. Retrieved2019-02-17.
  19. ^"TOPS-20 Command manual"(PDF). Archived fromthe original(PDF) on 2020-08-09. Retrieved2018-07-18.
  20. ^THEOS/OASIS User′s Handbook
  21. ^"Z80-RIO Operating System User's Manual"(PDF). Archived fromthe original(PDF) on 2022-01-28. Retrieved2019-05-04.
  22. ^"OpenVOS Commands Reference Manual"(PDF).
  23. ^PC-MOS User Guide
  24. ^"AROS Research Operating System". Archived fromthe original on 2019-07-02. Retrieved2025-08-09.

External links

[edit]
Wikibooks has a book on the topic of:Guide to Windows Commands
Ecosystem
Interpreters
Terminals
File system navigation
File management
Archiving
Disk management
Processes
Registry
User environment
File contents
Scripting
Networking
Maintenance and care
Boot management
Software development
Miscellaneous
Retrieved from "https://en.wikipedia.org/w/index.php?title=Debug_(command)&oldid=1334867193"
Categories:
Hidden categories:

[8]ページ先頭

©2009-2026 Movatter.jp