直接运行于微控制器上的中断驱动程序中可能存在一种重要的程序错误:数据竞争.然而当前主流的数据竞争静态检测技术因其服务于多线程模型程序而不适用.设计简明、易用的中断特征描述语言可以使得竞争检测具有平台无关性;同时,提出了一个流敏感的、上下文敏感的、考虑中断驱动程序原子性、易变性和部分随机性的数据竞争检测算法.该算法具有高效、精确的特点.实验表明,其检测时间与代码规模基本呈线性关系,分析17850行代码仅用时3.6s;同时,相比于基于锁集技术的典型数据竞争检测方法,其准确率平均是后者的2.13倍.
Interrupt-driven programs that run directly on the microcontrollers are ubiquitous in safety-critical areas. In these programs, data races, a class of critical errors, may occur. Using static race detection tools is an important way to find such bugs. Unfortunately, the state-of-art static race detection tools which only focus on multithread codes may be not helpful. In this paper, a new static race detection tool is designed for such programs. The tool is named Draco and implemented on top of Open64 compiler. It provides a simple and easy-to-use language that is used to annotate the programs with the interrupt-related features, so it can detect programs independent of running platforms. Moreover, it embodies a flow-sensitive and context-sensitive race detection algorithm that takes into account the atomicity, the flexibility and the partial randomicity of interrupt-driven programs. Because of adopting the program analysis techniques, Draco succeeds to detect the data races of interrupt-driven programs. It is efficient and precise. Experimental results show that the detecting time of Draco increases asymptotically linearly with the growth of code size, and it only takes 3.6s to detect 17850 lines of code. Moreover, the race detection accuracy rate on the average is 2.13 times as much as that of lockset based race detection algorithm.