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

c program information database for analysis tools
SMART_READER_LITE
LIVE PREVIEW

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


slide-1
SLIDE 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

slide-2
SLIDE 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 …
slide-3
SLIDE 3

Why program information database?

Program source codes are

primary information source of software systems

Code analyzers

analyze source code for different requirements

slide-4
SLIDE 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++
slide-5
SLIDE 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
slide-6
SLIDE 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
slide-7
SLIDE 7

JBPAS Architecture

C++ Front End PUS RET OOTS CEX CToC++ Information Manager Analysis Toolset

slide-8
SLIDE 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

slide-9
SLIDE 9

How program information database works?

  • Conceptual Model

define what program information to extract

  • database link

incremental parsing

slide-10
SLIDE 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
slide-11
SLIDE 11

JBPAS Conceptual Model

M acro R efer

Sup Sub Sup Sub

d F ile L

  • c_in

Include L

  • c_in

L

  • c_in

C lass O bject Inst_of A ttr_of A ttribute V ariable Inherit F riendC Statem ent Function C

  • ntain

F ct_bdy C all O verload M eth_of F riendM V ar_of

Sup Sub Sup Sub Sup Sub Sup Sub

L

  • c_in
slide-12
SLIDE 12

JBPAS Conceptual Model: Entities

  • Macro
  • File
  • Class
  • Function
  • Object (Attribute & Variable)
  • Statement
slide-13
SLIDE 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

slide-14
SLIDE 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

slide-15
SLIDE 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

slide-16
SLIDE 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

slide-17
SLIDE 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

slide-18
SLIDE 18

Database Link: example

// C O U R S E .H class C C

  • u

rse{ c h a r m _ s N a m e [ 6 4 ] ; i n t m _ n C r e d i t ; … } ; … // T E A C H E R .C P P # in clu d e “C O U R S E .H ” C C

  • u

rse teach in g ; … // S T U D E N T .C P P # in clu d e “C O U R S E .H ” C C

  • u

rse stu d y in g ; … 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

slide-19
SLIDE 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 …

slide-20
SLIDE 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 …

slide-21
SLIDE 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.

slide-22
SLIDE 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-
  • riented language
slide-23
SLIDE 23

Thank you!