Debugging Optimized Code

The debugger can help debug an optimized program that is compiled with the -g option. However, some of the information about the program may be inaccurate. In particular, the locations and values of variables are often not correctly reported, because the common forms of debug information do not fully represent the complexity of the optimizations provided by the -O1, -O2, -O3 and other optimization options.

To avoid this limitation, compile the program with an Intel® compiler, specifying both the -g and -debug extended options, in addition to the desired -O1, -O2 or -O3 optimization option. This causes the generation of more advanced, but less commonly supported debug information, which enables the following:

The following limitation exists:

Optimization often causes the instructions for a source line to be generated in an order that does not match the order of the source; the instructions for a line may be mixed in with instructions from other source lines as well. When stepping through such code, the program will tend not to stop at each source line in turn, but rather it will stop each time a change in source line occurs.

See Also


Submit feedback on this help topic

Copyright © 2001-2011, Intel Corporation. All rights reserved.