Download presentation
Presentation is loading. Please wait.
Published byDale Norris Modified over 9 years ago
1
Slide 1, Presentation: Reverse Engineering state diagrams from C/C++ code, 29-10-2008 | Dennie van Zeeland Masters Project Reverse Engineering state machine diagrams from C/C++ code Vanderlande Industries B.V. (Veghel) Dennie van Zeeland
2
Slide 2, Presentation: Reverse Engineering state diagrams from C/C++ code, 29-10-2008 | Dennie van Zeeland Outline Introduction -Vanderlande Industries -FSC Project goal Tools -CPP2XMI Approach Extensions / Improvements Problems
3
Slide 3, Presentation: Reverse Engineering state diagrams from C/C++ code, 29-10-2008 | Dennie van Zeeland 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)
4
Slide 4, Presentation: Reverse Engineering state diagrams from C/C++ code, 29-10-2008 | Dennie van Zeeland 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
5
Slide 5, Presentation: Reverse Engineering state diagrams from C/C++ code, 29-10-2008 | Dennie van Zeeland Introduction (3) -Flow System Controller
6
Slide 6, Presentation: Reverse Engineering state diagrams from C/C++ code, 29-10-2008 | Dennie van Zeeland Introduction (4) -Flow System Controller
7
Slide 7, Presentation: Reverse Engineering state diagrams from C/C++ code, 29-10-2008 | Dennie van Zeeland Introduction (5) -Flow System Controller
8
Slide 8, Presentation: Reverse Engineering state diagrams from C/C++ code, 29-10-2008 | Dennie van Zeeland 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
9
Slide 9, Presentation: Reverse Engineering state diagrams from C/C++ code, 29-10-2008 | Dennie van Zeeland 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)
10
Slide 10, Presentation: Reverse Engineering state diagrams from C/C++ code, 29-10-2008 | Dennie van Zeeland 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
11
Slide 11, Presentation: Reverse Engineering state diagrams from C/C++ code, 29-10-2008 | Dennie van Zeeland CPP2XMI Abstract Syntax Tree in XML-format Class Diagram in XML (XMI)-format Class, Sequence, Activity Diagram in XML (XMI)-format
12
Slide 12, Presentation: Reverse Engineering state diagrams from C/C++ code, 29-10-2008 | Dennie van Zeeland CPP2XMI
13
Slide 13, Presentation: Reverse Engineering state diagrams from C/C++ code, 29-10-2008 | Dennie van Zeeland 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
14
Slide 14, Presentation: Reverse Engineering state diagrams from C/C++ code, 29-10-2008 | Dennie van Zeeland CPP2XMI Could be improved X
15
Slide 15, Presentation: Reverse Engineering state diagrams from C/C++ code, 29-10-2008 | Dennie van Zeeland Example Source CodeCPPML static void obj_control(Obj *obj, ObjEvent event) {… switch (obj->state) { case State_A: switch (event) { case event1: … obj->state = State_B; break; case event2: … obj->state = State_C; … break;} break; case State_B: switch (event) { case event1: … obj->state = State_B; … break; case event3: … obj->state = State_C; … break;} break; default;}} {obj->state} {event} {obj->state} … …
16
Slide 16, Presentation: Reverse Engineering state diagrams from C/C++ code, 29-10-2008 | Dennie van Zeeland Example Source CodeState Machine Diagram static void obj_control(Obj *obj, ObjEvent event) {… switch (obj->state) { case State_A: switch (event) { case event1: … obj->state = State_B; … break; case event2: … obj->state = State_C; … break;} break; case State_B: switch (event) { case event1: … obj->state = State_A; … break; case event3: … obj->state = State_C; … break;} break; default;}}
17
Slide 17, Presentation: Reverse Engineering state diagrams from C/C++ code, 29-10-2008 | Dennie van Zeeland 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
18
Slide 18, Presentation: Reverse Engineering state diagrams from C/C++ code, 29-10-2008 | Dennie van Zeeland Examples extracted from FSC (V6)
19
Slide 19, Presentation: Reverse Engineering state diagrams from C/C++ code, 29-10-2008 | Dennie van Zeeland Examples extracted from FSC (V6)
20
Slide 20, Presentation: Reverse Engineering state diagrams from C/C++ code, 29-10-2008 | Dennie van Zeeland Examples extracted from FSC (V6)
21
Slide 21, Presentation: Reverse Engineering state diagrams from C/C++ code, 29-10-2008 | Dennie van Zeeland 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
22
Slide 22, Presentation: Reverse Engineering state diagrams from C/C++ code, 29-10-2008 | Dennie van Zeeland 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)
23
Slide 23, Presentation: Reverse Engineering state diagrams from C/C++ code, 29-10-2008 | Dennie van Zeeland 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
24
Slide 24, Presentation: Reverse Engineering state diagrams from C/C++ code, 29-10-2008 | Dennie van Zeeland Questions?
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.