Almost all modern production software is compiled with optimization.
Debugging optimized code is a desirable functionality.
For example,
developers usually perform post-mortem debugging on the coredumps produced by
software crashes.
Designing reliable debugging techniques for optimized code
has been well-studied in the past.
However, little is known about the correctness of the debug information generated by optimizing compilers when debugging optimized code.
Optimizing compilers emit debug information (e.g., DWARF information) to support
source code debuggers.
Wrong debug information causes debuggers to either
crash or to display
wrong variable values.
Existing debugger validation techniques only focus on testing the interactive aspect of
debuggers for dynamic languages (i.e., with unoptimized code).
Validating debug information for optimized code raises some unique
challenges:
(1)
many breakpoints cannot be reached by debuggers due to
code optimization; and (2)
inspecting some arbitrary variables such as uninitialized variables introduces undefined
behaviors.
This paper presents the first generic framework for systematically testing debug information with
optimized code.
We introduce a novel concept called \emph{actionable program}.
An actionable program $P_{\langle s,
v\rangle}$ contains a program location $s$ and a
variable $v$ to inspect.
Our key insight is that
in both the unoptimized program $P_{\langle s,v\rangle}$ and the optimized program $P^\prime_{\langle s,v\rangle}$,
debuggers should be able to stop at the program location $s$ and inspect the value of the variable $v$ without any undefined behaviors.
Our framework generates actionable programs and does systematic testing by comparing the
debugger output of $P^\prime_{\langle s,
v\rangle}$ and the actual value of $v$ at line $s$ in $P_{\langle s, v\rangle}$.
We have applied our framework to two mainstream optimizing C
compilers (i.e., GCC and LLVM).
Our framework
has led to 47 confirmed bug reports, 11 of which have already been fixed.
Moreover, in three days, our technique has found 2 confirmed bugs in the Rust
compiler. The results have demonstrated the effectiveness and generality of our framework.
Fri 19 JunDisplayed time zone: Pacific Time (US & Canada) change
06:20 - 07:40 | Parsing, Debugging, and Code SearchPLDI Research Papers at PLDI Research Papers live stream Chair(s): Dan Barowy Williams College | ||
06:20 20mTalk | Faster General Parsing through Context-Free Memoization PLDI Research Papers Grzegorz Herman Jagiellonian University, Poland | ||
06:40 20mTalk | Zippy LL(1) Parsing with Derivatives PLDI Research Papers | ||
07:00 20mTalk | Debug Information Validation for Optimized Code PLDI Research Papers Yuanbo Li Georgia Institute of Technology, USA, Shuo Ding Georgia Institute of Technology, USA, Qirun Zhang Georgia Institute of Technology, USA, Davide Italiano Apple, USA | ||
07:20 20mTalk | Semantic Code Search via Equational Reasoning PLDI Research Papers Varot Premtoon Massachusetts Institute of Technology, USA, James Koppel Massachusetts Institute of Technology, USA, Armando Solar-Lezama Massachusetts Institute of Technology, USA |