摘要: 在软件演化过程中,代码的调试是不可或缺的重要环节。对于多线程程序,线程的交错和调度是非确定的,不同的线程调度会产生不同的结果,程序员较难调试多线程程序。为此,对实际项目中多线程程序出现的错误进行分析,提出一种新的多线程调试工具,并给出顺序点概念。设计用于调试的线程调度语言,在字节码层面对测试程序进行插桩,使线程按照期望的顺序调度。在此基础上实现一个Eclipse上的调试插件。实验结果表明,与现有工具IMunit相比,该调试工具减少了程序员的工作量,并拓展了两类程序的调试场景,具有较好的实用性。
关键词:
多线程,
调试,
字节码,
插桩,
领域特定语言,
插件
Abstract: During the evolution of software,the debugging of programs is an important and necessary process.For multithreaded programs,the interleaving and scheduling are non-deterministic.Different scheduling can give different results,so it is difficult for developers to debug a multithreaded program.Therefore,this paper analyzes the concurrency bugs in real projects,presents a new multithreaded debugging tool,and proposes the concept of sequence point.It designs the scheduling language for debugging,instruments the test programs in bytecode level,and makes threads schedule in a desired sequence.It implements a debugging plugin in Eclipse.Experimental results show that compared with existing tool IMunit,the tool reduces developers’ workload and enhances two debugging scenarios.It has better availability.
Key words:
multithreading,
debugging,
bytecode,
instrumentation,
domain-specific language,
plugin
中图分类号:
周一耒,于海波,钟浩. 基于字节码插桩的多线程调试工具[J]. 计算机工程.
ZHOU Yilei,YU Haibo,ZHONG Hao. Multithreaded Debugging Tool Based on Bytecode Instrumentation[J]. Computer Engineering.