Thread overview
Mago with VisualD can't show top-level variables in the watch window
Jul 27, 2015
Lewis
Jul 27, 2015
Rainer Schuetze
Jul 28, 2015
Lewis
Jul 28, 2015
Lewis
July 27, 2015
I have the following minimal test code:

import std.stdio;
int TEST_CONSTANT = 999;
int main(string[] argv)
{
    writeln(TEST_CONSTANT);
    readln();
    return 0;
}

I'm running this in VS2013 with VisualD 0.3.41 and setting a breakpoint on the readln() line. In the watch window, I get "D0013: Error: Symbol not found" when trying to inspect TEST_CONSTANT. In contrast, if I create a local variable inside of main, I can view that just fine.

I have native edit and continue enabled, and Mago is set as the debugger in both the project debug settings and the global VisualD settings. I have Debug Info set to "Symbolic (suitable for Mago)", and cv2pdb turned off.

For reference, I get exactly the same behaviour when using the VS debugger and cv2pdb enabled.

Is this unsupported in Mago, or am I missing something?

Thanks in advance!
July 27, 2015

On 27.07.2015 03:21, Lewis wrote:
> I have the following minimal test code:
>
> import std.stdio;
> int TEST_CONSTANT = 999;
> int main(string[] argv)
> {
>      writeln(TEST_CONSTANT);
>      readln();
>      return 0;
> }
>
> I'm running this in VS2013 with VisualD 0.3.41 and setting a breakpoint
> on the readln() line. In the watch window, I get "D0013: Error: Symbol
> not found" when trying to inspect TEST_CONSTANT. In contrast, if I
> create a local variable inside of main, I can view that just fine.
>
> I have native edit and continue enabled, and Mago is set as the debugger
> in both the project debug settings and the global VisualD settings. I
> have Debug Info set to "Symbolic (suitable for Mago)", and cv2pdb turned
> off.
>
> For reference, I get exactly the same behaviour when using the VS
> debugger and cv2pdb enabled.
>
> Is this unsupported in Mago, or am I missing something?
>
> Thanks in advance!

Unfortunately there is not enough debug information to figure out the mangling of TEST_CONSTANT, because it is decorated with the module name. So you have to specify its fully qualified name in watch window, e.g. "test.TEST_CONSTANT" if your module is named "test".

[This works with mago, but the Visual Studio debugger engine is confused by '.' inside names. cv2pdb translates them to '@', so you have to use "test@TEST_CONSTANT" with the translated debug information.]
July 28, 2015
On Monday, 27 July 2015 at 07:05:51 UTC, Rainer Schuetze wrote:
>
>
> On 27.07.2015 03:21, Lewis wrote:
>> [...]
>
> Unfortunately there is not enough debug information to figure out the mangling of TEST_CONSTANT, because it is decorated with the module name. So you have to specify its fully qualified name in watch window, e.g. "test.TEST_CONSTANT" if your module is named "test".
>
> [This works with mago, but the Visual Studio debugger engine is confused by '.' inside names. cv2pdb translates them to '@', so you have to use "test@TEST_CONSTANT" with the translated debug information.]

Ahhh, gotcha. Too bad it can't infer that, but that's perfectly acceptable as a workaround. Thanks!
July 28, 2015
For anyone coming across this in the future, I'll leave another hot tip. Turn the optimizer off in the Code Generation settings for your debug build configuration. With it on, a lot of the debug values look wonky. It took me way too long to figure this out  :)