Debug Command Overview

Source: Internet
Author: User

Debug: A (assembly)

Directly merge the 8086/8087/8088 Memory code into the memory.

This command creates executable machine codes from assembly language statements. All values are in hexadecimal format and must be entered by one to four characters. Specify

Prefix memory.

A [address]

Parameters

Address

Specifies the location where the assembly language instruction is entered. Use a hexadecimal value for address and type each value that does not end with the character "H. If no address is specified, a will start assembly at the last stop.

.

For information about inputting data into a specified byte, see debug E (type ).

For information on disassembly bytes, see debug U (disassembly)

Description

Use the Memory code

The alternative Memory code of the segment is Cs:, DS:, ES:, and SS :. The memory code returned remotely is retf. The memory code for string processing must explicitly declare the string size. For example, you can use movsw to move

Use movsb to move a 16-Bit String.

Assembly jump and call

The assembler automatically assembles short, near and far jumps and calls to the target address based on the replacement of bytes. You can use the near or far prefix to replace such a jump or call, as shown in the following example:

-A0100: 0500
0100:0500 JMP 502; a 2-byte short jump
0100:0502 JMP near 505; A 3-byte near jump
0100:0505 JMP far 50a; a 5-byte far jump

You can abbreviated the near prefix as ne.

Differentiate characters and byte memory locations

When an operand can reference a word memory location or byte memory location, you must use the prefix word PTR or byte PTR to specify the data type. Acceptable abbreviations: Wo and

By. The following example shows two formats:

Dec WO [Si]
Neg byte PTR [128]

Specified operand

Debug uses the memory address referenced by the operands included in brackets. This is because debug cannot distinguish between the immediate operand and the memory address operand. Example

Two display formats:

MoV ax, 21; load ax with 21 h
MoV ax, [21]; load ax with
; Contents
; Memory location 21 h

Use pseudoinstructions

Use the command to provide two commonly used pseudo commands: db operation code, which assembles byte values directly into the memory, DW operation code, and word values directly into the memory. The following are examples of two pseudo commands:

DB 1, 2, 3, 4, "This is an example"
DB 'this is a quotation mark :"'
DB "this is a quotation mark :'"
DW 3000, "Bach"

Example

Command a supports all forms of indirect registration commands, as shown in the following example:

Add Bx, 34 [bp + 2]. [Si-1]
Pop [bp + DI]
Push [Si])

All operation code synonyms are also supported, as shown in the following example:

Loopz 100
Loope 100
Ja 200
Jnbe 200

For the 8087 operation code, you must specify the wait or fwait prefix, as shown in the following example:

Fwait FADD St, ST (3); this line assembles
; An fwait prefix

Debug: C (comparison)

Compare two parts of the memory.

C range address

Parameters

Range

Specify the start and end addresses, or the start address and length of the first area of memory to be compared.

Address

Specifies the starting address of the second memory area to be compared. For information about valid address values, see "Debug description ".

Description

If the range and address memory regions are the same, debug returns directly to the debug prompt without displaying any content. If there are differences, debug will be displayed in the following format:
Address1 byte1 byte2 addess2

Example

The following command has the same effect:

C100, 10f 300
C100l10 300

Each Command compares the memory data blocks of 100 h to 10 FH with those of 300 h to 30 FH.

Debug responds to the preceding command and displays the following information (assuming DS = 197f ):

197f: 0100 4D E4 197f: 0300
197f: 0101 67 99 197f: 0301
197f: 0102 A3 27 197f: 0302
197f: 0103 35 F3 197f: 0303
197f: 0104 97 BD 197f: 0304
197f: 0105 04 35 197f: 0305
197f: 0107 76 71 197f: 0307
197f: 0108 E6 11 197f: 0308
197f: 0109 19 2C 197f: 0309
197f: 010a 80 0a 197f: 030a
197f: 010b 36 7f 197f: 030b
197f: 010c be 22 197f: 030c
197f: 010d 83 93 197f: 030d
197f: 010e 49 77 197f: 030e
197f: 010f 4f 8A 197f: 030f

