Using SoftBench Debugger
Debugging Optimized CodeDebugging Optimized Code
Optimization performs a series of transformations on the object code in order to make the program run faster. In effect, optimization transforms a program into a different program. The executable program you debug is actually not the same program as the source program. In addition, program variables may be stored in registers instead of memory and are therefore more difficult to access.
Ordinarily, you first compile and debug your program without optimization. All or nearly all of the bugs in your program show up in the unoptimized version. After eliminating all the bugs that you can find, turn on optimization (compile with
•Uninitialized variables
•
•Variable references based on the assumption that two variables are adjacent in memory
SoftBench CodeAdvisor may assist you with some of these categories of problems. Others require more extensive code examination.
These kinds of problems, however, are often very difficult to find by examining the source code. If you cannot determine the reason for the program's misbehavior, you need to debug the optimized code. For tutorial and
Chapter 7 | 227 |