Thread overview
Code Listing?
Nov 11, 2006
John
Nov 11, 2006
Lars Ivar Igesund
Nov 11, 2006
John
Nov 11, 2006
John
Nov 11, 2006
John
Nov 13, 2006
Don Clugston
November 11, 2006
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
November 11, 2006
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
November 11, 2006
Lars,

I mean generated assembly coed listing.

John
November 11, 2006
John wrote:

> I mean generated assembly coed listing.

gdc -S, or use "obj2asm" with DMD objects.

--anders
November 11, 2006
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?
November 11, 2006
"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?


November 11, 2006
== 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?
November 12, 2006
"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.


November 13, 2006
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.