Debugger expressions support the following additional operators:
The memory operators are useful mainly in debugging assembly-language code.
The context operator ({ }) is not part of the C/C++ language. It is specific to the debugger. The context operator specifies the context of an expression or line number that appears in more than one place in the source code.
For example, you can use the context operator to specify a name in an outer scope that is otherwise hidden by a local name.
When a debugger expression that contains a symbol, the expression evaluator searches for the symbol in the following order:
With the context operator, you specify the starting point of the search and bypass the current location. You cannot specify a block because a block has no name. You cannot specify a class, but you can specify a member function of the class and let the expression evaluator search outward.
Syntax
{[function],[file],[image]} [expression]
The context operator has the same precedence and associativity as the type-cast operator. You can omit function, file, or expression, but you must specify all leading commas. If a name contains a comma, you must enclose the name in parentheses.
Example
Suppose you want to display the value of the variable Pos
, which is local to the function make_box
defined in the source file DRAWBOX.C. Type the following in the QuickWatch dialog box or the Watch window:
{make_box,C:\TREE1\DRAWBOX.C,C:\TREE2\DISPTXT.DLL}Pos
If there is more than one source file called DRAWBOX.C, the third parameter specifies that the source file containing the function make_box
is the one used by DISPTXT.DLL. Otherwise, you can leave out this parameter.