一句话:提出跨层次调试(CLD),比较同一可执行文件在源码级与指令级调试下的轨迹,以验证调试器工具链。
调试器工具链的正确性至关重要,但其测试长期缺乏有效预言。现有工作比较优化与未优化可执行文件的调试轨迹来验证调试信息,然而编译器优化会改变源码元素、变量表示与指令顺序,使不同可执行文件的轨迹不可比,也无法发现调试未优化程序时工具链自身的缺陷。本文提出跨层次调试(CLD):在同一调试器内对同一可执行文件分别用源码级与指令级策略调试,并比较所得轨迹。作者形式化三条跨层次关系:程序位置可达性保持、可达位置顺序保持、程序位置处的值一致性,并实现框架 Devil。在 GDB 与 LLDB 上评估,Devil 提交 27 个新缺陷报告,18 个确认、12 个已修复。
Ensuring the correctness of debugger toolchains is of paramount importance, as they play a vital role in understanding and resolving programming errors during software development. Bugs hidden within these toolchains can significantly mislead developers. Unfortunately, comprehensive testing of debugger toolchains is lacking due to the absence of effective test oracles. Existing studies on debugger toolchain validation have primarily focused on validating the debug information within optimized executables by comparing the traces between debugging optimized and unoptimized executables (i.e., different executables) in the debugger, under the assumption that the traces obtained from debugging unoptimized executables serve as a reliable oracle. However, these techniques suffer from inherent limitations, as compiler optimizations can drastically alter source code elements, variable representations, and instruction order, rendering the traces obtained from debugging different executables incomparable and failing to uncover bugs in debugger toolchains when debugging unoptimized executables. To address these limitations, we propose a novel concept called Cross-Level Debugging (CLD) for validating the debugger toolchain. CLD compares the traces obtained from debugging the same executable using source-level and instruction-level strategies within the same debugger. The core insight of CLD is that the execution traces obtained from different debugging levels for the same executable should adhere to specific relationships, regardless of whether the executable is generated with or without optimization. We formulate three key relations in CLD: reachability preservation of program locations, order preservation for reachable program locations, and value consistency at program locations, which apply to traces at different debugging levels. We implement Devil, a practical framework that employs these relations for debugger toolchain validation. We evaluate the effectiveness of Devil using two widely used production debugger toolchains, GDB and LLDB. Ultimately, Devil successfully identified 27 new bug reports, of which 18 have been confirmed and 12 have been fixed by developers.