How to view compiled code?

  • Thread starter Thread starter Bolin
  • Start date Start date
B

Bolin

I am compiling standard C++ code into native binary code, and I would
like to have a look at the binary code generated by the compiler in
Release mode. How to do that under .NET 2003?

Thanks!

B
 
Bolin said:
I am compiling standard C++ code into native binary code, and I would
like to have a look at the binary code generated by the compiler in
Release mode. How to do that under .NET 2003?

This link describes the /FA (file - assembly) compiler option:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/_core_.2f.fa.asp

If you want to inspect the machine code at runtime then from the Debug menu
choose Windows and then Disassembly. In that view the IDE does the right
thing, i.e. single step means single machine instruction step.

Regards,
Will
 
Thanks for your answer. The /FA option indeed provides the information
I want. Does the IDE propose a way to navigate through it though? The
main issue here is to jump to the corresponding piece of code each
time a function is called. The disassembly proposed by the Debug menu
works just great, but just for Debug, and here I want to look
exclusively at the Release. Any ideas?

Thanks

B.
 
Bolin said:
Thanks for your answer. The /FA option indeed provides the information
I want. Does the IDE propose a way to navigate through it though? The
main issue here is to jump to the corresponding piece of code each
time a function is called. The disassembly proposed by the Debug menu
works just great, but just for Debug, and here I want to look
exclusively at the Release. Any ideas?

It works for release builds as well. You may want to enable debug info for
your release configuration (it's enabled by default in VC7 and later).

-cd
 
Bolin said:
Thanks for your answer.

You are welcome.
The disassembly proposed by the Debug menu
works just great, but just for Debug, and here I want to look
exclusively at the Release. Any ideas?

Yeah, debug the Release version. :-)

A release version can be set to generate an external debug file (.pdb)
("program database" file). You should be able to set a breakpoint at the
entry to whatever function troubles you. A "problem" here is that
optimizations and inlining cause the generated code to differ markedly from
the written code. Now that's what one wants in a release build but it does
make debugging the release build a more trying experience. :-(

Regards,
Will
 
Back
Top