views:

46

answers:

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.

+2  A: 

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
A: 

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