程序插桩技术是一种基本的测试手段,在软件测试中被广泛的应用。插装方式是指在程序源码中插入一些语句,通过这些语句可以获得所需要的信息,在死锁规避的静态分析中需要通过程序插桩的方式记录下一些信息。程序插桩按照源程序的结构分为顺序结构的插桩,分支结构的插桩和循环结构的插桩。在对源程序进行词法语法分析的基础上建立抽象语法树和控制流图,根据控制流图获取程序可能执行的所有路径信息,接着根据路径信息决定插桩的内容。
The instrumentation of the program is a basic test method,which is widely used in software testing. In instrumentation method is to insert some of the statements in the program source code,the required information is available through these statements,in static analysis of the deadlock avoidance through program instrumentation some information needs to be recorded. Procedures for the insertion into the structure of the source code structure is divided into the order of the structure of the insert,the branch structure of the insert and the structure of the loop. In this paper,on the basis of the lexical and syntax analysis of the source program to establish abstract syntax tree and control flow graph,according to the control flow graph to obtain the program may perform all path information,then according to the route information to decide the inserted content.