Source-Level Debugging of Scalar Optimized Code

A. Adl-Tabatabai and T. Gross, "Source-Level Debugging of Scalar Optimized Code", Proc. ACM SIGPLAN Symp. on Programming Language Design and Implementation, May, 1996, 33-43.


Although compiler optimizations play a crucial role in the performance of modern computer systems, debugger technology has lagged behind in its support of optimizations. Yet debugging the unoptimized translation is often impossible or futile, so handling of code optimizations in the debugger is necessary. But compiler optimizations make it difficult to provide source-level debugger functionality: Global optimizations can cause the runtime value of a variable to be inconsistent with the source-level value expected at a breakpoint; such variables are called endangered variables. A debugger must detect and warn the user of endangered variables otherwise the user may draw incorrect conclusions about the program. This paper presents a new algorithm for detecting variables that are endangered due to global scalar optimizations. Our approach provides more precise classifications of variables and is still simpler than past approaches. We have implemented and evaluated our techniques in the context of the cmcc optimizing C compiler. We describe the compiler extensions necessary to perform the required bookkeeping of compiler optimizations. We present measurements of the effect of optimizations on a debugger's ability to present the expected values of variables to the user.