Talk:Debug (command)
This article is rated Start-class on Wikipedia's content assessment scale. It is of interest to the following WikiProjects: | |||||||||||||||||||||||||||
|
Syntax section
[edit]The syntax section, IMHO, ought to contain descriptions of the command-line invocation parameters for DEBUG; and using DEBUG with DOS redirection ought to be discussed separately, as should running DEBUG from batch files.
(Calling DEBUG's commands "subcommands" is unnecessarily pedantic.)
As an example of running DEBUG with redirection (implemented by COMMAND.COM or CMD.EXE), consider a text file containing the following two lines:
? q
This file can be given any name (and perhaps extension), for example, DEBUG-IN.TXT
.
Then, invoking DEBUG with:
DEBUG < DEBUG-IN.TXT >> DEBUGOUT.TXT
will invoke DEBUG, taking its input not from "standard in", but from the file, DEBUG-IN.TXT
, and sending its output, not to "standard out", but to the file DEBUGOUT.TXT
, appending it to the original file, if it exists, or creating it otherwise. This is a feature of DOS's COMMAND.COM called redirection, and is supported by DEBUG, which can indeed be very useful, but is peripheral to DEBUG's syntax. In this example, DEBUGOUT.TXT
will contain the output of DEBUG's "?" command, a brief listing of its commands (along with an "echo" of its prompts and input) as follows:
-? assemble A [address] compare C range address dump D [range] enter E address [list] fill F range list go G [=address] [addresses] hex H value1 value2 input I port load L [address] [drive] [firstsector] [number] move M range address name N [pathname] [arglist] output O port byte proceed P [=address] [number] quit Q register R [register] search S range list trace 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 -q
The "trick" of RCX
isn't a trick at all; it's simply DEBUG's way of working nicely without separators when they can be inferred. It's equivalent to R CX
, as implied above in the output of the "?" command. Here's the output of DEBUG < DEBUG-IN.TXT
when the input file has "R" on the first line, followed by "Q" on the next:
-R AX=0000 BX=0000 CX=0000 DX=0000 SP=FFEE BP=0000 SI=0000 DI=0000 DS=1671 ES=1671 SS=1671 CS=1671 IP=0100 NV UP EI PL NZ NA PO NC 1671:0100 65 DB 65 -Q
This is DEBUG's register display. Each of the strings containing an equals sign gives the value of a register. Those ending in "S" are segment registers. Those ending in X are general-purpose registers, CS and IP stand for Code Segment and Instruction Pointer, respectively, and the others are Stack Pointer, Byte Pointer, Source Index, and Destination Index, if memory serves me. They all have their peculiarities.
The general purpose registers can be addressed in instructions in two halves. For example "AH" indicates the higher (first) two nibbles of the AX register, "AL" indicates the lower two nibbles of the same, and similarly for BX, CX, and DX.
The final four pairs of letters on the second line DEBUG output indicate the states of the bits in the flag register.
The last line gives the "current" instruction, located at CS:IP
(shown here as 1671:0100), which consists here of the hex digits "65", which, since they don't correspond to any instruction DEBUG recognizes, are interpreted as a "data byte", which is shown "disassembled" as DB 65
.
Any of the register abbreviations can be used with the "R" command, for example, RIP
(or R IP
), RCS
, or RAX
. "R" entered without a register abbreviation causes DEBUG to issue a colon prompt ":", at which time a new value for the register can be entered. If no input is given (by pressing ENTER, or in a script file, by an empty line), the hyphen prompt returns and no register is changed.
This is all easily discoverable by playing with DEBUG.
Hope it helps, somehow.
Unfree (talk) 03:50, 15 December 2007 (UTC)
- Actually, DEBUG does use "standard in" and "standard out", and COMMAND.COM causes them to be redirected from and to files, if I understand it correctly.Unfree (talk) 03:54, 15 December 2007 (UTC)
- Thanks for the clarification. Could you make these changes yourself? I'm not an expert on this and it seems that know what you are talking about. (RCX (talk) 22:58, 15 December 2007 (UTC))
Modern variants?
[edit]Is there any modern variants of this? It would be very handy to have a small, simple program that can start in no time with support for protected mode and maybe mmx, sse where one can quickly test something out or look at disassembly or opcodes. I would like a list of such programs in this article if it's available. —Preceding unsigned comment added by 118.173.131.127 (talk) 03:24, 18 December 2009 (UTC)
- There must be, but it works fine on Windows XP, service pack 3. The opening paragraph, on what it can do, is rather understated. I searched my whole hard drive for a word once, sector by sector. I have a feeling you can't do that under the new file system, address tracks and sectors that way, but I'm not sure. With such capabilities as DEBUG < MyScript >> MyOutbox, you can do a lot more than execute .COMs, .EXEs, and .BATs on your machine; you can script anything, probably more than with Javascript or Visual Basic scripts, etc. The plethora of ways of doing things leaves many of DEBUG's capabilities unexamined, except to those most familiar with it. I'm sure you can write your own assemblers, disassemblers, mmx, mode manipulation, admin task scripts, supervisors, background robot fixer-uppers, etc. with it, but you better have documentation in the scripts and elsewhere, because it is programming, after all, and you can't ask anybody later about what only you did. Something once clever is soon indecipherable. I'm no programmer. Ask [www.duntemann.com/whoiam.htm Jeff Duntemann], or somebody, or examine how a macro assembler works. The only problem with DEBUG is that anybody can read DEBUG scripts, so if you want it secret, you have to use one of various techniques to convert your "intellectual property" to something useless to all but its users, not curiosity seekers, which I never care about. I once wanted my F5 key to do what it does in EDIT (what I call "TIMESTAMP") elsewhere, though more businesslike, and it was fun, but hard, for a rank beginner. I still use it all the time in one of my diaries (and the same written in a "Symphony Command Language" in another, but with different hotkey!). Unfree (talk) 15:30, 24 December 2009 (UTC)
- OllyDbg might be what you're looking for. rCX (talk) 17:59, 24 December 2009 (UTC)
External links modified
[edit]Hello fellow Wikipedians,
I have just modified one external link on Debug (command). Please take a moment to review my edit. If you have any questions, or need the bot to ignore the links, or the page altogether, please visit this simple FaQ for additional information. I made the following changes:
- Added archive https://web.archive.org/web/20070824025835/http://www.japheth.de:80/Debug/README.TXT to http://japheth.de/Debug/README.TXT
When you have finished reviewing my changes, please set the checked parameter below to true or failed to let others know (documentation at {{Sourcecheck}}
).
This message was posted before February 2018. After February 2018, "External links modified" talk page sections are no longer generated or monitored by InternetArchiveBot. No special action is required regarding these talk page notices, other than regular verification using the archive tool instructions below. Editors have permission to delete these "External links modified" talk page sections if they want to de-clutter talk pages, but see the RfC before doing mass systematic removals. This message is updated dynamically through the template {{source check}}
(last update: 5 June 2024).
- If you have discovered URLs which were erroneously considered dead by the bot, you can report them with this tool.
- If you found an error with any archives or the URLs themselves, you can fix them with this tool.
Cheers.—InternetArchiveBot (Report bug) 21:07, 9 December 2016 (UTC)
- Start-Class software articles
- Unknown-importance software articles
- Start-Class software articles of Unknown-importance
- Start-Class Computing articles
- Unknown-importance Computing articles
- All Computing articles
- All Software articles
- Start-Class Microsoft Windows articles
- Mid-importance Microsoft Windows articles
- WikiProject Microsoft Windows articles