Debugging optimized code without being misled

Debugging optimized code without being misled
复制标题

调试优化代码而不被误导

DOI:
--
复制
发表时间:
1993
期刊:
TOPL
影响因子:
--
通讯作者:
M. Copperman
M. Copperman
中科院分区:
--
文献类型:
--
作者:
M. Copperman

文献摘要

被引文献

相似文献

正确的优化可以改变不正确程序的行为;因此有时需要调试优化的代码。然而,优化编译器生成的代码会阻碍源代码级调试。 优化可能会导致用户期望的断点位置与断点的实际位置不一致。本文介绍了语句和断点位置之间的映射,以改善此问题。该映射使优化代码上的调试器行为能够充分接近未优化代码上的调试器行为,以便用户使用传统的调试策略。 优化还可能导致变量的值不是当前的,与仔细阅读源代码所预测的值不同。本文介绍了一种确定何时发生这种情况的方法,并展示了调试器如何描述优化的相关效果。该测定方法比以前公布的方法更通用;它处理全局优化和许多流程图转换,并且与特定编译器执行的优化并不紧密耦合。还描述了必要的编译器支持。
Correct optimization can change the behavior of an incorrect program; therefore at times it is necessary to debug optimized code. However, optimizing compilers produce code that impedes source-level debugging. Optimization can cause an inconsistency between where the user expects a breakpoint to be located and the breakpoint's actual location. This article describes a mapping between statements and breakpoint locations that ameliorates this problem. The mapping enables debugger behavior on optimized code that approximates debugger behavior on unoptimized code sufficiently closely for the user to use traditional debugging strategies. Optimization can also cause the value of a variable to be noncurrent—to differ from the value that would be predicted by a close reading of the source code. This article presents a method of determining when this has occurred, and shows how a debugger can describe the relevant effects of optimization. The determination method is more general than previously published methods; it handles global optimization and many flow graph transformations, and it is not tightly coupled to optimizations performed by a particular compiler. Necessary compiler support is also described.