Note that the addresses 197f: 0106 and 197f: 0306 are missing in the list. This indicates that the values in the addresses are the same.

Debug: D (dump)

Display the content of a certain range of memory addresses.

D [range]

Parameters

Range

Specify the start and end addresses, or the start address and length of the memory area where the content is to be displayed. If range is not specified, the debug program starts from the end of the address range specified in the previous D command.

Displays the content of 128 bytes.

For information about the display register content, see debug R (register ).

Description
When the D command is used, debug displays the memory content in two parts: the hexadecimal part (each byte value is expressed in hexadecimal format) and the ASCII part (each byte value is used

ASCII characters ). Each non-printable character is represented by a period (.) In the displayed ASCII section. Each display line displays 16 bytes of content, one between 8th bytes and 9th bytes.

. Each display line starts at the boundary of 16 bytes.

Example
Run the following command:
DCs: 100 10f
Debug displays the content in the following format:
04ba: 0100 54 4f 4D 00 53 41 57 59-45 52 00 00 00 00 00 Tom. Sawyer ......
If you enter the D command without parameters, debug orchestrates the display format according to the content described in the previous example. Each line is 16 bytes larger than the address of the previous line.

The address starting with a 40-column screen, which is 8 bytes.
For each d command without Parameters entered later, debug displays the byte content immediately after the last command is displayed.
If you type the following command, debug displays 20 h bytes of content starting from CS: 100:
DCs: 100 l 20
If you type the following command, debug displays all bytes in the range from 100 h to 115 h in the CS segment:
DCs: 100 115

Debug: E (type)

Input data to the address specified in the memory.
You can enter data in hexadecimal or ASCII format. All data previously stored at the specified location is lost.

E Address [LIST]

Parameters
Address
Specify the first memory location of the input data.
List
Specifies the data in consecutive bytes to be input into the memory.
For information on integrated memory codes, see debug a (assembly ).
For information on displaying part of the memory, see debug D (dump ).

Description

Use address parameters

If you specify the address value without specifying the optional list parameter value, debug displays the address and content, repeat the address in the next line, and waits for your input. You can

Perform one of the following operations:

Replace the byte value. To do this, enter a new value after the current value. If the value you typed is not a valid hexadecimal value, or the value contains more than two numbers, debug does not display invalid or

.
Enter the next byte. Therefore, Press spacebar (Space key ). To change the value in this byte, enter a new value after the current value. If you press the spacebar (Space key), the value is more than 8

Bit limit. The debug program displays a new line and a new address at the beginning of the line.
Returns the first byte. Therefore, press the hyphen key (-). You can repeatedly press the hyphen key (-) to move more than one byte backward. When hyphen is pressed, debug starts a new line and displays

The front address and byte value.
Stop executing the e command. Therefore, press Enter. You can press enter at any byte location.
Use LIST Parameters

If the value of the List parameter is specified, the subsequent e command replaces the existing byte value with the value in the list. If an error occurs, no byte value will be changed.

The list value can be a hexadecimal byte or string. Use spaces, commas, or tabs to separate values. Strings must be included in single or double quotation marks.

Example

Run the following command:

ECS: 100

Debug displays the content of the first byte in the following format:

04ba: 0100 EB.

To change the value to 41, type 41 at the insertion point, as shown below:

04ba: 0100 eb.41 _

You can use an e command to Type Continuous byte values. Press spacebar (Space key) instead of enter after you type a new value. Debug displays the next value. In this example

Spacebar (Space key), debug will display the following values:

04ba: 0100 eb.41 10. 00. bc ._

To change the hexadecimal value BC to 42, Type 42 at the insertion point, as shown below:

04ba: 0100 eb.41 10. 00. bc.42 _

