传感网技术是物联网得以实现的重要基础.然而,受到资源有限以及程序行为不确定等因素的影响,无线传感器网络上编程和调试的难度尤甚于普通的分布式程序.文中提出了一种面向无线传感器网络程序的源码级错误诊断方法.该方法采用基于全局量计数器的方法进行程序追踪,然后根据追踪日志重放错误执行轨迹,支持属性违反错误的分析和调试.同时,通过依赖分析确定与属性相关的程序片段,并根据系统资源约束以及用户反馈,自适应调整追踪这些程序片段的代码,以满足系统资源的限制,支持错误定位.文中以Open64编译器为基础,实现了一个针对TinyOS操作系统中nesC程序错误诊断的原型系统.实验数据表明,此方法能够有效地控制确定性重放技术的时空开销,有力地支持了无线传感器网络程序中属性违反类型错误的诊断.
Wireless Sensor Networks(WSN) are gaining more attentions with the progress of Internet of Things(IoT).However,due to the constrained resources and non-deterministic behaviors,programming and debugging WSN applications still face challenges.In this paper,we propose an adaptive source-level debugging approach for WSN applications.This approach,based on dependency analysis and instrumentation,retrieves execution traces and feeds them back to the replay system which adopts a global counter method.The scope and granularity of tracing and replay can be adjusted automatically according to the resource constrains and user knowledge.Moreover,a prototype debugging system for nesC applications is implemented on top of Open64 compiler.Experimental results show that this approach not only mitigates memory consumption of deterministic replay,but also improves the efficiency of error diagnosis for WSN applications.