针对当前缺乏汇编代码自动化审查工具的情况,对汇编代码人工审查方法进行研究,提出了一种基于静态分析的汇编代码缺陷检测方法.该方法中,在控制流线性化后,运用特征识别处理间接寻址跳转,采用结点克隆处理延迟条件分支,使用调用序列处理存在递归函数的过程间控制流图的构造.在此基础上,实现了ADSP SHARC汇编代码检测工具,并进行了静态分析测试和缺陷检测测试.测试结果表明,该方法可以有效地检测汇编代码中的不可退出点、循环、寄存器、以及内存访问缺陷.
Aiming at the present situation that needs to develop a code review tool for assembly codes, this paper studies the procedure of manual code reviews and proposes a method to detect defects in assembly codes ~ based on static analysis. After the control flow linearization, compiler patterns are used to solve indirect jumps, and node cloning is used to recover the control flow of the delayed branch. In the construction of inter- procedural control flow graph, the reeursive function is in - lined by means of a call trace with limited depth. The prototyping tool for ADSP SHARC assembly codes is realized finally. Experimental results show that the tool can effectively detect defects in loops, registers, and memory accessing.