Share via


How to: Enable Debugger Autos Window Support

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

The Autos window displays the values of relevant expressions during debugging. Relevant expressions are in most cases the identifiers that appear on the current or previous line in the source code.

You must provide Autos window support in addition to general debugger support. To provide debugger support for your language, you must either implement your own debug engine or target the Common Language Runtime (CLR), which includes a default debug engine for intermediate language (IL) code. You may also need to write an expression evaluator for the Locals window and Watch window to work correctly. For more information about debug engines and expression evaluators, see the Visual Studio Debugger Extensibility.

Autos window support is specified with the startName, qualifyName, and autoExpression methods. The startName and qualifyName methods are generally used for member completion. All identifiers specified with these methods are added to the list of relevant expressions. The autoExpression method is used to add tokens or expressions other than identifiers to the list. The following example shows how to add numbers and parenthetical expressions to the Autos window by adding rules to the parser source file:

Factor
    : Identifier ParenArguments 
    | Identifier
    | NUMBER          { g_service->autoExpression( $1 ); }
    | ParenExpr       { g_service->autoExpression( $1 ); }

Code Spans and Breakpoint Validation

The debug engine must be able to validate breakpoints. For example, breakpoints set on commented lines are not valid. With the Babel package, comments and lexical structures are invalidated automatically, but valid expressions must be explicitly identified in the parser source file.

The codeSpan method specifies valid executable code. The following example shows how to call this method for statements:

Block
  :'{' BlockContent1 '}'
      { $$ = g_service->range($1,$3);
        g_service->codeSpan($1,$3);
        g_service->matchPair($1,$3);
        g_service->addScopeText( $1, $3, 
                                 ScopeBlock, AccessPublic, StorageOther);  
      }
  ...