Thread overview
What's wrong with my debugger?
Dec 24, 2015
Chris
Dec 24, 2015
Rainer Schuetze
Dec 24, 2015
Chris
Dec 27, 2015
Rainer Schuetze
December 24, 2015
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)
December 24, 2015

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.
December 24, 2015
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.
December 27, 2015

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.