LExecutor: Learning-Guided Execution

要約

コードの実行は、例外を通じて現れるバグを検出したり、さらなる動的分析のために実行トレースを取得したりするなど、さまざまなプログラム分析タスクに不可欠です。
ただし、変数定義の欠落、ユーザー入力の欠落、サードパーティの依存関係の欠落などにより、コードの任意の部分を実行することは実際には困難なことがよくあります。
このペーパーでは、制約の少ない方法で任意のコード スニペットを実行するための学習ガイド付きアプローチである 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%.

arxiv情報

著者 Beatriz Souza,Michael Pradel
発行日 2023-11-10 15:30:15+00:00
arxivサイト arxiv_id(pdf)

提供元, 利用サービス

arxiv.jp, Google

カテゴリー: cs.LG, cs.PL, cs.SE パーマリンク