Christmas request! VD closure debugging
Michelle Long
HappyDance321 at gmail.com
Sun Dec 16 04:13:31 UTC 2018
And, of course, it is not working in my production code when a
simple example works:
auto foo()
{
int x = 0;
auto bar()
{
int y = 0;
x++;
y++;
}
bar();
}
int main()
{
foo();
return 0;
}
My code is more like
class X
{
auto foo()
{
int x = 0;
auto bar()
{
int y = 0;
x++;
y++;
}
bar();
}
}
int main()
{
X x = new X();
x.foo();
return 0;
}
which when done gives a crap value for x in the auto's and watch.
(in my production code the variables are not found)
Note that making foo static (and changing to X.foo()) works...
My my production code isn't showing any of the variables is
beyond me since it is pretty much the above case almost exactly,
in fact, here is the code structure:
class A { }
class X
{
A[] a;
static auto foo(string s, bool b = false)
{
int x = 0;
struct v;
auto r(T, bool s = true)(int l = 1)
{
static if (s)
{
ulong q = 0;
x += T.sizeof*l;
}
return x;
}
r!(char, true)();
}
}
int main()
{
X x = new X();
X.foo("asdf");
return 0;
}
which does show X just fine(I simplified the code above removing
all "unnecessary" things but seems it isn't so unnecessary.
Building under x64 does work although the auto's are not shown...
I can still watch the (global)variables and they give the correct
values.
So, this offers a solution until the issue can be sorted. As long
as I can get at the globals then I can properly debug. Why my
code is having issues with the x86 build, but when reduced works
fine, but also works partially with the x64 build is beyond me...
Thanks...
More information about the Digitalmars-d-ide
mailing list