Is it possible to convince GCC to emit an intermediate file which shows:
I'd rather see intermediate C/C++ instead of assembler, but I can use just assembler too if it's sufficiently annotated.
I am trying to reverse engineer a library composed almost entirely of macros in order to extend it. I'd also like to see the effects of optimization, in order to give the compiler more opportunities to do more optimization. (In other words, to see where my previous attempts have been ineffective)
GCC applies optimizations not in the C++-code directly but in some internal language-independant format (called GIMPLE) which cannot be reverted into C++ code that easily.
Depending on what you want, you can either
just expand macros: g++ -E
or look at an assembler output where you can see which line of C++ code maps to which assembler block:
g++ -g ... && objdump -S output
I don't recommend outputting assembler directly from gcc (with -S) as the generated annotations are almost useless.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With