www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - DMD/Windows: Inspect generated ASM?

reply "Stefan" <stefan schuerger.com> writes:
Hi all,

Which is the most convenient way to have a look at the ASM code 
generated by Win-dmd? Unlike gdc, dmd it has no -S option, so I 
guess I will have to disassemble .obj files.

Any good tools for this (link)? So far I only found old .obj 
tools from the 90s on the web...

Thanks,

Stefan
Apr 08 2012
next sibling parent dennis luehring <dl.soluz gmx.net> writes:
ida 5.0 freeware

http://www.hex-rays.com/products/ida/support/download_freeware.shtml

Am 08.04.2012 14:42, schrieb Stefan:
 Hi all,

 Which is the most convenient way to have a look at the ASM code
 generated by Win-dmd? Unlike gdc, dmd it has no -S option, so I
 guess I will have to disassemble .obj files.

 Any good tools for this (link)? So far I only found old .obj
 tools from the 90s on the web...

 Thanks,

 Stefan

Apr 08 2012
prev sibling next sibling parent Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
On 4/8/12, Stefan <stefan schuerger.com> wrote:
 Any good tools for this (link)? So far I only found old .obj
 tools from the 90s on the web...

I use objconv. http://www.agner.org/optimize/#objconv I use this batch script to disasm an .obj file and open the .asm file: echo off setlocal EnableDelayedExpansion objconv -fnasm %~nx1 %~n1_disasm.asm && %~n1_disasm.asm I forgot by now just how those %~ thingies work. Windows batch is a funny language.
Apr 08 2012
prev sibling next sibling parent "bearophile" <bearophileHUGS lycos.com> writes:
Stefan:

 Unlike gdc, dmd it has no -S option,

I'd like that. This seems a nice enhancement request for you to add in Bugzilla. Bye, bearophile
Apr 08 2012
prev sibling next sibling parent "Stefan" <stefan schuerger.com> writes:
On Sunday, 8 April 2012 at 15:43:23 UTC, bearophile wrote:
 I'd like that. This seems a nice enhancement request for you to 
 add in Bugzilla.

Yup, sometimes you want to look "under the hood" of the compiler to tweak things a little. Or just to understand how a 64bit multiplication works on a IA32 machine :-) I wonder, though, if the dmd backend has a "real" ASM stage, or if some intermediate code is directly translated into an opcode stream (like the RTL stuff in the GCC backend). Cheers, Stefan
Apr 08 2012
prev sibling parent "Stefan" <stefan schuerger.com> writes:
On Sunday, 8 April 2012 at 13:56:30 UTC, Andrej Mitrovic wrote:

 I forgot by now just how those %~ thingies work. Windows batch 
 is a
 funny language.

That's why I love cygwin, no funny percent stuff there ;-) Cheers, Stefan
Apr 08 2012