arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2212.11077cs.SE
收藏

用运行时信息增强代码差异

Augmenting Diffs With Runtime Information

Khashayar Etemadi, Aman Sharma, Fernanda Madeiral, Martin Monperrus

AI总结:

提出Collector-Sahab工具,利用运行时差异信息增强代码差异,在Defects4J的584个差异中成功增强95%,用户研究显示其有用性。

摘要:

源代码差异(diff)在日常的代码审查、检查和审计中被广泛使用。为了便于理解,这些差异通常伴随着描述程序变更本质的解释。由于手动编写高质量的解释是一项繁琐的任务,研究人员提出了自动生成代码差异解释的技术。现有的解释生成方法仅专注于静态分析,即它们不利用运行时信息来解释代码变更。在本文中,我们提出了Collector-Sahab,一种新颖的工具,它用运行时差异信息增强代码差异。Collector-Sahab比较程序原始(旧)版本和修补(新)版本的程序状态,以找到独特的变量值。然后,Collector-Sahab将此新颖的运行时信息添加到源代码差异中,例如在代码审查系统中所示。作为评估,我们在Defects4J错误的584个代码差异上运行Collector-Sahab,发现它成功地为其中95%(555/584)的代码差异进行了增强。我们还进行了一项用户研究,邀请八名参与者对Collector-Sahab生成的增强代码差异进行评分。根据这项用户研究,我们得出结论,开发人员认为将运行时数据添加到代码差异中的想法是有前景且有用的。总的来说,我们的实验证明了Collector-Sahab在增强代码差异与运行时差异信息方面的有效性和实用性。公开可用的仓库:https://github.com/ASSERT-KTH/collector-sahab。

英文摘要:

Source code diffs are used on a daily basis as part of code review, inspection, and auditing. To facilitate understanding, they are typically accompanied by explanations that describe the essence of what is changed in the program. As manually crafting high-quality explanations is a cumbersome task, researchers have proposed automatic techniques to generate code diff explanations. Existing explanation generation methods solely focus on static analysis, i.e., they do not take advantage of runtime information to explain code changes. In this paper, we propose Collector-Sahab, a novel tool that augments code diffs with runtime difference information. Collector-Sahab compares the program states of the original (old) and patched (new) versions of a program to find unique variable values. Then, Collector-Sahab adds this novel runtime information to the source code diff as shown, for instance, in code reviewing systems. As an evaluation, we run Collector-Sahab on 584 code diffs for Defects4J bugs and find it successfully augments the code diff for 95% (555/584) of them. We also perform a user study and ask eight participants to score the augmented code diffs generated by Collector-Sahab. Per this user study, we conclude that developers find the idea of adding runtime data to code diffs promising and useful. Overall, our experiments show the effectiveness and usefulness of Collector-Sahab in augmenting code diffs with runtime difference information. Publicly-available repository: https://github.com/ASSERT-KTH/collector-sahab.

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

↑