A NEW APPROACH TO DEBUGGING OPTIMIZED CODE

A NEW APPROACH TO DEBUGGING OPTIMIZED CODE
复制标题

DOI:
10.1145/143103.143108
复制
发表时间:
1992-07-01
期刊:
SIGPLAN NOTICES
影响因子:
--
通讯作者:
SIMMONS, S
SIMMONS, S
中科院分区:
其他
文献类型:
--
作者:
BROOKS, G;HANSEN, GJ;SIMMONS, S

文献摘要

被引文献

相似文献

调试优化的代码是大多数当前调试器没有提供的理想功能。当优化版本中出现错误时,用户被迫调试未优化的代码。目前的研究为一小类优化提供了部分解决方案,但没有一个统一的方法来处理广泛的优化,如超级计算机编译器执行的复杂优化。当前研究的趋势是使优化的效果透明,即提供与未优化程序相同的行为。我们认为,这种方法既不完全可行,也不完全可取。相反,我们提出了一种新的方法,其前提是应该能够调试优化的代码。这意味着将当前执行状态映射回原始源,跟踪变量的位置,并将编译器合成的变量映射回用户定义的归纳变量。为了帮助用户理解程序行为,提供了各种视觉手段,例如,对源代码/汇编代码进行不同形式的突出显示和注释。虽然这不可避免地需要用户对所执行的优化有一个基本的了解,但它允许用户查看实际发生的情况、推断所执行的优化并检测错误。一个例子说明了可视化反馈的有效性。为了支持优化代码的传统调试器功能,编译器必须生成附加信息。当前的编译器-调试器接口(CDI)既不是为处理这些新信息而设计的,也不能以直接的方式进行扩展。因此,设计了一种新的CDI,它支持提供可视化反馈和优化代码的调试。本文详细介绍了新的CDI,并将每个功能与其支持的调试器功能联系起来。
Debugging optimized code is a desirable capability not provided by most current debuggers. Users are forced to debug the unoptimized code when a bug occurs in the optimized version. Current research offers partial solutions for a small class of optimizations, but not a unified approach that handles a wide range of optimizations, such as the sophisticated optimizations performed by supercomputer compilers.The trend with current research is to make the effects of optimization transparent, i.e., provide the same behavior as that of the unoptimized program. We contend that this approach is neither totally feasible nor entirely desirable. Instead, we propose a new approach based on the premise that one should be able to debug the optimized code. This implies mapping the current state of execution back to the original source, tracking the location of variables, and mapping compiler-synthesized variables back to user-defined induction variables. To aid the user in understanding program behavior, various visual means are provided, e.g., different forms of highlighting and annotating of the source/assembly code. While this unavoidably requires the user to have a basic understanding of the optimizations performed, it permits the user to see what is actually happening, infer the optimizations performed, and detect bugs. An example illustrates the effectiveness of visual feedback.To support conventional debugger functionality for optimized code, the compiler must generate additional information. Current compiler-debugger interfaces (CDIs) were neither designed to handle this new information nor are they extensible in a straight forward manner. Therefore, a new CDI was designed that supports providing visual feedback and the debugging of optimized code. This paper specifies the details of a new CDI and relates each feature back to the debugger functionality it supports.