Assume that the value 10 should be 6f. To correct this value, press the hyphen key twice to return to address 0101 (value: 10 ). Debug displays the following content:

04ba: 0100 eb.41 10. 00. bc.42-
04ba: 0102 00 .-
04ba: 0101 10 ._

At the insert point, type 6f to change the value, as shown below:

04ba: 0101 10.6f _

Press enter to stop the e command and return to the debug prompt.

The following is an example of a string:

EDS: 100 "this is the Text Example"

The string will be filled with 24 bytes starting from DS: 100

Debug: F (fill)

Fill in the address in the specified memory area with the specified value.

Data in hexadecimal or ASCII format can be specified. Any data previously stored in the specified location will be lost.

F range list

Parameters

Range

Specify the start and end addresses, or the start address and length of the memory area to be filled. For more information about valid range values, see "Debug description ".

List

Specify the data to be input. A list can be a string consisting of hexadecimal numbers or quotation marks.

Description

Use range parameter

If the number of bytes in a range is greater than the value in the list, debug assigns a value repeatedly in the list until all bytes in the range are filled.

If any memory in the range is corrupted or does not exist, debug displays the error message and stops the f command.

Use LIST Parameters

If the list contains more values than the number of bytes in the range, debug ignores the additional values in the list.

Example

Run the following command:

F04ba: 100l100 42 45 52 54 41

In response, debug uses the specified value to fill the memory position from 04ba: 100 to 04ba: 1ff. Debug repeats these five values until 100 h bytes are fully filled.

Debug: G (redirection)

Run the program in the memory.

G [= address] [breakpoints]

Parameters

= Address

Specifies the address of the program to be executed in the memory. If address is not specified, Windows 2000 runs the program from the current address in the Cs: IP Address Register.

Breakpoints

Specify 1 to 10 temporary breakpoints that can be set as part of the G command.

For information on execution cycles, repeated string commands, software interruptions, or subroutines, see debug P (execution ).

For information on executing commands, see debug T (Tracking)

Debug: H (hexadecimal)

Perform the hexadecimal operation on the specified two parameters.

H value1 value2

Parameters

Value1

Represents any hexadecimal number from 0 to ffffh.

Value2

Represents the second hexadecimal number in the range from 0 to ffffh.

Description

Debug first adds the specified two parameters, and then removes the second parameter from the first parameter. The calculation results are displayed in one row: Calculate the sum first, and then calculate the difference.

Example

Run the following command:

H19f 10a

Debug executes the operation and displays the following results.
02a9 0095

Debug: I (input)

Reads data from the specified port and displays a byte value.

I Port

Parameters

Port

Specify the input port by address. The address can be a 16-bit value.

For information on sending the byte value to the output port, see debug O (output ).

Example

Run the following command:

I2f8

It is also assumed that the port's byte value is 42 h. Debug reads the byte and displays the value as follows:
42

Debug: L (load)

Load the content of a file or a specific disk sector to the memory.

To load the bytes specified in the Bx: Cx register from a disk file, use the following syntax:

L [address]

To skip the Windows 2000 file system and directly load a specific sector, use the following syntax:

L address drive start number

Parameters

Address

Specify the memory location where the file or slice content is to be loaded. If no address is specified, debug uses the current address in the CS register.

Drive

The drive that contains the disk that reads the specified sector. This value is Numeric: 0 = A, 1 = B, 2 = C, etc.

Start

Specify the hexadecimal number of the first slice to load its content.

Number

Specify the hexadecimal number of consecutive slices to load. Only when you want to load the content of a specific sector rather than the Files specified in the DEBUG command line or the latest debug N (name) command

To use the drive, start, and number parameters.

For information about the file used for the l command, see debug N (name ).

For information on writing debugging files to the disk, see debug W (write ).

Note:

Use the l command without Parameters

When the l command without parameters is used, the files specified on the DEBUG command line will be loaded into the memory, starting from the address Cs: 100. Debug sets both the Bx and CX registers as loaded

