www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Request: set debugging source file

Hi all.

Currently, I'm working on a fairly large project as part of my honours
thesis, and I managed to convince my supervisor to let me do it in D.

Trick is, he wanted it done literate style, so I took CWEB and hacked it
to produce D source files (code formatting is still somewhat crazy, but
oh well).

Now, this all works beautifully, and thanks to D's support for the #line
pre-processor statement, compilation errors even appear on the correct
line of the original source file.

The problem is that when I go to debug this code, D inserts the
generated file's name into the debugging information.  The generated .d
file is basically a hideous, unformatted mess that makes any kind of
sane debugging almost impossible.  It also makes it difficult to make
corrections, since the line you have to change and the line you're
looking at aren't even in the same file, let alone the same place.

Every time I debug a module, I have to compile it, go delete the .d
file, and copy the .dw (the literate source) to the .d file name to get
the debugger to open the "right one."

So, unless there's a way to change what filename D puts into the
debugging information that I've missed, I'd like to request a new pragma
be added, at the least to the DMD compiler.  This pragma should tell the
compiler the filename it should use when referring to the source file
itself.  For example:

     version(DigitalMars)
         pragma(sourcefile, "engine.dw");

Even if I have to put this in every file manually, it would make my life so much easier. I also suspect this would be a boon for any program that generates D source files. -- Daniel -- Unlike Knuth, I have neither proven or tried the above; it may not even make sense. v2sw5+8Yhw5ln4+5pr6OFPma8u6+7Lw4Tm6+7l6+7D i28a2Xs3MSr2e4/6+7t4TNSMb6HTOp5en5g6RAHCP http://hackerkey.com/
Mar 10 2007