Code Analysis
- static program analysis
- Analysis of software source code and other artifacts
- dynamic program analysis
- Analysis of output/trace data from running programs
Uses for Static Analysis
- Search/Query
- Metrics
- Support Program Understanding/Comprehension, Code Review
- Reverse Engineering
- Program Transformation
- Program Optimization
- Program Correctness
Use of Graphs
- Form of software visualization
- Allows us to see the overall view instead of getting lost in details
- focus + context
- Onion UML Diagrams
Major Graphs
- Call Graph
- Control Flow Graph (CFG)
- Data Flow Diagram (DFD)
- Program Dependency Graph (PDG)
Call Graph: Function Pointers
Call Graph: Arrays of Functions
What do we do with a call graph?
- Directly: Examine them for interesting patterns
- Indirectly: Generate, then use the information for computation
Control-Flow Graph
- Nodes: statements
- Edges: control flow
Binary Search
