Context operator in the debugger (C++) - Visual Studio (Windows) (original) (raw)

In this article

You can use the context operator in C++ to qualify a breakpoint location, variable name, or expression. The context operator is useful for specifying a name from an outer scope that is otherwise hidden by a local name.

Syntax

There are two ways of specifying context:

  1. {,,[_module_] } expression
    The braces must contain two commas and the module (executable or DLL) name or full path.
    For example, to set a breakpoint at the SomeFunction function of EXAMPLE.dll:
{,,EXAMPLE.dll}SomeFunction  
  1. module!expression
EXAMPLE.dll!SomeFunction  
{,,"a long, long, library name.dll"} g_Var  
  1. Lexical scope outward, starting with the current block, series of statements enclosed in braces, and continuing outward with the enclosing block. The current block is the code containing the current location, instruction pointer address.
  2. Function scope. The current function.
  3. Class scope, if the current location is inside a C++ member function. Class scope includes all base classes. The expression evaluator uses the normal dominance rules.
  4. Global symbols in the current module.
  5. Public symbols in the current program.

Feedback