List-Files with GNU

Steven Bosscher stevenb@suse.de
Mon Oct 18 14:25:00 GMT 2004


On Oct 18, 2004 11:21 AM, Kukuk Barbara <barbara.kukuk@siemens.com> wrote:

> Hi,
> 
> I'd like to generate a file from a C source file where you
> can find the C code and the corresponding assembler statements.
> Is this possible with GNU?

I don´t think you can.

But even if you could, it would never be a very reliable dump if
you compile with optimizations enabled, because the optimizers are
free to completely reorder the code, hence the resulting assembly
may not even remotely resemble the original C source. Instructions
generated for one line of C may be scattered over several lines of
assembly output, intermixed with instructions for other statements
in your C source.

Ah, the fun of looking at assembly after scheduling and block
reordering!  Been there, done that, no T-shirt.  

With some effort, you may be able to match the line numbers of the
original C source with the assembly output, if you can read DWARF
and ELF :-)

Gr.
Steven




More information about the Gcc mailing list