Re: g++ assembly output

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Yunnat wrote:

> I write in C++ and generate assembly output by g++ -S. Is it possible to
> annotate this output with the original C++ code? E.g. it would be nice to
> get sth like
> 
> % a++;
> inc ax;
> 
> or maybe
> 
> % main.cpp, line 6
> inc ax;

There was just a thread about this on the mailing list in the last few
weeks.  It started with
<http://gcc.gnu.org/ml/gcc-help/2006-11/msg00290.html>.

Note that using the -a assembler option does not work in conjuction with
-S because the assembler is not actually called, so you need to create
the listing as a side effect of compilation.  But that is all explained
in the above thread.

Alternatively, if you build with -g then you can use "objdump -dS
file.o" on any object in your build directory.  This has the advantage
of not having to modify the build with any special options.

Brian

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux