动态切片工具 javaslicer【2】

本文介绍了一项基于熊英飞的研究,通过JavaSlicer动态切片工具进行故障定位,针对单次和多失败测试采用不同的策略,如并集、交集和频率。以Lang-61项目为例,详细步骤包括环境配置、项目准备、生成跟踪文件及执行切片分析,结果显示切片能有效缩小可疑代码范围。

前文 简单介绍了项目,根据熊英飞的这篇 An Empirical Study of Fault Localization Families and Their Combinations 开展实验。

Our experiments use the JavaSlicer dynamic slicing tool. JavaSlicer is based on the dynamic slicing algorithm of Wang and Roychoudhury, with extensions for object-oriented programs. The JavaSlicer implementation attaches to the program as a Java agent and re-writes classes as they are loaded into the Java VM.

A test fails by throwing an exception, either because of a violated assertion or a runtime crash. If there is only a single failed test, we use the execution of the statement that throws the exception as the slicing criterion. The slice then contains all statements that may have affected the statement that throws the exception.

If there are multiple failed tests, our experiments apply three strategies from a previous study to utilize multiple slices: union, intersection, and frequency . The first two strategies calculate the union or the intersection of the slices and report a set of statements as results. The frequency strategy calculates the inclusion frequency for each statement and reports a ranked list of statements based on the frequency. The more frequently a statement is included in the slice of a failed test, the more suspicious the statement is.

简单来说:单个失败测试,使用抛出异常的语句的执行作为切片准则。多个失败测试,采用并集、交集和频率的策略。

1.实验环境搭建

使用 b046ed3 的 Master 分支,运行环境与说明一致:

> ubuntu@VM-0-8-ubuntu:~$ javac -version
javac 1.6.0_20
> ubuntu@VM-0-8-ubuntu:~$ mvn -version
Apache Maven 2.2.0 (r788681; 2009-06-26 21:04:01+0800)

执行 assemble.sh,报错 Plugin requires Maven version 2.2.1

配置换成 javac 1.8.0_281 / Apache Maven 3.3.9 则可以正常使用。

搭建 Defect4J 环境的相关内容不再赘述。

2.项目准备工作

以 Lang-61 为例,首先执行 Checkout:

defects4j checkout -p Lang -v 61b -w /home/ubuntu/lang_61_buggy
评论 5
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值