Generating assembly from dmd

H. S. Teoh hsteoh at quickfur.ath.cx
Sun Dec 22 07:15:26 PST 2013


On Sun, Dec 22, 2013 at 07:04:54AM -0800, H. S. Teoh wrote:
> On Sun, Dec 22, 2013 at 03:17:42PM +0100, Joseph Rushton Wakeling wrote:
> > Hi all,
> > 
> > Can someone walk me through in a friendly way how to check the
> > assembly produced by dmd?  The application in this case is checking
> > some new patches to Phobos. It's something I'm not familiar with
> > doing in general and particularly not with dmd (which doesn't seem
> > to have an assembly-output switch), so I'm hoping someone can advise
> > :-)
> [...]
> 
> This is what I do:
> 
> 	dmd -oprogram mod1.d mod2.d ...

Also, using the -g switch here may help, by including information that
lets objdump figure out which identifiers are being referenced by
hexadecimal addresses in the program (i.e., 'call
std.stdio.writeln+0x123' as opposed to 'call 0x123456').


> 	objdump -D program | ddemangle > program.asm
> 	vi program.asm
> 	# search for symbol, e.g., "writeln". Assuming ddemangle has
> 	# succesfully demangled the symbol you're looking for (sometimes
> 	# it doesn't), you can just search for it as-is.
[...]


T

-- 
The fact that anyone still uses AOL shows that even the presence of options doesn't stop some people from picking the pessimal one. - Mike Ellis


More information about the Digitalmars-d-learn mailing list