www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - How do I view assembly?

reply "Sandeep Datta" <datta.sandeep gmail.com> writes:
Hi,

Is there a way by which I can see the assembly code generated by 
the D compiler similar to the -S etc switches on GCC?

Regards,
Sandeep Datta.
May 18 2012
next sibling parent reply =?UTF-8?B?QWxleCBSw7hubmUgUGV0ZXJzZW4=?= <alex lycus.org> writes:
On 18-05-2012 16:46, Sandeep Datta wrote:
 Hi,

 Is there a way by which I can see the assembly code generated by the D
 compiler similar to the -S etc switches on GCC?

 Regards,
 Sandeep Datta.
Not with DMD. What you have to do is disassemble the file with objdump -D foo.o (add -M intel to maintain your sanity) On Windows, there's a dump tool called dumpobj shipped with DMD IIRC. -- Alex Rønne Petersen alex lycus.org http://lycus.org
May 18 2012
next sibling parent "Sandeep Datta" <datta.sandeep gmail.com> writes:
On Friday, 18 May 2012 at 14:48:07 UTC, Alex Rønne Petersen 
wrote:
 On 18-05-2012 16:46, Sandeep Datta wrote:
 Hi,

 Is there a way by which I can see the assembly code generated 
 by the D
 compiler similar to the -S etc switches on GCC?

 Regards,
 Sandeep Datta.
Not with DMD. What you have to do is disassemble the file with objdump -D foo.o (add -M intel to maintain your sanity) On Windows, there's a dump tool called dumpobj shipped with DMD IIRC.
Wow, that was fast! Many thanks Alex Rønne Petersen.
May 18 2012
prev sibling parent reply "bearophile" <bearophileHUGS lycos.com> writes:
Alex Rønne Petersen:

 On Windows, there's a dump tool called dumpobj shipped with DMD 
 IIRC.
I think you refer to "obj2asm", that's not shipped with DMD. (A -S (or -asm) switch for DMD would be quite nice and useful). Bye, bearophile
May 18 2012
parent reply =?UTF-8?B?QWxleCBSw7hubmUgUGV0ZXJzZW4=?= <alex lycus.org> writes:
On 18-05-2012 17:18, bearophile wrote:
 Alex Rønne Petersen:

 On Windows, there's a dump tool called dumpobj shipped with DMD IIRC.
I think you refer to "obj2asm", that's not shipped with DMD.
Hmm, I could've sworn there was a tool for this shipped with the DMD tool chain... odd.
 (A -S (or -asm) switch for DMD would be quite nice and useful).
The trouble is that DMD assembles code in memory rather than deferring to an assembler...
 Bye,
 bearophile
-- Alex Rønne Petersen alex lycus.org http://lycus.org
May 18 2012
parent reply "Adam D. Ruppe" <destructionator gmail.com> writes:
On Friday, 18 May 2012 at 15:25:53 UTC, Alex Rønne Petersen 
wrote:
 Hmm, I could've sworn there was a tool for this shipped with 
 the DMD tool chain... odd.
The Linux folder of dmd has obj2asm, but the Windows version is part of Walter's $15 extended utilities package.
May 18 2012
parent =?UTF-8?B?QWxleCBSw7hubmUgUGV0ZXJzZW4=?= <alex lycus.org> writes:
On 18-05-2012 17:30, Adam D. Ruppe wrote:
 On Friday, 18 May 2012 at 15:25:53 UTC, Alex Rønne Petersen wrote:
 Hmm, I could've sworn there was a tool for this shipped with the DMD
 tool chain... odd.
The Linux folder of dmd has obj2asm, but the Windows version is part of Walter's $15 extended utilities package.
Well, there's always $INSERT_RANDOM_FREE_DISASSEMBLER then, I guess. -- Alex Rønne Petersen alex lycus.org http://lycus.org
May 18 2012
prev sibling parent "Sandeep Datta" <datta.sandeep gmail.com> writes:
Ok, I just saw this

http://stackoverflow.com/questions/3592587/digital-mars-d-compiler-acquiring-asm-output

But please do let me know if it is still relevant.
May 18 2012