A Practical, Robust Method for Generating Variable Range Tables
In optimized programs the location in which the current value of a single source variable may reside typically varies as the computation progresses. A debugger for optimized code needs to know all of the locations — both registers and memory addresses — in which a variable resides, and which locations are valid for which portions of the computation. Determining this information is known as the data location problem. Because optimizations frequently move variables around (between registers and memory or from one register to another) the compiler must build a table to keep track of this information. Such a table is known as a variable range table. Once a variable range table has been constructed, finding a variable’s current location reduces to the simple task of looking up the appropriate entry in the table.
The difficulty lies in collecting the data for building the table. Previous methods for collecting this data depend on which optimizations the compiler performs and how those optimizations are implemented. In these methods the code for collecting the variable location data is distributed throughout the optimizer code, and is therefore easy to break and hard to fix. This paper presents a different approach. By taking advantage of key instructions, our approach allows the collection of all of the variable location data in a single dataflow-analysis pass over the program. This approach results in code for collecting the variable location information that is easier to maintain than previous approaches and that is almost entirely independent of which optimizations the compiler performs and of how the optimizations are implemented.
- 1.A. Adl-Tabatabai and T. Gross, “Evicted Variables and the Interaction of Global Register Allocation and Symbolic Debugging”, Conference Record of the Twentieth Annual ACM Symposium on Principles of Programming Languages, January 1993, pp. 371–383Google Scholar
- 2.A. Aho, R. Sethi, and J. Ullman, “Compilers Principles, Techniques, and Tools”, Addison-Wesley Publishing Company, 1986Google Scholar
- 3.D. Coutant, S. Meloy, and M. Ruscetta, “DOC: A Practical Approach to Source-Level Debugging of Globally Optimized Code”, In Proceedings of the 1988 PLDI Conference, 1988Google Scholar
- 4.J. Silverstein, ed., “DWARF Debugging Information Format”, Proposed Standard, UNIX International Programming Languages Special Interest Group, July 1993Google Scholar
- 5.C. Tice and S. L. Graham, “Key Instructions: Solving the Code Location Problem for Optimized Code”, Research Report 164, Compaq Systems Research Center, Palo Alto, CA, Sept. 2000Google Scholar
- 6.C. Tice, “Non-Transparent Debugging of Optimized Code”, Ph.D. Dissertation, Technical Report UCB//CSD-99-1077, University of California, Berkeley, Oct. 1999.Google Scholar
- 7.P. Zellweger, “High Level Debugging of Optimized Code”, Ph.D. Dissertation, University of California, Berkeley, Xerox PARC TR CSL-84-5, May 1984.Google Scholar