<p>Here's some code I have:</p>

<pre><code>MyClass* MyClass::getInstance()
{
   static MyClass instance;
   return &amp;instance;
}
</code></pre>

<p>I want to look into this singleton's current values. But I'm currently paused three hours into execution, and the reason I'm paused is that I'm out of memory. So I can't put a breakpoint in this method there to see what the value is.</p>

<p>My question then is how to refer to this <code>instance</code> variable from a global scope. I've tried referring to it as <code>MyClass::getInstance::instance</code> but that doesn't work. I'm guessing <code>getInstance</code> has to be decorated somehow. Anyone know how?</p>

<p>This is in Visual Studio 2008.</p>

In gdb, you can put a watchpoint on the mangled name of the variable.
For example, with this function:
```
```
int f() {
    static int xyz = 0;
    ++xyz;

    return xyz;
}
```
```
I can watch _ZZ1fvE3xyz (as mangled by gcc 3.2.3 or gcc 4.0.1).