计算机科学与探索 ›› 2014, Vol. 8 ›› Issue (6): 704-711.DOI: 10.3778/j.issn.1673-9418.1311024

• 系统软件与软件工程 • 上一篇    下一篇

采用C++代码插装的实时软件内存错误分析

李树芳+,陈  霞,安金霞,陈东升   

  1. 中国酒泉卫星发射中心,甘肃 酒泉 732750
  • 出版日期:2014-06-01 发布日期:2014-05-30

Real-Time Software Memory Error Analysis with C++ Code Instrumentation

LI Shufang+, CHEN Xia, AN Jinxia, CHEN Dongsheng   

  1. Jiuquan Satellite Launch Center of China, Jiuquan, Gansu 732750, China
  • Online:2014-06-01 Published:2014-05-30

摘要: 在航天领域中,安全关键的大型实时软件系统往往直接影响到任务成败,一般难以全面检测、分析或避免内存泄漏等常见内存错误。定义了实时软件的12种典型内存故障模式,提出了一种基于C++代码插装的实时软件内存错误快速分析方法。该方法通过对C++源代码进行静态分析,获取指针变量相关信息;通过C++代码插装和运行不同测试用例,实时收集统计C++指针对象的分配、释放、赋值、c-use和p-use使用情况,结合实时软件的典型内存故障模式进行分析,并自动生成详情报告。应用案例表明,该方法能够高效快捷地发现实时软件潜在的典型内存错误,从而有效提高软件质量。

关键词: 实时软件, 内存错误, 内存泄漏, 代码插装

Abstract: In aerospace industry, safety-critical large-scale real-time software system has a direct impact on space launch missions. It is hard to keep a comprehensive track, analyze or avoid common memory errors such as memory leaks. This paper defines 12 types of memory fault patterns for real-time softwares, and proposes a novel approach to rapid analysis of memory errors for real-time softwares, based on C++ code instrumentation. Information of pointer variables are obtained by C++ code static analysis. With running under various test cases, information including pointer allocation, release, assignment, c-use and p-use codes is collected in real-time. After memory fault analysis, a detailed report can be generated automatically. A case study shows that the proposed approach can find potential memory errors effectively, and make efficient improvements to software quality.

Key words: real-time software, memory error, memory leak, code instrumentation