www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - debug mixins

reply Inquie <Inquie data1.com> writes:
So, is it possible to debug string mixins?

I ran visual D and tried to step in to a function that was 
generated by a mixin and it brought an open file dialog box 
asking me to load the source code where the function was 
located... of course, it wasn't located anywhere except in the 
mixin string.


This leads to the idea, why can't the compiler simply output the 
mixin string to a file then the debugger can load that source 
file?

One of the most frustrating things about D is not having the 
ability to debug it's powerful meta programming in any reasonable 
way. (bad enough having to resort to using pragma(msg))

But we can't even debug the results of those meta programming in 
the case of string mixins because there is no way to step in to 
them... It seems all the machinery is there, but just a few extra 
steps are needed.
Mar 14
next sibling parent reply Jonathan M Davis via Digitalmars-d-learn writes:
On Wednesday, March 15, 2017 03:43:20 Inquie via Digitalmars-d-learn wrote:
 So, is it possible to debug string mixins?

 I ran visual D and tried to step in to a function that was
 generated by a mixin and it brought an open file dialog box
 asking me to load the source code where the function was
 located... of course, it wasn't located anywhere except in the
 mixin string.


 This leads to the idea, why can't the compiler simply output the
 mixin string to a file then the debugger can load that source
 file?

 One of the most frustrating things about D is not having the
 ability to debug it's powerful meta programming in any reasonable
 way. (bad enough having to resort to using pragma(msg))

 But we can't even debug the results of those meta programming in
 the case of string mixins because there is no way to step in to
 them... It seems all the machinery is there, but just a few extra
 steps are needed.
Related: https://issues.dlang.org/show_bug.cgi?id=5051 - Jonathan M Davis
Mar 14
parent reply Inquie <Inquie data1.com> writes:
On Wednesday, 15 March 2017 at 03:50:21 UTC, Jonathan M Davis 
wrote:
 On Wednesday, March 15, 2017 03:43:20 Inquie via 
 Digitalmars-d-learn wrote:
 [...]
Related: https://issues.dlang.org/show_bug.cgi?id=5051 - Jonathan M Davis
So, after 3 years, nothing?
Mar 15
parent Jonathan M Davis via Digitalmars-d-learn writes:
On Wednesday, March 15, 2017 13:01:36 Inquie via Digitalmars-d-learn wrote:
 On Wednesday, 15 March 2017 at 03:50:21 UTC, Jonathan M Davis

 wrote:
 On Wednesday, March 15, 2017 03:43:20 Inquie via

 Digitalmars-d-learn wrote:
 [...]
Related: https://issues.dlang.org/show_bug.cgi?id=5051 - Jonathan M Davis
So, after 3 years, nothing?
Not as far as I know, but it's a nice-to-have, not a necessity, and there's a lot of stuff to get done. Someone is going to have to be interested enough in it to spend the time doing it as opposed to something else that they're interested in getting done, and no one seems to have done that yet. - Jonathan M Davis
Mar 16
prev sibling parent Stefan Koch <uplink.coder googlemail.com> writes:
On Wednesday, 15 March 2017 at 03:43:20 UTC, Inquie wrote:
 So, is it possible to debug string mixins?

 I ran visual D and tried to step in to a function that was 
 generated by a mixin and it brought an open file dialog box 
 asking me to load the source code where the function was 
 located... of course, it wasn't located anywhere except in the 
 mixin string.


 This leads to the idea, why can't the compiler simply output 
 the mixin string to a file then the debugger can load that 
 source file?

 One of the most frustrating things about D is not having the 
 ability to debug it's powerful meta programming in any 
 reasonable way. (bad enough having to resort to using 
 pragma(msg))

 But we can't even debug the results of those meta programming 
 in the case of string mixins because there is no way to step in 
 to them... It seems all the machinery is there, but just a few 
 extra steps are needed.
In dmd ~master. there is an undocumented switch called -vcg-ast. It will produce a file with everything expanded. (Only if the code compiles with no errors). It produces a cg-file which may or may not contain a valid source representation of the actual code compiled.
Mar 14