www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - What's wrong with my debugger?

reply Chris <cdallacosta gmail.com> writes:
Please see the linked screenshot: http://i.imgur.com/SpkXu5m.png

As you can see, the inside, outside and collision arrays don't 
seem to work with the debugger. They show a bogus lenght and a 
bogus memory address. Extracting the lenghts to separate 
variables outl, insl and coll show that the arrays actually 
behave properly, though.

Is that a debugger bug? Or maybe something I can fix? Thanks in 
advance.

DMD 2.069.2, Mago debugger, VisualD 3.43, compiling for 32 bits 
if that makes a difference (can't get either 64 bit compilation 
or LDC to work)
Dec 23 2015
parent reply Rainer Schuetze <r.sagitario gmx.de> writes:
On 24.12.2015 03:14, Chris wrote:
 Please see the linked screenshot: http://i.imgur.com/SpkXu5m.png

 As you can see, the inside, outside and collision arrays don't seem to
 work with the debugger. They show a bogus lenght and a bogus memory
 address. Extracting the lenghts to separate variables outl, insl and
 coll show that the arrays actually behave properly, though.

 Is that a debugger bug? Or maybe something I can fix? Thanks in advance.

 DMD 2.069.2, Mago debugger, VisualD 3.43, compiling for 32 bits if that
 makes a difference (can't get either 64 bit compilation or LDC to work)
One possible issue is that there are multiple variable declarations in the function with the names "outside, inside and collision". Dmd does not emit proper scope information for variables, so all variables show up anywhere in a function. (See for example https://github.com/D-Programming-Language/dmd/pull/2867). In the locals window, mago displays all instances of variables, but with the same value (which might be some uninitialized value of a different declaration than expected). The Visual Studio debug engine shows different values, though.
Dec 24 2015
parent reply Chris <cdallacosta gmail.com> writes:
On Thursday, 24 December 2015 at 09:30:24 UTC, Rainer Schuetze 
wrote:
 In the locals window, mago displays all instances of variables, 
 but with the same value (which might be some uninitialized 
 value of a different declaration than expected). The Visual 
 Studio debug engine shows different values, though.
Hi, thanks for the reply but not actually, no, if I change the debug engine to VS and rebuild I get the same behaviour.
Dec 24 2015
parent Rainer Schuetze <r.sagitario gmx.de> writes:
On 24.12.2015 14:57, Chris wrote:
 On Thursday, 24 December 2015 at 09:30:24 UTC, Rainer Schuetze wrote:
 In the locals window, mago displays all instances of variables, but
 with the same value (which might be some uninitialized value of a
 different declaration than expected). The Visual Studio debug engine
 shows different values, though.
Hi, thanks for the reply but not actually, no, if I change the debug engine to VS and rebuild I get the same behaviour.
I suspect that the variables are part of a closure. There is bad and incomplete debug information emitted by dmd in this case.
Dec 27 2015