The number of bytes. If you do not specify a file in the DEBUG command line, the mounted file will be the file that is frequently specified by the recent N command.

Use the 1 command with the address Parameter

If you use the L command with the address parameter, debug will load the file or the content of the specified sector from the memory location address.

Use the l command with all parameters

If you use the L command with all parameters, debug loads the content of the specified disk sector instead of the file.

Load content of a specific slice

Each sector within the specified range is read from drive. Debug is loaded from start until all the content in the specified number of slice is loaded.

Load the. exe file

Debug ignores the address parameter of the. exe file. If the. exe file is specified, debug locates the file again to the load address specified in the title of the. exe file. In the. exe file

Before being loaded to the memory, the title itself is detached from the. exe file. Therefore, the size of the. exe file on the disk is different from that in the memory. If you want to check the entire. EXE file, use different extensions

Name file.

Open a hexadecimal File

Debug considers files with the. HEX extension as hexadecimal files. Type an l command without parameters to load the hexadecimal file starting from the address specified in the hexadecimal file.

. If the entered l command contains the address parameter, debug adds the specified address to the address found in the hexadecimal file to determine the start address.

Example

Run the following command to start Debug:

Nfile.com

Now you can type the l command to load file.com. Debug loads the file and displays the debug prompt.

Assume that the content of the 109 (6DH) Sector of the starting logical sector of 15 (0fh) needs to be loaded to the memory with the starting address 04ba: 0100 from drive C. To do this, enter the following command:
L04ba: 100 2 0f 6d

Debug: m (mobile)

Copy the content in one memory block to another.

M range address

Parameters

Range

Specify the start and end addresses, or the start address and length of the memory area of the content to be copied.

Address

Specifies the starting address for copying the range content to this location.

Description

Impact of replication on existing data

If the new data is not written to the address of the data block being copied, the source data remains unchanged. However, if the target block already contains data (just as it is in the overwriting copy operation ),

Write the data. (Overwriting a copy operation refers to an operation where the content of the target data block overwrites the content of the original data block .)

Overwrite Replication

Run the M command to overwrite the replication operation of the target address without losing data. Copy the modified address content first. Therefore, if you copy data from a higher address to a lower address

Start from the lowest bit address of the original block and proceed to the highest bit address. If you want to copy data from a low address to a high address, the copy operation starts from the highest address of the original block and starts from the lowest address.

Example

Run the following command:

MCS: 100 110 Cs: 500
Debug first copies the content in the Cs: 110 address to the address Cs: 510, and then copies the content in the Cs: 10f address to the Cs: 50f address until the content in the Cs: 100 address is

Copy to address Cs: 500. To view the results, run the debug D (dump) command and run the M command to specify the target address.

Debug: n (name)

Specify the name of the executable file of the debug L (load) or W (write) command, or specify the parameters of the executable file being debugged.

N [drive:] [path] filename

To specify the parameters of the executable file for the test, use the following syntax:

N file-Parameters

Parameters

If no parameter is available, the N command clears the current specification.
[Drive:] [path] filename

Specifies the location and name of the executable file to be tested.

File-Parameters

Specify parameters and switches for the executable files being tested.

For information about loading files or specified disk sectors to memory, see debug L ).

For information on writing debugging files to the disk, see debug W (write ).

Description

Two Functions of the N command

You can use the N command in two ways. First, you can use it to specify the files used by the subsequent L (load) or W (write) commands. If the file to be debugged is not named

To start debug, you must use nfilename before using the l command to load the file. In CS: 5C, correct file name format for the file control block (FCB. Second, you can use N-life

Specifies the command line parameters and switches of the file to be debugged.

Memory Area

The following four memory regions are affected by the N command:

Memory location
Content

CS: 5C
File control data block (FCB) of file 1)

CS: 6c
File control data block (FCB) of file 2)

CS: 80
N command line length (in characters)

CS: 81
The start of N Command Line Characters

