Defusing the Debugging Scandal - Dedicated Debugging Technologies for Advanced Dispatching Languages
Total Page:16
File Type:pdf, Size:1020Kb
Dedicated Debugging Technologies for Advanced Dispatching Languages Haihan Yin Haihan Languages Dispatching Advanced for Technologies Debugging Dedicated Defusing the Debugging Scandal - Dedicated Debugging Technologies for Advanced Dispatching Languages ISBN 978-90-365-3569-4 Haihan Yin Defusing the Debugging Scandal - Dedicated Debugging Technologies for Advanced Dispatching Languages Haihan Yin Ph.D dissertation committee: Chairman and secretary: Prof. Dr. Ir. A.J. Mouthaan, University of Twente, The Netherlands Promoter: Prof. Dr. Ir. Mehmet Ak¸sit, University of Twente, The Netherlands Assistant promoter: Dr. Ing. Christoph Bockisch, University of Twente, The Netherlands Members: Prof. Shigeru Chiba, University of Tokyo, Japan Prof. Jianjun Zhao, Shanghai Jiao Tong University, China Prof. Dr. Eric Bodden, Technische Universit¨atDarmstadt, Germany Prof. Dr. Jaco van de Pol, University of Twente, The Netherlands Dr. Ir. Maurice van Keulen, University of Twente, The Netherlands CTIT Ph.D. Thesis Series No. 10-170 Centre for Telematics and Information Technology P.O. Box 217, 7500 AE Enschede, The Netherlands The work described in this thesis was performed at the Software Engineering group, Center for Telematics and Information Te Technology, Faculty of Electrical Engineering, Mathematics and Computer Science, University of Twente, The Netherlands. ISBN 978-90-365-3569-4 ISSN 1381-3617 (CTIT Ph.D. thesis Series No. 10-170). DOI 10.3990./1.9789036535694 Cover designed by Haihan Yin Printed by Ipskamp Drukkers B.V., Enschede, The Netherlands Copyright c 2013, Haihan Yin, Enschede, The Netherlands All rights reserved. DEFUSING THE DEBUGGING SCANDAL - DEDICATED DEBUGGING TECHNOLOGIES FOR ADVANCED DISPATCHING LANGUAGES DISSERTATION to obtain the degree of doctor at the University of Twente, on the authority of the rector magnificus, Prof. Dr. H. Brinksma, on account of the decision of the graduation committee, to be publicly defended on Wednesday the 4th of December 2013 at 12.45 by Haihan Yin born on the 21st of June 1986 in Changsha, China This dissertation is approved by Prof. Dr. Ir. Mehmet Ak¸sit (promoter) Dr. Ing. Christoph Bockisch (assistant promoter) To my parent Jianwei and Chunhui Abstract To increase program modularity, new programming paradigms, such as aspect- oriented programming, context-oriented programming, and predicated dispatch- ing, have been researched in recent years. The new-paradigm languages allow changing behavior according to various kinds of contexts at the call sites. A re- cent statistics shows that at least 66% of skilled engineers world-wide, courses and third party vendors are using languages that support AOP features. Many well-known companies are using these languages in product developments. In our research, we classified these new languages as advanced-dispatching languages. Advanced-dispatching languages are usually implemented as an ex- tension of main-stream languages. After compilation, their programs are trans- formed to the compiled form of the main-stream language. Due to this com- pilation mechanism, the information, especially features that are specific to the advanced-dispatching languages, existing in the source code cannot be fully re- stored during debugging. The information loss increases the effort of compre- hending advanced-dispatching programs and fixing advanced-dispatching-specific defects. In this thesis, we performed four works to improve the comprehensi- bility of debugging information from three debugging techniques | interactive debugging, trace-based debugging, and slicing. We first performed research on the most common debugging technique| interactive debugging. Due to the availability of existing fault models, we pro- posed a generalized fault model based on four aspect-oriented-specific fault mod- els. The generalized fault model consists of seven fault types and we found a likely pattern for fixing a defect corresponding to each type. Then, we analysed the pattern description and extracted eleven atomic advanced-dispatching-specific debugging tasks. To support the tasks, we modified an existing compiler to keep aspect-oriented information after the compilation, built a dedicated advanced dispatching debugging model, and implemented graphical user interfaces. In addition to the form of debugging information, we analysed the problem where and when the program should be suspended. In interactive debugging, breakpoints are essential to determine the suspending places. For fixing a spe- cific defect, breakpoints are logically related. However, existing debuggers do not support to build logic between breakpoints. Therefore, programmers have to manually perform some repeated tasks. In this thesis, we analysed five common debugging scenarios that require multiple breakpoints. Targeting the investigated scenarios, we designed and implemented a breakpoint language that uses point- cuts to select suspension times in the program. In our language, an expected suspension can be expressively programmed and reached with less or even no irrelevant suspensions. Though the interactive debugging is the most commonly used debugging tech- nique, it becomes handicapped in cases that the observed failure is far away from the defect. Locating the defect is typically a backtracking process through the execution history. However, interactive debugging is performed along with the program execution and cannot restore a past state. Trace-based debugger records events at runtime and supports inspection offline. Existing researches on trace- based debugging for advanced-dispatching languages are limited. We proposed a dedicated trace-based debugger with an user interface that allow programmers to navigate and query the recorded trace. Automation is what software aims for. Slicing is a debugging technique which automatically selects program statements that can influence the failure. It is per- formed on dependency graphs that contain the inter-relationships between pro- gram statements, such as control dependencies, call dependencies. We discussed how three aspect-oriented-specific constructs, which are join point shadows, pro- gram compositions, and non-argument context values, can influence the execution of aspect-oriented programs. Considering the three constructs, we developed de- pendency graphs that are dedicated to aspect-oriented programs, as well as a slicing algorithm that is performed on the developed dependency graphs. We showed that our approach can be applied efficiently for small projects and is able to select all relevant source code. The three debugging techniques analysed in this thesis fully cover phases before, during and after the program execution. For each technique, we have pro- vided a debugging model that explicitly models advanced-dispatching concepts. The generated debugging information is in terms of advanced-dispatching abstrac- tions. Thus, the comprehensibility of debugging advanced-dispatching programs is increased. Acknowledgements Life is like a running program with occasional failures. Some people choose to ignore failures and live an easy life. In the end, those failures may deviate their lives from what they expected further and further. Some people choose to discover the cause, eliminate such failures, and live happily ever after. I started my PhD journey in 2010 October. Since then, failures have never ceased to accompany with me. People around me gave me guidances and supports to overcome these failure. This thesis belongs to everyone who ever helped me. First, I would like to appreciate my promoter Mehmet Ak¸sitto offer me the opportunity to work in the software engineering group as a PhD student. Your insightful guidance showed me promising directions to work on. You have always been a great source of inspiration for me. Christoph Bockisch is my daily supervisor during my entire PhD phase and he is also the supervisor of my master project. No word can describe how I am grateful about what he contributed to my work. There is a saying in China, \Even if someone is your teacher for only a day, you should regard him like your father for the rest of your life." Interestingly, people call a supervisor as \PhD father" in German. You are always patient to listen to my thoughts even they are simple and naive. You always encourage me even though I sometimes submitted really unsatisfied work. You are the one who can always make time for me even for unexpected visits. You always explain things step by step and teach me things hand by hand. In the third round submission to AOSD'12, we had discussion almost every day and you were extremely strict with the quality of the paper. I wrote a crucial section with only two pages eleven times. As a result, our paper not only got accepted but also won the \best paper" award. It was a great encouragement to me and I became much more confident since then. What I learnt from you is not only about research and knowledge, but also the German way of thinking and working. I digested your way of supervision and successfully applied it to three master students, including two Chinese students. It is my great fortune to choose you as my supervisor. I wish you, your wife, cute Julia, lovely Sarah, and your families all the best. Prost! I also would like to thank the members of my PhD committee: prof. Shigeru Chiba, prof. Jianjun Zhao, prof.dr. Eric Bodden, dr.ir. Maurice van Keulen, prof.dr. Jaco van de Pol. I am very honored that you accepted our invitation to be part of my committee and thank you for reading my thesis and providing valuable feedback