一句话:提出工具 PReach,用分支选择率、依赖分析、抽象解释与马尔可夫链启发式近似程序语句可达概率,识别难达语句。
识别难达语句对软件测试与验证很重要,但精确计算可达概率代价高。PReach 提出启发式概率可达性分析:用模型计数计算分支选择性,即满足分支条件的取值比例;用依赖分析找出影响可达性的输入相关分支条件;用抽象解释确定到达分支的取值集合;并构建离散时间马尔可夫链,结合控制流与分支选择性来近似到达目标语句的概率。作者在软件验证与测试竞赛、Apache Commons Lang 和 DARPA STAC 基准上评估,表明 PReach 能高精度识别难达语句。与概率符号执行和统计符号执行相比,PReach 在有界执行深度下精度相当,在无界深度且路径指数增长时精度和准确率更好,且可扩展性更强。
We present a heuristic for approximating the likelihood of reaching a given program statement using 1) branch selectivity (representing the percentage of values that satisfy a branch condition), which we compute using model counting, 2) dependency analysis, which we use to identify input-dependent branch conditions that influence statement reachability, 3) abstract interpretation, which we use to identify the set of values that reach a branch condition, and 4) a discrete-time Markov chain model, which we construct to capture the control flow structure of the program together with the selectivity of each branch. Our experiments indicate that our heuristic-based probabilistic reachability analysis tool PReach can identify hard to reach statements with high precision and accuracy in benchmarks from software verification and testing competitions, Apache Commons Lang, and the DARPA STAC program. We provide a detailed comparison with probabilistic symbolic execution and statistical symbolic execution for the purpose of identifying hard to reach statements. PREACH achieves comparable precision and accuracy to both probabilistic and statistical symbolic execution for bounded execution depth and better precision and accuracy when execution depth is unbounded and the number of program paths grows exponentially. Moreover, PReach is more scalable than both probabilistic and statistical symbolic execution.