@device(postscript) @libraryfile(Mathematics10) @libraryfile(Accents) @style(fontfamily=timesroman,fontscale=11) @pagefooting(immediate, left "@c", center "@c", right "@c") @heading(Source-Level Debugging of Globally Optimzed Code) @heading(CMU-CS-96-133) @center(@b(Ali-Reza Adl-Tabatabai)) @center(June 1996 - Ph.D. Thesis) @center(FTP: CMU-CS-96-133.ps) @blankspace(1) @begin(text,spread=.80) Compiler optimizations play a crucial role in the performance of modern computer systems. Debugger technology, however, has lagged behind in its support of optimizations. Debugging the unoptimized translation is often impractical, so handling of optimized code by the debugger is necessary. But compiler optimizations make it difficult to provide source-level debugger functionality: When a program is compiled with optimizations, mappings between breakpoints in the source and object code become complicated, and values of variables may be either inaccessible in the runtime state or inconsistent with what the user expects at a breakpoint. Although researchers and implementors have long acknowledged the need for source-level debugging of optimized code, compiler developers have generally avoided implementing this support. Designing a source-level debugger for globally optimized code remains an open problem. This dissertation presents techniques that enable accurate source-level debugging of fully optimized code. These techniques are demonstrated in the context of a compiler that performs a complete set of global scalar optimizations for commonly used source languages such as C. The techniques presented in this dissertation are non-invasive @y(M) that is, they do not constrain optimizations in any way and do not require instrumentation of the debugged program. All interactions between the debugger and the user are in terms of the original source text. In general, it is impossible to hide the effects of optimizations from the user and to provide the same interactions as in unoptimized code. The approach presented in this dissertation makes the effects of optimizations transparent whenever possible. Only when optimizations cannot be hidden from the user does the debugger inform the user of the effects of optimizations on the expected execution behavior of the program. This dissertation analyzes in detail the problems caused by scalar optimizations such as partial redundancy elimination, register allocation, instruction scheduling, and many others. This dissertation also presents the low-level algorithms necessary in the compiler and debugger to track the effects of optimizations, and discusses the limitations of the techniques. Finally, this dissertation presents measurements of how often a user is likely to be affected by optimizations during debugging. These measurements are based on an implementation of these techniques in the cmcc compiler, an optimizing C compiler developed as part of this dissertation. @blankspace(2line) @begin(transparent,size=10) @b(Keywords:@ )@c @end(transparent) @end(text) @flushright(@b[(192 pages)])