Command Syntax

Commands consist of command names and parameters. Names and parameters are not case-sensitive.

If a syntax error occurs in a debugger command, the debugger redisplays the command line and indicates the error with a caret (^) and the word Error, as in the following example:


A100
 ^ Error

Parameters

You can separate command parameters with delimiters (spaces or commas), but a delimiter is required only between two consecutive hexadecimal values. The following commands are equivalent:


dCS:100 110
d CS:100 110
d,CS:100,110

Following are the parameters you can use with commands:

addr

Represents an address parameter in one of four forms. For more information about the operators shown in the following address forms, see Binary and Unary Operators.


#1f:02C0

Protected-mode address (selector:offset)

%31020

Linear address

%%31020

Physical address

&0100:02FF

Real-mode address (segment:offset)


Any of these specified address forms overrides the current address type.

byte

Specifies a two-digit hexadecimal value.

cmds

Specifies an optional set of debugger commands to be executed with the bp (Breakpoint) or j (Conditional) command.

count

Specifies a count. Valid values depend on the command with which this parameter is being used.

dword

Represents an eight-digit (4-byte) hexadecimal value. The DWORD data type is most commonly used as a physical address.

expr

Represents a combination of parameters and operators that evaluates to an 8-bit, 16-bit, or 32-bit value. An expr parameter can be used as a value in any command. An expr parameter can combine any symbol, number, or address with any of the binary and unary operators.

flags

Specifies one or more conditions. Valid conditions depend on the command with which this parameter is being used.

group-name

Specifies the name of a group that contains the map symbols you want to display.

list

Specifies a series of byte values or a string. The list parameter must be the last parameter on the command line. Following is an example of the f (Fill) command with a list parameter:

fCS:100 42 45 52 54 41

map-name

Specifies the name of a symbol map file.

name-chars

Specifies one or more characters.

number

Specifies a numeric value. Valid values depend on the command with which this parameter is being used.

object

Specifies a handle, a selector, or a heap address.

option

Specifies an option. Valid options depend on the command with which this parameter is being used.

range

Specifies the block of memory on which the command should operate. The range parameter can be two addresses (addr addr); or it can be one address and a length (addr L word, where word is the number of items on which the command should operate; 80h is the default value). Following are three valid examples:

CS:100 110

CS:100 L 10

CS:100

The limit for range is 10000h. To specify a word of 10000h using only four digits, use 0000h or 0h.

reg

Specifies the name of a microprocessor register.

string

Represents any number of characters enclosed in single quotation marks (') or double quotation marks ("). For quotation marks that must appear within string, you must use two sets of quotation marks. For example, the following strings are valid:

'This ''string'' is OK.'

\"This \"\"string\"\" is OK.\"

However, the following strings are not valid:

\"This \"string\" is not OK.\"

\"This 'string' is not OK.\"

The ASCII values of the characters in the string are used as a list of byte values.

word

Specifies a four-digit (2-byte) hexadecimal value.


Binary and Unary Operators

Following, in descending order of precedence, are the binary operators that can be used in commands:

Operator

Meaning

( )

Parentheses

:

Address binder

*

Multiplication

/

Integer division

MOD

Modulus (remainder)

+

Addition

Subtraction

>

Greater-than relational operator

<

Less-than relational operator

>=

Greater-than/equal-to relational operator

<=

Less-than/equal-to relational operator

==

Equal-to relational operator

!=

Not-equal-to relational operator

AND

Bitwise Boolean AND

XOR

Bitwise Boolean exclusive OR

OR

Bitwise Boolean OR

&&

Logical AND

||

Logical OR


Following, in descending order of precedence, are the unary operators that can be used in commands:

Operator

Meaning

&(seg)

Address of segment value

#(sel)

Address of selector value

%%(phy)

Address as a physical value

%(lin)

Address as a linear value

Two's complement

!

Logical NOT operator

NOT

One's complement

SEG

Segment address of operand

OFF

Address offset of operand

BY

Low-order byte from given address

WO

Low-order word from given address

DW

Doubleword from given address

POI

Pointer (4 bytes) from given address — this operator works only with 16:16 addresses

PORT

1 byte from given port

WPORT

Word from given port


Regular Expressions

The set of regular expressions that the debugger supports for matching symbols is similar to the set supported by UNIX grep. The debugger set includes a few enhancements.

Following are the wildcards:

Wildcard

Description

.

Matches any single character.

[ ]

Defines a character class; matches a set or range of characters.

^

Negates a character class.


Following are the postfix operators:

Operator

Description

*

Causes the previous wildcard or single character to match zero or more characters.

#

Matches zero or one.

+

Plus sign, matches one or more.


Anywhere a symbol is accepted, a regular expression can be used. If there is more than one match, a list of matching symbols is displayed and you must select the proper symbol. The symbol match is not case-sensitive.

The asterisk (*), number sign (#), and plus sign (+) are already math expression operators. To be recognized as a regular expression operator, each of these characters must be immediately preceded by an escape character — the backslash (\). The period (.), opening bracket ([), and closing bracket (]) do not require escape characters. Anything inside the brackets of a character class does not have to be escaped. Following are valid character classes:


[a-z]
[;*+#]

Characters are escaped at two levels: in the expression evaluator and in the regular expression parser. A character special to the expression evaluator (*, #, +, or \) must be escaped to make it to the regular expression parser. If a character special to the regular expression parser must be escaped (for example, to match symbols with * or # in them), it must be escaped twice. If a backslash is needed in an expression, it must be double escaped.

Following are sample regular expressions:

Regular expression

Description

sym.\*

Matches any symbols beginning with the string sym.

sym\*

Matches sym alone and sym followed by any characters.

.\*sym.\*

Matches any symbols containing the string sym.

sym[0–9]

Matches sym0, sym1, sym2, and so on.

sym\\\*

Matches sym*.

sym\\\\

Matches sym\.

sym\\\\.\*

Matches any symbols beginning with the string sym\.