Masters Project - PowerPoint PPT Presentation

1 / 25
About This Presentation
Title:

Masters Project

Description:

Slide 1 , Presentation: Extraction of State Machine Diagrams of Legacy C code ... UML state machines are useful for the developers and maintainers ... – PowerPoint PPT presentation

Number of Views:71
Avg rating:3.0/5.0
Slides: 26
Provided by: dennieva
Category:

less

Transcript and Presenter's Notes

Title: Masters Project


1
Masters Project
  • Extraction of State Machine Diagrams of
  • Legacy C code with Cpp2XMI
  • Vanderlande Industries B.V. (Veghel)
  • Dennie van Zeelandd.h.a.v.zeeland_at_student.tue.nl

2
Outline
  • Introduction
  • Project goal
  • Related work
  • Tools
  • State Machine patterns
  • Switch-Case / Switch-Case pattern
  • Overview of design of Cpp2XMI
  • CPPML
  • Case Study - FSC
  • Problems encoutered
  • Conclusions / Future work

3
Introduction
  • Vanderlande Industries (VI)
  • Automated material handling systems
  • distribution centres
  • baggage handling at airports
  • express parcel sortation facilities
  • 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

4
Project goal
  • Reverse Engineering documentation from C/C
    source code
  • Why
  • Limited documentation available for V5/V6
  • State machine diagrams
  • Identifying possible flaws in current versions
  • V7 is being developed from scratch
  • Extracting dynamic behavior from source code for
    V7
  • Identifying requirements
  • Building a tool for extracting state machine
    diagrams from code
  • Preprocessing source code
  • Parsing source code
  • Finding patterns in source code of state machines
  • Creating diagrams

5
Related work
  • ESPaRT KNOR98
  • Finding state machine patterns and replacing them
    by better constructs
  • Bandera CORB00
  • Extract state machines and produce input for
    model checkers
  • Symbolic Execution WALK08
  • Program conditioning
  • Brastra YUAN06
  • Extracting state machines using unit tests
  • Log based state machine extraction GANN06

6
Tools
  • Cpp2XMI
  • Developed by Elena Korshunova for LaQuSo
  • C to UML-diagrams
  • Class diagram
  • Sequence diagram
  • Activity diagram
  • Columbus/CAN toolset
  • Pre-processor Parser Linker
  • Static analyser (Class diagram extraction)
  • CPPML (C Markup Language)
  • Use Cpp2XMI as basis and extend it with
  • State machine diagram

7
State Machine Patterns
  • Global type of patterns for implementing state
    machines
  • Nested Choice Patterns
  • Switch/Case Switch/Case pattern (mainly used in
    FSC)
  • Switch/Case If/Else
  • If/Else Switch/Case
  • If/Else If/Else
  • Jump Tables
  • Pointer to a function pointer array represents
    state variable
  • Function pointer array is the jumb table
  • Table contains the event handler functions
  • Object oriented approach
  • States as classes
  • Goto statements
  • Use goto statements to jump through program
  • Each goto statement corresponds to a state
    transition

8
Switch/Case Switch/Case pattern (1)
  • States

9
Switch/Case Switch/Case pattern (2)
  • Transitions

10
Switch/Case Switch/Case pattern (3)
  • Object with current state variable

11
Switch/Case Switch/Case pattern (4)
  • Control Function

12
Switch/Case Switch/Case pattern (5)
  • Multiple events with the same event-handler

13
Switch/Case Switch/Case pattern (6)
  • State assignment in called function

14
Switch/Case Switch/Case pattern (7)
  • Conditional transitions

15
Overview of design of Cpp2XMI (1)
Abstract Syntax Tree in XML-format
Class Diagram in XML (XMI)-format
Class, Sequence, Activity Diagram in XML
(XMI)-format
16
Overview of design of Cpp2XMI (2)
X
Could be improved
17
Case Study - FSC (1)
  • Applied Cpp2XMI to FSC V6

18
Case Study - FSC (2)
  • Example SPUR

19
Case Study - FSC (3)
  • Example Triplesorter

20
Case Study (4)
  • Some results of the Cpp2XMI State Machine Diagram
    Extractor
  • V6 27 State Machine Diagrams, 2 false positives
  • Extracted state machine is for 70 identical to
    original documented state machine (Gappex)
  • Correctness was checked and confirmed by domain
    experts

21
Problems encountered
  • Preprocessing issues
  • Columbus Parser doesnt understand anonymous
    structs/enums
  • Sax parser issues
  • Sax parser halts on the escape character (0x1B)
  • CPPML should have a tree-structure (1 on 1 with
    AST)
  • However its a DAG, which makes pattern
    recognition is tricky
  • Cpp2XMI doesnt extract control-statements (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 ids, which raises errors when
    importing XMI into case-tools (Enterprise
    Architect)
  • Position information not part of XMI
  • Enterprise Architect doesnt do anything with
    position information

22
Conclusions / Future work
  • Conclusions
  • UML state machines are useful for the developers
    and maintainers
  • Can be derived automatically from source code (by
    finding patterns)
  • Was very successful in the case study and is in
    general promising
  • Future work
  • Expanding the state machine patterns
  • Combine with logging to get a general state
    machine
  • Export function for model checkers
  • On Entry / On Exit
  • Metrics / analysis over overlap of state machine
    diagrams
  • Filter / Zoom
  • Use original CPPML parser
  • XMI conversion
  • Improve performance issues (due to choice of
    parser)

23
Questions?
24
References (1)
  • KNOR98
  • Roland Knor, Georg Trausmuth and Johannes Weidl
  • Reengineering C/C Source Code by Transforming
    State Machines
  • Proceedings of the Second International ESPRIT
    ARES Workshop on Development and Evolution of
    Software Architectures for Product Families
  • 1998
  • ISBN 3-540-64916-6, Page 97105
  • Springer-Verlag
  • CORB00
  • James C. Corbett, et al.
  • Bandera extracting finite-state models from Java
    source code
  • Proceedings of the 22nd international conference
    on Software engineering,
  • 2000
  • ISBN 1-58113-206-9, Page 439448
  • ACM
  • WALK08
  • Neil Walkinshaw et al.
  • Automated discovery of state transitions and
    their functions in source code
  • Journal Software Testing Verification
    Reliability (Vol 18, nr 2)
  • 2008

25
References (2)
  • YUAN06
  • Tao Xie and Evan Martin and Hai Yuan
  • Automatic extraction of abstract-object-state
    machines from unit-test executions
  • Proceedings of the 28th international conference
    on Software engineering
  • 2006
  • ISBN 1-59593-375-1, Page 835838
  • ACM
  • GANN02
  • Gerald C. Gannod and Shilpa Murthy
  • Using Log Files to Reconstruct State-Based
    Software Architectures
  • Workshop on Software Architecture Reconstruction
    at WCRE 2002
  • 2002
  • FERE02
  • Rudolf Ferenc et al.
  • Columbus - Reverse Engineering Tool and Schema
    for C
  • Proceedings of the International Conference on
    Software Maintenance
  • 2002
  • ISBN 0-7695-1819-2, Page 172
  • IEEE Computer Society
Write a Comment
User Comments (0)
About PowerShow.com