DOC PREVIEW
CMU CS 15745 - Source-Level Debugging of Scalar Optimized Code

This preview shows page 1-2-3-4 out of 11 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 11 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 11 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 11 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 11 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 11 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Source-Level Debugging of Scalar Optimized CodeAli-Reza Adl-Tabatabai* and Thomas Grossl’21School of Computer Science21nstitut fur Computer SystemeCarnegie Mellon University ETH ZiirichPittsburgh, PA 15213 CH 8092 ZurichAbstractAlthough compiler optimizations play a crucial role in theperformance of modern computer systems, debugger tech-nology has lagged behind in its support of optimization,, Yetdebugging the unoptimized translation is often impossibleor futile, so handling of code optimizations in the debuggeris necessary. But compiler optirnizations make it difficultto provide source-level debugger functionality: Global op-timization can cause the runtime value of a variable to beinconsistent with the source-level value expected at a break-point; such variables are called endangered variables. A, de-bugger must detect and warn the user of endangered variablesotherwise the user may draw incorrect conclusions about theprogram. This paper presents a new algorithm for detectingvariables that are endangered due to global scalar optimiza-tion. Our approach provides more precise classifications ofvariables and is still simpler than past approaches. We haveimplemented and evaluated our techniques in the context ofthe cmcc optimizing C compiler. We describe the compilerextensions necessary to perform the required bookkeepingof compiler optimization. We present measurements of theeffect of optimizations on a debugger’s ability to present theexpected values of variables to the user.1 IntroductionDesigning a source-level debugger for globally optimizedcode is still an open problem and users must choose be-tween debugging or optimization, Compiler implementorsThis research was sponsored in part by the Advanced Research ProjectsAgency/ITO monitored by SPAWAR under contract NO0039-93-C-0152 andin part by donations from Intel Corp. and Motorola Inc.Permission to make digitalhrd copy of part or all of this work for petsonalor classroom use is ranted without fee provided that copies are not made#or distributed for pro t or commercial advanta e, the copyfight notice, theJtitle of the publication and its date appear, an notice is given thatorrpying is by permission of ACM, Inc. To copy otherwise, to republish, topost on servers, or to redistribute to lists, requires prior specific permissionand/or a fee.PLDI ’96 5/96 PA, USA@ 1998 ACM 0-89791 -7954YWO005...$ 505Ohave generally avoided supporting the debugging of opti-mized code in the past, although some systems provide de-bugger mechanics without warranties for the “debugging” ofoptimized code. To cite from the description of the optionsin the C manual of a major Unix vendor:-g3 Have the compiler produce additional symboltable information for fall symbolic debugging for fullyoptimized code. This option makes the debugger inac-curate.For non-Unix systems, the situation is no better (to give anexample from the PC/Macintosh world):Enable Debugging turns off all optirnizations.When the compiler optimizes it sometimes rearrangesobject code so that it does not correspond exactly tothe source code. This rearrangement may confuse thedebugger’s source code view.A source-level debugger must solve two types of prob-lems: First, the debugger must map a source statement to aninstruction in the object code to set a breakpoint and map aninstruction to the source code to report a fault or user inter-rupt (codelocation problems [26]). Second, the debuggermust retrieve and display the values of source variables in amanner consistent with what the user expects with respect tothe source statement where execution has halted(data-valueproblems [26]). When a program has been compiled withoptirnizations, mappings between breakpoints in the sourceand object code become complicated, and values of variablescan be inaccessible in the runtime state or inconsistent withwhat the user expects.This paper presents a solution to deal with the the data-value problems caused by optimizing compiler transforma-tions. Our focus are the global and localscalar optimizationthat are included in current state-of-the-art compilers. Thereare two novel aspects. First, we develop a unified modelof the data-value problem caused by global scalar optirniza-tions; Figure 1 sketches the questions that a debugger mustaddress. Then we present an approach based on data-flowanalysis to analyze and propagate the effects of optimizing33transformations. These algorithms have been implementedin an optimizing C compiler: the data-flow analysis requiredto support the debugger is similar to the data-flow analysisperformed for global optimization and in our compiler usesthe same modules. Compiler extensions are only necessaryto generate the information required to analyze the effectof optimizing transformations on the data-value problems.Moreover, our algorithms work on a single representation ofa program; this is in contrast to other approaches (e.g., [24])that keep around a copy of the original source program repre-sentation. Our paper concludes with an empirical evaluation;we report on measurements for the eight C programs of theSPEC92 suite.1.1 The data-value problemWe summarize here the terminology; for examples and mo-tivation we defer to the references.When global register allocation is performed, the registerassigned to a variableV may be shared with other variablesas well as temporaries. Thus at a breakpoint there may beno value ofV available; V is nonresident [3] if the value inthe register assigned toV may be the value of some vari-able other thanV. The debugger reports that the value of anonresident variableV is unavailable since the value in theregister assigned toV does not correspond to a meaningfulsource-level value ofV [3]. If at a breakpoint a variableV is resident, then the value in the runtime location of Vcorresponds to some source-level value of V. This value isreferred to as theactual value of V, while the value that theuser expectsV to have, based on the context of the sourcebreakpoint statement, is theexpected value of V. Since theactual value of a variableV is a source-level value of V, itis meaningful to display this value to the user. However, ifoptimizations have moved or eliminated assignment expres-sions, the actual value of a variableV may not correspondto the expected value ofV, in which case V is endangered[19, 13, 2]and additional information must be provided tothe user.There are two mutually exclusive classes of endangeredvariables:noncurrent variables and


View Full Document

CMU CS 15745 - Source-Level Debugging of Scalar Optimized Code

Documents in this Course
Lecture

Lecture

14 pages

Lecture

Lecture

19 pages

Lecture

Lecture

8 pages

Lecture

Lecture

5 pages

Lecture

Lecture

6 pages

lecture

lecture

17 pages

Lecture 3

Lecture 3

12 pages

Lecture

Lecture

17 pages

Lecture

Lecture

18 pages

lecture

lecture

14 pages

lecture

lecture

8 pages

lecture

lecture

5 pages

Lecture

Lecture

19 pages

lecture

lecture

10 pages

Lecture

Lecture

20 pages

Lecture

Lecture

8 pages

Lecture

Lecture

7 pages

lecture

lecture

59 pages

Lecture

Lecture

10 pages

Task 2

Task 2

2 pages

Handout

Handout

18 pages

Load more
Download Source-Level Debugging of Scalar Optimized Code
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Source-Level Debugging of Scalar Optimized Code and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Source-Level Debugging of Scalar Optimized Code 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?