Module 1: What is Program Analysis? Overview of Dynamic, Static, Hybrid Flashcards

1
Q

what is program analysis?

A

body of work to discover useful facts about programs (e.g. errors)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

3 types of program analysis

A
  1. dynamic (execution time)
  2. static (compile time)
  3. hybrid (combines dynamic and static)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

dynamic program analysis

A

infers facts about the program by monitoring its runs

  • purify: array bound checking
  • memory leak detection: valgrind
  • data race detection: eraser
  • finding likely invariants: daikon
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

static analysis

A

infers facts about the program by inspecting its source or binary code

  • suspicious error patterns: lint, findbugs, coverity
  • checking api usage rules: microsoft slam
  • memory leak detection: facebook infer
  • verifying invariants: ESC/Java
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

program invariant

A

a fact that is true in every run of the program
static analysis: can determine that something is definitely an invariant
dynamic analysis: can determine that something is likely an invariant

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

components of static analysis

A
  1. program representation: e.g. control-flow graph, AST, or bytecode
  2. abstract domain: e.g. how to approximate program values
  3. transfer function: e.g. assignments, conditionals, merge points
  4. fixed point computation algorithm: e.g. iterative approximation
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

components of static analysis

A
  1. program representation: e.g. control-flow graph, AST, or bytecode
  2. abstract domain: e.g. how to approximate program values
  3. transfer function: e.g. assignments, conditionals, merge points
  4. fixed point computation algorithm: e.g. iterative approximation
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

how can static analysis be sound even though it sacrifices completeness?

A

even though the abstraction causes us to lose some information, when the analysis concludes something about the program, it is true in all runs of the program

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

when is a program sound?

A

if it never accepts bad programs

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

when is a program complete?

A

if it never rejects a good program

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

decide if the analysis (depicted by the blue oval) is sound or complete:

A

sound

not complete

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

false positive

A

a good program that is rejected by an analysis

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

is this analysis sound or complete?

A

not sound

complete

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

false negative

A

bad program that is accepted by an analysis

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

precision and recall (a method of measuring the usefulness of an analysis)

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

f-measure

A
16
Q

f-measure of best possible program analysis

A

1

17
Q

f-measure of worst possible program analysis

A

0

18
Q

3 consumers of program ananlysis

A

compilers
IDE’s
software quality tools (testing, debugging, verification) - main focus of course