2

For instance, write a function such as:

void foo()
{
    try
    {
        throw new Exception(@"whatever");
    }
    catch
    {
        int n=1; //put a breakpoint here
    }
}

When the debugger is on the line in the catch block, typing $exception will show the exception information.

Are there any more? What are these things? There seems to be no official documentation on them. I've used $exception for quite a while, but was hoping there were others that, for example, would show the return value of a method.

Community
  • 1
  • 1
Steve Dunn
  • 21,044
  • 11
  • 62
  • 87

2 Answers2

3

These are variables created by the debugger for your convenience. You get similar variables if you use the Immediate window: int x = 10;

would result in $x in the locals window

Crippledsmurf
  • 3,982
  • 1
  • 31
  • 50
2

More of the special variables are described in this article. There's also a comprehensive list of the variables available in windbg - not sure how many are supported in VisualStudio though

the_mandrill
  • 29,792
  • 6
  • 64
  • 93