The first file name specified for the n command is placed in FCB of CS: 5C. If the second file name is specified, this name will be placed in FCB of CS: 6C. N the number of characters (

In addition to the first character, n) is stored at Location CS: 80. The actual characters on the N command line (again, except the letter N) are stored at the position starting with Cs: 81. Note that these characters can be

Any switches and delimiters that are valid in the Command entered at the Windows 2000 command prompt.

Example

Assume that debug has been started and the program prog.com being debugged has been loaded. Then you decide to specify two parameters for prog.com and run the program. The command sequence of this example is as follows:

Debug prog.com
Nparam1 param2
G

In this case, the debug g (redirection) Command will run the program, as if you have entered the following command at the Windows 2000 Command Prompt:

Prog param1 param2

Therefore, testing and debugging reflect the normal runtime environment of prog.com.

In the following command sequence, the first n command specifies file1.exe as the followed L (load) command file, which loads file1.exe to the memory. The second N command specifies

The parameter that file1.exe will use. Finally, the G command will run the file1.exe file, as if you typed file1 file2.dat file2.dat in the Windows 2000 command line.

Nfile1.exe
L
Nfile2.dat file3.dat
G

Note:
Do not use the L command in the second form of the N command. Note that if you use the W (write) command, Windows 2000 will use the name file2.dat to save the file being debugged.

File1.exe. To avoid this result, the first form of the N command should always be used immediately before the L or W command.

Debug: O (output)

Send the byte value to the output port.

O Port byte-Value

Parameters

Port

Specify the output port through the address. The port address can be a 16-bit value.

Byte-Value

Specifies the byte value to point to port.

For information on reading byte values from the input port, see debug I (input ).

Example

To send the 4fh byte value to the output port with the address of 2f8h, type the following command:
O2f8 4f

Debug: P (execution)

Executes loops, repeated string commands, software interruptions, or subroutines, or traces through any other commands.

P [= address] [number]

Parameters

= Address

Specifies the location of the first command to be executed. If no address is specified, the default address is the current address specified in the Cs: IP Address Register.

Number

Specifies the number of commands to be executed before the control is returned to debug. The default value is 1.

For information on running programs in the memory, see debug G ).

For information on executing commands, see debug T (Tracking ).

Description
Control Transfer to program to test

When the p command transfers control from debug to the program to be tested, the program runs continuously until the loop, repeated string commands, software interruptions, or child routines with the specified address are completed,

Or until a specified number of machine commands are executed. Control Returns to debug.

Address parameter restrictions

If the address parameter does not specify a segment, debug uses the CS register of the tested program. If address is omitted, the program runs from the address specified in the Cs: IP Address Register. Required

Use equal sign (=) before the address parameter to distinguish it from the number parameter. If the instruction at the specified address is not a loop, repeated string instruction, software interrupt, or subroutine

The p command works the same as the debug T (TRACE) command.

Emails displayed using the p command

After p executes a description, debug displays the register content of the program, the flag status, and the decoding form of the next instruction to be executed.

Warning

You cannot use the p command to trace the read-only memory (ROM ).

Example

Assume that the program being tested contains a call command at address Cs: 143f. To run the subroutine at the target location of the call and return the control to debug, type the following command:

P = 143f

Debug displays results in the following format:
Ax = 0000 BX = 0000 Cx = 0000 dx = 0000 sp = ffee BP = 0000 Si = 0000 di = 0000
DS = 2246 es = 2246 Ss = 2246 cs = 2246 IP = 1443 NV up ei pl nz ac Po NC
2246: 1442 7505 jnz 144a

Debug: Q (Exit)

Stop the debug session and do not save the files currently tested.

After you type Q, control returns to the Windows 2000 command prompt.

Q

Parameters

This command does not contain parameters.
For information on saving files, see debug W (write ).

Debug: R (Register)

Displays or changes the content of one or more CPU registers.

R [Register-name]

Parameters

None

