Академический Документы
Профессиональный Документы
Культура Документы
David Hovemeyer
Using Static Analysis to Find Bugs
program behaviors
May allow the analysis to be more precise in general
David Hovemeyer Finding bugs Bug patterns Conclusions
Using Static Analysis to Find Bugs
David Hovemeyer Finding bugs Bug patterns Conclusions
Using Static Analysis to Find Bugs Background Example bug patterns
Practical issues
Say your program has 100 real bugs Would you rather use A tool that nds all 100 b
ugs, but reports 1,000,000 warnings A tool that nds only 25 bugs, but reports 50
warnings Using a bug- nding tool must be a productive use of the
Bug patterns
developers time
No useful tool will
nd every bug
David Hovemeyer
Using Static Analysis to Find Bugs
David Hovemeyer
Using Static Analysis to Find Bugs
on sequences Can nd bugs involving short code sequences Data ow analysis Symbolical
ly execute methods (keeping track of values) Look for places where values are us
ed in a suspicious way
Example bug patterns
David Hovemeyer
Using Static Analysis to Find Bugs
David Hovemeyer
Using Static Analysis to Find Bugs
Data ow analysis
Some null pointer deferences require sophisticated analysis to
nd
Analyzing across method calls, modeling the contents of heap
objects We have seen many examples of obvious null pointer
dereferences:
Values which are always null Values which were null on some control path
At each point in a method, keep track of data ow facts E.g., which local variables
and stack locations might contain null Symbolically execute the method: Model i
nstructions Model control ow Iterate until a xed point solution is reached
How can we construct an analysis to nd obvious null pointer
dereferences?
David Hovemeyer
Using Static Analysis to Find Bugs
David Hovemeyer
Using Static Analysis to Find Bugs
static analysis
Very active research area Starting to be widely adopted in practice The compiler
course is still relevant!
David Hovemeyer
Using Static Analysis to Find Bugs
David Hovemeyer
Using Static Analysis to Find Bugs