Martin Koníček Debugger Frontent for the Sharpdevelop
Total Page:16
File Type:pdf, Size:1020Kb
Charles University in Prague Faculty of Mathematics and Physics MASTER THESIS Martin Koníček Debugger Frontent for the SharpDevelop IDE Department of Software Engineering Supervisor of the master thesis: Mgr. Pavel Ježek Study programme: Computer science Specialization: Software systems Prague 2011 I would like to thank my supervisor Pavel Ježek for his time and his very helpful, constructive advice on this thesis. I would like to extend a very honest “thank you” to David Srbecký, the author of the SharpDevelop Debugger and Daniel Grunwald, the lead developer of SharpDevelop IDE. They were both very helpful and the work on this thesis probably wouldn’t start without them. I would also like to thank Christoph Wille for running the project, Siegfried Pammer and Matt Ward for all their contributions and enthusiasm and of course Mike Krüger for originally starting the SharpDevelop project. They all deserve much respect for their work. Last but not least, I thank Google for supporting students to work on interesting open source projects. I declare that I carried out this master thesis independently, and only with the cited sources, literature and other professional sources. I understand that my work relates to the rights and obligations under the Act No. 121/2000 Coll., the Copyright Act, as amended, in particular the fact that the Charles University in Prague has the right to conclude a license agreement on the use of this work as a school work pursuant to Section 60 paragraph 1 of the Copyright Act. In Prague Martin Koníček Název práce: Debugger Frontent for the SharpDevelop IDE Autor: Martin Koníček Katedra / Ústav: Department of Software Engineering Vedoucí diplomové práce: Mgr. Pavel Ježek Abstrakt: Cílem této práce je prozkoumat nové přístupy k ladění kódu na platformě .NET framework, se zameřením na visualizaci dat v laděném programu. Specifické cíle této práce jsou: (a) implementovat nástroj, který zobrazuje datové struktury v laděném programu jako orientované grafy, (b) zlepšit způsob, jakým jsou běžně visualizovány kolekce objektů díky implementaci nového nástroje, který zobrazuje přehled obsahu objektů v kolekci, a zároveň efektivně podporuje všechny užitečné typy kolekcí. Práce je implementována pro integrované vývojové prostředí pro .NET SharpDevelop. Autor spolupracuje s členy SharpDevelop týmu a výsledky práce jsou již součástí nové verze SharpDevelopu. Klíčová slova: ladění programů, Integrované vývojové prostředí, visualizace dat, .NET Title: Debugger Frontent for the SharpDevelop IDE Author: Martin Koníček Department: Department of Software Engineering Supervisor of the master thesis: Mgr. Pavel Ježek Abstract: The overall goal of the thesis is to explore new approaches to debugging managed code, namely visualization of data in the program being debugged. Particular goals of the work are: (a) to build an object graph visualizer, which displays selected data structure used in the program as directed graph, (b) improve visualization of object collections by providing an overview of collection contents and supporting broad range of collection types. The work is implemented for the SharpDevelop open source IDE for .NET. The author cooperates with the SharpDevelop team and the results of the work have been already incorporated into the new version of the IDE. Keywords: debugging, IDE, data visualization, .NET Contents 1. Introduction ..................................................................................................................................................................7 1.1 Style conventions..............................................................................................................................................7 1.2 Terminology........................................................................................................................................................7 1.3 Context...................................................................................................................................................................7 1.4 Motivation ............................................................................................................................................................7 1.4.1 Object graphs ............................................................................................................................................8 1.4.2 Collections ............................................................................................................................................... 10 1.4.3 Debugger tooltips................................................................................................................................. 12 1.5 Goals .................................................................................................................................................................... 12 1.6 Preview .............................................................................................................................................................. 13 1.6.1 Object graph visualizer ...................................................................................................................... 13 1.6.2 Collection visualizer............................................................................................................................ 14 1.6.3 Debugger tooltips................................................................................................................................. 14 1.7 Contribution of this thesis ......................................................................................................................... 15 1.8 Background ...................................................................................................................................................... 15 2. Analysis ........................................................................................................................................................................ 17 2.1 Introduction to the SharpDevelop IDE ................................................................................................. 17 2.2 The architecture of SharpDevelop ......................................................................................................... 18 2.2.1 Reusable parts of SharpDevelop ................................................................................................... 18 2.2.2 ICSharpCode.Core ................................................................................................................................ 19 2.2.3 ICSharpCode.SharpDevelop............................................................................................................. 22 2.2.4 NRefactory .............................................................................................................................................. 22 2.2.5 ICSharpCode.SharpDevelop.Dom.................................................................................................. 23 2.2.6 Future of NRefactory and Dom ...................................................................................................... 23 2.2.7 Debugger.................................................................................................................................................. 24 2.3 Fundamental problem of debugging ..................................................................................................... 29 2.4 Division of work ............................................................................................................................................. 31 2.5 Collections......................................................................................................................................................... 32 2.5.1 Types of collections............................................................................................................................. 32 2.5.2 First approach – treating all collections as IEnumerable ................................................... 34 2.5.3 Second approach – special case for IList ................................................................................... 35 2.5.4 Third approach – converting IEnumerable to IList............................................................... 35 2.5.5 Conclusion ............................................................................................................................................... 36 2.6 Object graph visualizer................................................................................................................................ 36 2.6.1 Existing work ......................................................................................................................................... 37 2.6.2 What needs to be done ...................................................................................................................... 37 2.6.3 Graph building....................................................................................................................................... 38 2.6.4 Graph layout ........................................................................................................................................... 44 2.6.5 Graph transitions ................................................................................................................................. 50 2.7 Collection Visualizer ....................................................................................................................................