arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2302.02343cs.SEcs.LGcs.PL
收藏

LExecutor:学习引导的执行

LExecutor: Learning-Guided Execution

University of Stuttgart(斯图加特大学)

Beatriz Souza, Michael Pradel

AI总结:

LExecutor利用神经模型预测缺失值,以欠约束方式执行任意代码片段,在开源和Stack Overflow代码上达到高覆盖率,显著优于直接执行。

摘要:

执行代码对于各种程序分析任务至关重要,例如检测通过异常表现出的缺陷或获取执行轨迹以进行进一步的动态分析。然而,在实践中执行任意代码片段通常很困难,例如由于缺少变量定义、缺少用户输入和缺少第三方依赖。本文提出了LExecutor,一种学习引导的方法,用于以欠约束的方式执行任意代码片段。关键思想是让神经模型预测那些否则会导致程序卡住的缺失值,并将这些值注入到执行中。例如,LExecutor为未定义的变量注入可能的值,并为缺失函数的调用注入可能的返回值。我们在来自流行开源项目的Python代码和从Stack Overflow提取的代码片段上评估了该方法。神经模型以79.5%至98.2%的准确率预测出逼真的值,使LExecutor能够紧密模拟真实执行。因此,该方法成功执行的代码量显著超过任何现有技术,例如直接执行代码。例如,直接执行开源代码片段仅覆盖所有行的4.1%,因为代码早期崩溃,而LExecutor实现了51.6%的覆盖率。

英文摘要:

Executing code is essential for various program analysis tasks, e.g., to detect bugs that manifest through exceptions or to obtain execution traces for further dynamic analysis. However, executing an arbitrary piece of code is often difficult in practice, e.g., because of missing variable definitions, missing user inputs, and missing third-party dependencies. This paper presents LExecutor, a learning-guided approach for executing arbitrary code snippets in an underconstrained way. The key idea is to let a neural model predict missing values that otherwise would cause the program to get stuck, and to inject these values into the execution. For example, LExecutor injects likely values for otherwise undefined variables and likely return values of calls to otherwise missing functions. We evaluate the approach on Python code from popular open-source projects and on code snippets extracted from Stack Overflow. The neural model predicts realistic values with an accuracy between 79.5% and 98.2%, allowing LExecutor to closely mimic real executions. As a result, the approach successfully executes significantly more code than any available technique, such as simply executing the code as-is. For example, executing the open-source code snippets as-is covers only 4.1% of all lines, because the code crashes early on, whereas LExecutor achieves a coverage of 51.6%.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