Global variables not accessible with Visual Studio debugger

pdgr pdgr at foo.bar
Sun Apr 24 11:35:26 UTC 2022


On Sunday, 24 April 2022 at 06:11:03 UTC, Rainer Schuetze wrote:
>
>
> On 23/04/2022 15:41, pdgr wrote:
>> On Saturday, 23 April 2022 at 13:29:16 UTC, pdgr wrote:
>>> Thanks for the suggestions, the extern(C) thing doesn't 
>>> work.. but in the disassembly I can see the mangled name and 
>>> I can inspect the value in the watch window using that 
>>> mangled name. Kinda annoying but it works.
>> 
>> Scratch that.. it doesn't actually work: the disassembly 
>> doesn't not contain any mangled names, I mistook a hex value 
>> for the mangled name.
>
> I suspect you are trying to watch a thread local variable that 
> uses indirect addressing.
>
> With shared or __gshared variables, you see the symbol being 
> used as debug information, but the debugger cannot handle that 
> as a C++ expression.
>
> You can see the mangled symbol with "pragma(msg, var.mangleof)" 
> at compile time. Using this in the watch window shows it as a 
> "void*", which you can then cast to your type using C++-Syntax, 
> e.g. "*(int*)_D3mod3tlsi".
>
> I'd recommend installing Visual D including the debugger 
> extension mago instead, though ;-)

Ok thanks for the help!


More information about the Digitalmars-d-debugger mailing list