www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Code Listing?

reply John <johnkirollos yahoo.com> writes:
Hello

I'm just experimenting (playing) with the D language, and i wonder if
there is a compile option that enables code listing??

Thanks
John
Nov 11 2006
parent reply Lars Ivar Igesund <larsivar igesund.net> writes:
John wrote:

 Hello
 
 I'm just experimenting (playing) with the D language, and i wonder if
 there is a compile option that enables code listing??
 
 Thanks
 John
Not sure what you mean, but if you turn on -cov (for coverage), you should be able to get a listing showing how many times a given statement is executed. -- Lars Ivar Igesund blog at http://larsivi.net DSource & #D: larsivi
Nov 11 2006
parent reply John <johnkirollos yahoo.com> writes:
Lars,

I mean generated assembly coed listing.

John
Nov 11 2006
parent reply =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
John wrote:

 I mean generated assembly coed listing.
gdc -S, or use "obj2asm" with DMD objects. --anders
Nov 11 2006
parent reply John <johnkirollos yahoo.com> writes:
Thanks anders

I thought there would be a feature that enables listing parts of the
code, not the whole obj file (a pragma for example that I can apply
to a block of code)..

Why there is no such feature?
Nov 11 2006
parent reply "Jarrett Billingsley" <kb3ctd2 yahoo.com> writes:
"John" <johnkirollos yahoo.com> wrote in message 
news:ej4n67$11ih$1 digitaldaemon.com...
 Thanks anders

 I thought there would be a feature that enables listing parts of the
 code, not the whole obj file (a pragma for example that I can apply
 to a block of code)..

 Why there is no such feature?
Because DMD doesn't compile to assembly which is then assembled by another assembler?
Nov 11 2006
parent reply John <johnkirollos yahoo.com> writes:
== Quote from Jarrett Billingsley (kb3ctd2 yahoo.com)'s article
 "John" <johnkirollos yahoo.com> wrote in message
 news:ej4n67$11ih$1 digitaldaemon.com...
 Thanks anders

 I thought there would be a feature that enables listing parts of
the
 code, not the whole obj file (a pragma for example that I can
apply
 to a block of code)..

 Why there is no such feature?
Because DMD doesn't compile to assembly which is then assembled by
another
 assembler?
Jarrett, C++ for example can generated asm code listing. It's useful in debugging, code optimization, and for me, it's interesting in learning the language by seeing how the compiler generates the code. There is nothing that prevents D from having such feature, as it generates directly executable code and does not rely on a VM. anders, obj2asm coming with DMD is a Linux executable? What about a windows equivalent?
Nov 11 2006
parent reply "Jarrett Billingsley" <kb3ctd2 yahoo.com> writes:
"John" <johnkirollos yahoo.com> wrote in message 
news:ej5jsm$1r9l$1 digitaldaemon.com...
 Jarrett,

 C++ for example can generated asm code listing. It's useful in
 debugging, code optimization, and for me, it's interesting in
 learning the language by seeing how the compiler generates the code.

 There is nothing that prevents D from having such feature, as it
 generates directly executable code and does not rely on a VM.
Then ask for Walter to add it to DMD. There's no reason why it doesn't have it other than he didn't think about it, or he didn't think it necessary.
 obj2asm coming with DMD is a Linux executable? What about a windows
 equivalent?
Man, it would be nice. But the Windows version of obj2asm is available from Digital Mars as well -- in the $15 extended utilities package. I'm not entirely sure why Walter distributes the Linux version for free. As far as disassembling the individual object files, you'd probably have luck using Borland tools to do so, as DMD uses the OMF object format. But for fully compiled EXEs or DLLs, you can try the Microsoft DUMPOBJ utility, if you can get your hands on it. It works well. Failing all of that, you can use a debugger to step through your program and look at the assembly listing on the fly. It's not all at once, but hey.
Nov 11 2006
parent Don Clugston <dac nospam.com.au> writes:
Jarrett Billingsley wrote:
 "John" <johnkirollos yahoo.com> wrote in message 
 news:ej5jsm$1r9l$1 digitaldaemon.com...
 Jarrett,

 C++ for example can generated asm code listing. It's useful in
 debugging, code optimization, and for me, it's interesting in
 learning the language by seeing how the compiler generates the code.

 There is nothing that prevents D from having such feature, as it
 generates directly executable code and does not rely on a VM.
Then ask for Walter to add it to DMD. There's no reason why it doesn't have it other than he didn't think about it, or he didn't think it necessary.
 obj2asm coming with DMD is a Linux executable? What about a windows
 equivalent?
Man, it would be nice. But the Windows version of obj2asm is available from Digital Mars as well -- in the $15 extended utilities package. I'm not entirely sure why Walter distributes the Linux version for free. As far as disassembling the individual object files, you'd probably have luck using Borland tools to do so, as DMD uses the OMF object format. But for fully compiled EXEs or DLLs, you can try the Microsoft DUMPOBJ utility, if you can get your hands on it. It works well. Failing all of that, you can use a debugger to step through your program and look at the assembly listing on the fly. It's not all at once, but hey.
The Open Watcom compiler tools work with DMD. Also DDL is becoming a good alternative to DUMPOBJ.
Nov 13 2006