Muokkaa

Jaa


? (Evaluate Expression)

The question mark (?) command evaluates and displays the value of an expression.

A question mark by itself (?) displays command help. The ? expression command evaluates the given expression.

? Expression

Parameters

Expression

Specifies the expression to evaluate.

Environment

Item Description
Modes User mode, kernel mode
Targets Live, crash dump
Platforms All

Remarks

The input and output of the ? command depend on whether you are using MASM expression syntax or C++ expression syntax. For more information about these kinds of expression syntax, see Evaluating Expressions and Numerical Expression Syntax.

If you are using MASM syntax, the input and output depend on the current radix. To change the radix, use the n (Set Number Base) command.

The ? command evaluates symbols in the expression in the context of the current thread and process.

Some strings may contain escapes, such as \n, \", \r, and \b, that are meant to be read literally, rather than interpreted by the evaluator. If an escape within a string is interpreted by the evaluator, errors in evaluation can occur. For example:

0:000> as AliasName c:\dir\name.txt
0:000> al
  Alias            Value
 -------          -------
 AliasName        c:\dir\name.txt
0:001> ? $spat( "c:\dir\name.txt", "*name*" )
Evaluate expression: 0 = 00000000

0:001> ? $spat( "${AliasName}", "*name*" )
Evaluate expression: 0 = 00000000

0:001> ? $spat( "c:\dir\", "*filename*" )
Syntax error at '( "c:\dir\", "*filename*" )

In the first two examples, even though the string does match the pattern, the evaluator is returning a value of FALSE. In the third, the evaluator cannot make a comparison because the string ends in a backslash ( \ ), and so the \" is translated by the evaluator.

To get the evaluator to interpret a string literally, you must use the @"String" syntax. The following code example shows the correct results:

0:000> ? $spat( @"c:\dir\name.txt", "*name*" )
Evaluate expression: 1 = 00000000`00000001

0:000> ? $spat( @"${AliasName}", "*name*" )
Evaluate expression: 1 = 00000000`00000001

0:001> ? $spat( @"c:\dir\", "*filename*" )
Evaluate expression: 0 = 00000000

In the preceding examples, the $spat MASM operator checks the first string to determine whether it matches (case-insensitive) the pattern of the second string. For more information about MASM operators, see the MASM Numbers and Operators topic.

See also

?? (Evaluate C++ Expression)

.formats (Show Number Formats)

MASM Numbers and Operators

C++ Numbers and Operators

MASM Expressions vs. C++ Expressions

Mixed Expression Examples