Page 146 - The Art of Designing Embedded Systems
P. 146
CHAPTER 7
Troubleshooting Tools
Developers expect long, painful debugging sessions. We plunge into
system debug without thinking through the benefits and perils of this step,
and as a result generally wind up in a nightmare of bugs and schedule
panics.
As discussed in Chapter 2, a careful program of Code Inspections
will eliminate 70 to 80% of the bugs in a system before the first bit of test-
ing commences. The same chapter also shows how a careful developer can
count and manage bugs to identify bad code and take appropriate action
early.
An HP study concluded that the debugging process itself is flawed, as
it generally exercises only half of the code. That is, no one is smart enough
to construct a test that checks every possible IF-THEN condition, each
CASE in a SWITCH statement. This surely reinforces the need for Code
Inspections, but clearly even Inspections combined with test will result in
substantial chunks of untested-and thus buggy4ode.
~
The math is simple. Most code runs around a 5% bug rate after
compiler-found syntax errors are corrected. A little 10,000-line pro-
gram will typically have about 500 bugs before inspection and test.
Code Inspections will identify about 70 to 80% of these, leaving
some 100 still latent. Test, then, is our last defense against shipping
a bug-ridden product . . . but test only exercises half the code, leav-
ing 50 bugs still in the finished unit!
133

