View mode: basic / threaded / horizontal-split · Log in · Help
April 08, 2012
DMD/Windows: Inspect generated ASM?
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
Re: DMD/Windows: Inspect generated ASM?
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
Re: DMD/Windows: Inspect generated ASM?
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
Re: DMD/Windows: Inspect generated ASM?
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
Re: DMD/Windows: Inspect generated ASM?
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
Re: DMD/Windows: Inspect generated ASM?
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
Top | Discussion index | About this forum | D home