c program information database for analysis tools
play

C++ Program Information Database for Analysis Tools Wanghong Yuan, - PowerPoint PPT Presentation

C++ Program Information Database for Analysis Tools Wanghong Yuan, Xiangkui Chen, Tao Xie, Hong Mei, and Fuqing Yang Department of Computer Sci. & Tech. Peking University C++ Program Information Database for Analysis Tools 1. Why employ


  1. C++ Program Information Database for Analysis Tools Wanghong Yuan, Xiangkui Chen, Tao Xie, Hong Mei, and Fuqing Yang Department of Computer Sci. & Tech. Peking University

  2. C++ Program Information Database for Analysis Tools 1. Why employ program information database? 2. How program information database works? 3. Current status and future …

  3. Why program information database? Program source codes are primary information source of software systems Code analyzers analyze source code for different requirements

  4. Code analyzers: examples • CSope for cross-reference of C programs • OOTM for object-oriented testing • GRASP for reverse engineering of structure diagrams • COBOL/SRE for reengineering to recover reusable components • ATM for analyzing the effect of changes to Ada code • others, say, CIA and CIA++

  5. Code analyzers ( continue ) Various code analyzers • need some common information • share same program information therefore • store program information into database • avoid duplicating extraction process

  6. JBPAS JBPAS: Jade Bird Program Analysis System A tool kit of code analysis for C++ programs Three major components: • A C++ front end • An information manager • A set of program analysis tools

  7. JBPAS Architecture C++ Front End Information Manager Analysis Toolset PUS RET OOTS CEX CToC++

  8. JBPAS Analysis Toolset • Program Understanding System facilitate understanding of C++ programs • Reverse Engineering Tool recover object-oriented design documents • Object-Oriented Test Supporter determine test cases & support testing • Component Extractor identify and extract reusable components • C to C++ Translator restructure C program to equivalent C++ program

  9. How program information database works ? • Conceptual Model define what program information to extract • database link incremental parsing

  10. Conceptual Model Enhanced Entity Relationship (EER) model C++ programs viewed as • entities (with attributes) • relationships (with attributes, if any) Conceptual model should be • comprehensive • well-defined

  11. JBPAS Conceptual Model Inherit F riendC C all O verload M acro L oc_in Sub Sup Sub Sup Sub Sup Sub Sup F riendM C lass L oc_in L oc_in Function M eth _of Sup Include F ct _bdy F ile Inst _of A ttr _of Sub V ar _of A ttribute Statem ent O bject L oc_in d Sub Sup R efer V ariable C ontain

  12. JBPAS Conceptual Model : Entities • Macro • File • Class • Function • Object (Attribute & Variable) • Statement

  13. JBPAS Conceptual Model : Relationship •Relationship between classes - class A inherits class B - class A refer class B - class A is friend of class B •Relationship between class & Object - object O is instance of class C - object O is attribute of class C •Relationship between class & Function - function F is member of class C - function F is friend of class C

  14. Relationship ( continue ) •Relationship between Functions - function A call function B - function A overload function B •Relationship between Function & Object - object O is local variable of function F - object O is refereed by function F •Relationship between Object & Statement - object O is refereed by statement S - object O is modified by statement S

  15. Database Link Incremental parsing parse only the modified portion • Compilers create a .OBJ file for each compiling unit • JBPAS create an incremental database for each .CPP file

  16. Database Link (continue) Difference btw compiler & code analyzer on declaration • compiler analyze declarations and store their information in the symbol table temporarily • code analyzer extract declarations’ information and store into database permanently

  17. Database Link (continue) Difference btw compiler & code analyzer on declaration • compiler linker resolve all external references • database linker link all incremental databases to one information database keep only one copy of information on shared declaration update corresponding reference to the shared declaration

  18. Database Link : example // C O U R S E .H // T E A C H E R .C P P // S T U D E N T .C P P class C C o u rse{ # in clu d e “C O U R S E .H ” # in clu d e “C O U R S E .H ” c h a r m _ s N a m e [ 6 4 ] ; C C o u rse teach in g ; C C o u rse stu d y in g ; i n t m _ n C r e d i t ; … … … } ; … F ile C O U R S E .H F ile T E A C H E R .C P P F ile S T U D E N T .C P P

  19. Table Class: ID: 20 Name: CCourse … TEACHER.IDB Table Inst_of: ClassID: 20 ObjectID: 200 … Table Object: ID: 200 Name: teaching … Table Class: ID: 30 Name: CCourse … STUDENT.IDB Table Inst_of: ClassID: 30 ObjectID: 300 … Table Object: ID: 300 Name: studying …

  20. Table Class: ID: 20 Name: CCourse … Program Information Table Inst_of: ClassID: 20 ObjectID: 200 … Database ClassID: 20 ObjectID: 300 … Table Object: ID: 200 Name: teaching … ID: 300 Name: studying …

  21. Current status • the C++ front end • the information manager • prototype versions of program understanding system • product version of reverse engineering tool to be released by Jade Bird Co.

  22. Future … • Form a more concise EER model • Implement other analysis tools and integrate them in an integrated environment • Construct similar systems for other object- oriented language

  23. Thank you!

Recommend


More recommend