计算机与现代化

• 软件工程 • 上一篇    下一篇

JavaScript静态切片工具

  

  1. (上海交通大学软件学院,上海 200240)
  • 收稿日期:2016-01-22 出版日期:2016-08-18 发布日期:2016-08-11
  • 作者简介:田生(1990-),男,天津人,上海交通大学软件学院硕士研究生,研究方向:程序分析与测试。

JavaScript Static Slicing Tool

  1. (School of Software, Shanghai Jiao Tong University, Shanghai 200240, China)
  • Received:2016-01-22 Online:2016-08-18 Published:2016-08-11

摘要: 程序切片是一种传统的程序分析方法:通过去掉无关代码,获取可能影响某行代码的子集。程序切片在程序理解、软件测试和程序调试等众多领域有着广泛的应用。随着互联网技术的发展,JavaScript语言得到广泛应用,但针对该语言的切片工具非常有限。本文针对JavaScript语言的特殊性,提出一种基于程序依赖图的JavaScript程序切片算法,并基于WALA程序分析框架实现了该切片算法。试验结果表明,本文的切片算法可以得到较为理想的切片结果。试验中切片平均大小约为原程序代码的70%,较手工切片仅有约19%冗余。

关键词: 程序切片, 静态分析, 程序调试

Abstract: Program slicing is a traditional decomposition technique in program analysis. Program slicing is aimed to get relative codes for some target by removing unrelated codes. Program slicing is widely used in many software engineering activities such as code understanding, software testing, and program debugging. As the development of network technology, JavaScript has been widely used. However, there are few slicing tools for JavaScript. This paper proposes an algorithm for slicing JavaScript programs based on program dependence graphs, which focuses on specific features of JavaScript language. This paper also discusses the implementation of the proposed algorithm by using WALA program analysis framework. The experimental result shows the effectiveness of the proposed algorithm in the sense that the slicing tool can generate slicing codes with 70% size of original code, and also only 19% larger than the slicing generated by hand writing.

Key words: program slicing, static analysis, program debugging

中图分类号: