Oracle® Solaris Studio 12.4: Debugging a Program With dbx

Exit Print View

Updated: January 2015
 
 

Debugging Optimized Code

dbx provides partial debugging support for optimized code. The extent of the support depends largely upon how you compiled the program.

    When analyzing optimized code, you can do the following:

  • Stop execution at the start of any function (stop in function command)

  • Evaluate, display, or modify arguments

  • Evaluate, display, or modify global, local, or static variables

  • Single-step from one line to another (next or step command)

When programs are compiled with optimization and debugging enabled at the same time (using the –O and –g options), dbx operates in a restricted mode.

The details about which compilers emit which kind of symbolic information under what circumstances is likely to change from release to release.

Source line information is available, but the code for one source line might appear in several different places for an optimized program, so stepping through a program by source line results in the current line being in different places in the source file, depending on how the code was scheduled by the optimizer.

Tail call optimization can result in missing stack frames when the last effective operation in a function is a call to another function.

For OpenMP programs, compiling with the –xopenmp=noopt option instructs the compiler not to apply any optimizations. However, the optimizer still processes the code in order to implement the OpenMP directives, so some of the problems described might occur in programs compiled with –xopenmp=noopt.