| Nowadays,the multi-core processors develop rapidly,making the usage of multi-thread more and more widely.Multi-threaded program can improve the speed of operation and the utilization of resources,but it may contain concurrency-bugs easily.Currently,the existing researches or tools of multi-threaded programs mainly focus on the detection of the bugs in multi-threaded programs.However,these bugs,no matter detected by tools or in the bug reports which reported by users,need developers' to involve in the debugging.The debugging of programs is an important and necessary process.For single thread program,developer can set breakpoints,output logs or some other ways to debug.But for multi-threaded programs,these approaches are not applicable,because the threads' schedule is chosen by scheduler,and it is non-deterministic,different schedule may cause different results,which brings many barriers to debug multithreaded programs.So developers are eager for reliable techniques for debugging multithreaded programs.To debug a multithreaded program,the most important thing is to control the threads' schedule during its execution,by inserting control code into the program.At the beginning,developers can steer the threads' schedule by inserting Thread.sleep()into the source code,and it is still one of the most common way to control the schedule.Sometimes,they also get their desired schedule by adding code like Object.wait()/notify().But neither of them are safe enough while they both may cause false positive and false negative.Recently,researchers have provided some frameworks for testing multithreaded programs,like ConAn,MultithreadedTC,IMunit,and so on.However,they are not easy for developers to use,and the bug of multithreaded programs' becomes more and more complicated,current techniques can not satisfy all the requirements of developers for debugging.Our research analyzes the concurrency bugs in real projects,and summarizes as four types of multi-threaded debugging scenarios which developers may face to: general threads' switches based on line,controlling the threads' switches between the logical operators,controlling the threads' switches between the call chain of methods,and controlling the threads' switches related to loop.To help developers debug these four kinds of multithreaded programs,this paper defines the concept of sequence point,and the schedule constraints need to be satisfied,we propose the debugging technique based on sequence point and design the domain specific language for debugging multithreaded programs.Our research use the instrumenting technique in byte-code level instead of source code level,thereby reaching the purpose of making threads schedule in a desired sequence,and the control of threads' schedule can be more flexible and accurate.Based on the approach above,this research implement a debugging plugin in Eclipse,which can use custom class loader to select the Java class needs to be instrumented,then use the interface provided by ASM to instrument different kinds of code in byte-code level,and monitor and control the threads' schedule through Java Debug Interface.This debugging tool can help developer debug the multithreaded programs,and it verifies the feasibility of our approach.Our research also has conducted several experiments comparing to existing tool IMunit.The experiment results show that,the debugging technique based on sequence point can reduce developers' workload,and enhance two kinds of debugging scenarios,so it has better availability. |