Thread overview
DMD/Windows: Inspect generated ASM?
Apr 08, 2012
Stefan
Apr 08, 2012
dennis luehring
Apr 08, 2012
Andrej Mitrovic
Apr 08, 2012
Stefan
Apr 08, 2012
bearophile
Apr 08, 2012
Stefan
April 08, 2012
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
April 08, 2012
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

April 08, 2012
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.
April 08, 2012
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
April 08, 2012
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
April 08, 2012
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