If no parameter is available, the R command displays the content of all registers and the flag in the register storage area.

Register-name

Register name of the content to be displayed.

For information on displaying part of the memory, see debug D (dump ).

For information on disassembly bytes, see debug U (disassembly ).

Description

Use the R command

If the register name is specified, Windows 2000 displays the 16-bit value of the Register marked in hexadecimal notation, and displays the colon as a prompt. If you want to change the value included in the register

, Unless you type a new value and press ENTER; otherwise, press enter to return to the debug prompt.

Valid register name

The following are valid values of register-Name: ax, BX, CX, dx, SP, BP, Si, Di, DS, es, SS, Cs, IP, PC, and F. Both the IP address and the PC instance reference the instruction pointer.

If the register name is specified instead of from the previous list, Windows 2000 displays the following message:

BR Error

Use the f character instead of the register name

If you enter the f character instead of the register name, debug displays the current settings of each tag as two-letter code and then displays the debug prompt. To change the flag settings, enter

The two-letter code:

Flag name
Set
Clear

Overflow
Ov
NV

Direction
DN (minus)
Up (ADD)

Interrupted
EI (Enabled)
Di (disabled)

Positive and Negative
Ng (negative)
PL (positive)

Zero
ZR
NZ

Secondary carry
AC
Na

Parity
PE (even verification)
Po (odd check)

Carry
Cy
NC

You can enter a new flag value in any order. No space is required between these values. To stop the R command, press Enter. Any flag that does not specify a new value remains unchanged.

Emails displayed using the R command

If multiple values are specified for the tag, debug displays the following message:

DF Error

If no flag code is specified in the preceding table, debug displays the following message:

BF Error

In both cases, debug ignores all settings specified after the invalid project.

Default debug settings

When debugging is started, the segment register is set to the low end of the idle memory, the instruction pointer is set to 0100 H, all flags are cleared, and the remaining registers are set to zero,

Outside the SP of ffeeh.

Debug: R

Example

To view the content of all registers, the status of all tags, and the Instruction Decoding table at the current position, type the following command:

R

If the current location is Cs: 11A, the display looks similar to the following:

Ax = 0e00 BX = 00FF Cx = 0007 dx = 01ff sp = 039d BP = 0000 Si = 005c di = 0000
DS = 04ba es = 04ba Ss = 04ba cs = o4ba IP = 011a NV up di ng NZ AC PE NC
04ba: 011a cd21 int 21

To view only the status of the flag, enter the following command:

RF

Debug displays information in the following format:

NV up di ng nz ac pe nc -_

Now, you can type one or more valid flag values in any order, with or without spaces, as shown below:

NV up di ng nz ac pe nc-pleicy

Debug ends the R command and displays the debug prompt. To view the changes, enter the R or RF command. Debug displays the following content:

NV up ei pl nz ac pe cy -_
Press enter to return to the debug prompt.

Debug: S (Search)

Searches for one or more byte values in an address range.

S range list

Parameters

Range

Specify the start and end addresses of the search range.

List

Specify the mode of one or more byte values or the string to be searched. Use spaces or commas to separate each byte value from the next byte value. Enclose string values in quotation marks.

Description

If the list parameter contains multiple byte values, debug only displays the first address of the byte value. If the list contains only one byte value, debug displays

Address available.

Example

Suppose you need to find all the addresses that contain a value of 41 and range from CS: 100 to CS: 110. To do this, enter the following command:

SCS: 100 110 41

Debug displays results in the following format:

04ba: 0104
04ba: 010d
-

The following command searches for the string "PH" in the range from CS: 100 to CS: 1a0 ".
SCS: 100 1a0 "PH"

Debug: T (Tracking)
(Sorry, debug: t part is missing. If any user has this part, please let me know)

Debug: U (disassembly)

Disassemble the byte and display the corresponding original statement, including the address and byte value. The disassembly code looks like a list of compiled files.

U [range]

Parameters

None

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.