Electrical Engineering
      and Computer Sciences

Electrical Engineering and Computer Sciences

COLLEGE OF ENGINEERING

UC Berkeley

Non-Transparent Debugging of Optimized Code

Caroline Mae Tice

EECS Department
University of California, Berkeley
Technical Report No. UCB/CSD-99-1077
November 1999

http://www.eecs.berkeley.edu/Pubs/TechRpts/1999/CSD-99-1077.pdf

Debugging optimized code is a problem for which a widely accepted solution has yet to be found. Over the years many approaches have been suggested, including limiting the compiler optimizations, restricting the debugger functionality, using recompilation or dynamic de-optimization to undo the optimizations, and having the debugger determine the effects of optimizations and mask them from the user. All of these approaches have a common thread: they place a barrier between the user and the optimizations, either altering, undoing, or hiding the effects of optimizations.

This work presents a completely different approach. By allowing users to see some of the effects of optimizations, many of the problems traditionally associated with debugging optimized code are either simplified or eliminated. The basic idea is to generate an optimized version of the source program, which accurately reflects the effects of the compiler optimizations. The user and the debugger then communicate via this optimized source program.

The theoretical issues involved in generating optimized source code, as well as the compiler support necessary for debugging optimized code are presented in this work. It also explores options for displaying the optimized source program to the user in the most useful, least confusing manner. It introduces the concept of key instructions and shows how they are critical for simplifying determining current variable locations within the executable, and mapping accurately between binary instructions and statements in the optimized source program. It also presents a pioneering approach for eviction recovery within the debugger.

These ideas have been fully implemented in Optview and Optdbx, which are described in this dissertation. Optview is a prototype tool that generates optimized source code for C programs. It is embedded within the SGI MIPS-Pro 7.2 C compiler. Optdbx is a modified version of the SGI dbx debugger, which makes use of the optimized source code. It contains the only known implementation of eviction recovery, and it has a simple graphical user interface for displaying the optimized source program to the user. Experiments on these systems have proven that this approach provides a simple, practical, complete solution to the difficult problem of debugging optimized code.

Advisor: Susan L. Graham


BibTeX citation:

@phdthesis{Tice:CSD-99-1077,
    Author = {Tice, Caroline Mae},
    Title = {Non-Transparent Debugging of Optimized Code},
    School = {EECS Department, University of California, Berkeley},
    Year = {1999},
    Month = {Nov},
    URL = {http://www.eecs.berkeley.edu/Pubs/TechRpts/1999/6232.html},
    Number = {UCB/CSD-99-1077},
    Abstract = {Debugging optimized code is a problem for which a widely accepted solution has yet to be found. Over the years many approaches have been suggested, including limiting the compiler optimizations, restricting the debugger functionality, using recompilation or dynamic de-optimization to undo the optimizations, and having the debugger determine the effects of optimizations and mask them from the user. All of these approaches have a common thread: they place a barrier between the user and the optimizations, either altering, undoing, or hiding the effects of optimizations. <p>This work presents a completely different approach. By allowing users to see some of the effects of optimizations, many of the problems traditionally associated with debugging optimized code are either simplified or eliminated. The basic idea is to generate an optimized version of the source program, which accurately reflects the effects of the compiler optimizations. The user and the debugger then communicate via this optimized source program. <p>The theoretical issues involved in generating optimized source code, as well as the compiler support necessary for debugging optimized code are presented in this work. It also explores options for displaying the optimized source program to the user in the most useful, least confusing manner. It introduces the concept of key instructions and shows how they are critical for simplifying determining current variable locations within the executable, and mapping accurately between binary instructions and statements in the optimized source program. It also presents a pioneering approach for eviction recovery within the debugger. <p>These ideas have been fully implemented in Optview and Optdbx, which are described in this dissertation. Optview is a prototype tool that generates optimized source code for C programs. It is embedded within the SGI MIPS-Pro 7.2 C compiler. Optdbx is a modified version of the SGI dbx debugger, which makes use of the optimized source code. It contains the only known implementation of eviction recovery, and it has a simple graphical user interface for displaying the optimized source program to the user. Experiments on these systems have proven that this approach provides a simple, practical, complete solution to the difficult problem of debugging optimized code.}
}

EndNote citation:

%0 Thesis
%A Tice, Caroline Mae
%T Non-Transparent Debugging of Optimized Code
%I EECS Department, University of California, Berkeley
%D 1999
%@ UCB/CSD-99-1077
%U http://www.eecs.berkeley.edu/Pubs/TechRpts/1999/6232.html
%F Tice:CSD-99-1077