Debugging of Optimized Code

*
The debugging of optimized code using existing source level debuggers is difficult because it burdens the user with understanding how code transformations affect the source level program. This work proposes to develop a new approach to debugging optimized code through comparison checking. In this scheme, both the unoptimized and optimized versions of an application program execute. Values computed are compared to ensure that the execution behaviors of both program versions are the same under the given input. If values are different, the user determines if there is a bug in the application program. If so, a conventional debugger is used to debug the unoptimized code.

However, if the bug is in the optimized code, the user is told where in the application program the problem occurred and what optimizations are involved in producing the error. The user can then turn off those offending optimizations and leave the other optimizations in place. This work will design a tool to automatically perform the comparisons. Mappings will be developed to indicate what values must be checked. Annotations will be developed to indicate where comparisons must take place in the program executions. Since the comparisons will be performed automatically, the user will not be burdened with the need to understand code transformations. Furthermore, the optimized program version will not be modified to assist debugging.


Funded by Hewlett Packard Laboratories 01/96 - 12/98