340 likes | 692 Views
Masters Project. Reverse Engineering state machine diagrams from C/C++ code Vanderlande Industries B.V. (Veghel) Dennie van Zeeland. Outline. Introduction Vanderlande Industries FSC Project goal Tools CPP2XMI Approach Extensions / Improvements Problems. Introduction (1).
E N D
Masters Project Reverse Engineering state machine diagrams from C/C++ code Vanderlande Industries B.V. (Veghel) Dennie van Zeeland
Outline • Introduction • Vanderlande Industries • FSC • Project goal • Tools • CPP2XMI • Approach • Extensions / Improvements • Problems
Introduction (1) Vanderlande Industries (VI) Veghel, near A50 Automated material handling systems: distribution centres Nike, Friesche Vlag, Amazon.de, Audi FALCON project by ESI, VI, 3TU (SET) baggage handling at airports Eindhoven Airport, Schiphol, Heathrow (T5), Honk Kong I.A. express parcel sortation facilities DHL, DPD, TNT Express Worldwide, UPS, Integra2 (Madrid)
Introduction (2) Flow System Controller (FSC) Controls the product flows in conveyor systems for transport and sortation Controls all motors, photocells and other active components Send and receive control and status information Realtime Control of equipment Separated GUI Standard interfaces with equipment Fully configurable for all VI sorting equipment
Introduction (3) Flow System Controller
Introduction (4) Flow System Controller
Introduction (5) Flow System Controller
Project goal (1) • Reverse Engineering documentation from C/C++ source code • Why: • Limited documentation available for V5/V6 • V7 is being developed from scratch • Extracting dynamic behavior from source code for V7 • Identifying requirements • Identifying possible flaws in current versions • What kind of documentation • UML models • Class diagrams • Sequence diagrams • Activity diagrams • State machine diagrams • Sparse amount of documentation available • Engineering manual • Description of components
Project goal (2) Reverse Engineering documentation from C/C++ source code Investigating current state of the art tools Extracting State Machine diagrams from code (main focus) Preprocessing source code Parsing source code Finding patterns in source code of state machines Creating diagrams Extracting Class diagrams from code (if time left)
Tools • No tools are applicable to FSC • FSC is written in object oriented C • Current tools only work on C++ • No tools are available for state machine extraction • current tool is very specific for FSC (thus not generally applicable for any software system) • No complete state machine can be extracted • Cpp2XMI • LaQuSo (Laboratory for Quality Software) • C++ to UML-diagrams • Class diagram • Sequence diagram • Activity diagram
Abstract Syntax Tree in XML-format CPP2XMI Class Diagram in XML (XMI)-format Class, Sequence, Activity Diagram in XML (XMI)-format
Approach Implement a simple state machine extractor for FSC Find 1 specific pattern Integrate state machine extractor into CPP2XMI Create 2nd parser for CPPML Storage in internal data structures State Machine organizer Adding layout (position information) XMI writer / DOT writer Extending with extra patterns Proof of concept on source code of a component of FSC
CPP2XMI X Could be improved
Extensions / Improvements to CPP2XMI Done: Implemented a state machine extractor for FSC 2nd parser for CPPML Internal data structures storage system Database storage State Machine organizer Layout / position information XMI writer DOT writer (integration of Graphviz toolset) Improved command line options Implemented a GUI Updated old CPP2XMI to support Java Generics
Extensions / Improvements to CPP2XMI To do: Find more false negatives and their corresponding patterns, implement those. Add more information to state transitions (conditional state transitions) Map overlapping states and transitions Write documentation Apply tool to V5 / V6
Extensions / Improvements to CPP2XMI Further improvements to CPP2XMI Create class diagram from Objective C basic idea: Find patterns Make a classification system Based on this classification, determine the classes, methods and attributes Make diagrams XMI conversion Improve performance issues (due to choice of parser)
Problems encountered Preprocessing issues Columbus Parser doesn’t understand anonymous structs/enums CPPML should have a tree-structure (1 on 1 with AST) However it’s a DAG, which makes pattern recognition is tricky CPP2XMI doesn’t extract controlstatements (do, while, if, switch break, continue, etc.) correctly (for C) Performance issues with CPPML parser JDOM (Memory peak level: 1,8GB) SAX (will not solve memory peaks) Bug in XMI-part Duplicate id’s, which raises errors when importing XMI into case-tools (Enterprise Architect) Position information not part of XMI Enterprise Architect doesn’t do anything with position information