Dr. Dobb's Journal - March 2008 - (Page 22) Core Technology by Paul Anderson Detecting Bugs in Safety-Critical Code Advanced static analysis When software is used for safety-critical applications, bugs aren’t just expensive annoyances—they can kill. Faced with such dire consequences, developers of safety-critical systems Paul is VP of Engineering at GrammaTech. He can be contacted at paul@grammatech.com. go to great lengths to prevent bugs from making it into the field. These measures are undeniably effective at reducing risk. Although there have been some famous catastrophic failures over the years, if medical devices or flight-control systems failed as often as most software fails, the headlines would be much grimmer. So how do they do it, and how can those of us who do not write safety-critical code emulate their success? Well, there are many strategies, but two stand out as being key and offer important lessons for other developers—static analysis and rigorous testing. Historically, static analysis had been used to enforce standards or style rules, and do some superficial syntactic checks for patterns that might indicate flaws. While helpful, especially as standards such as Misra C (misra.org.uk) or JSF C++ (www.research.att .com/~bs/JSF-AV-rules.pdf) are widely used by safetycritical software developers, these old-style tools have been difficult to use effectively, not least because of their high false-positive rate. Recently, a new breed of “advanced” static-analysis tools has emerged. These are capable of finding serious bugs such as buffer overruns, null pointer dereferences, resource leaks, and race conditions. They can also highlight inconsistencies or contradictions in the code, such as unreachable code, useless assignments, and redundant conditions, all of which often indicate programmer confusion, and correlate well with bugs. In Gerald Holzmann’s “Ten Rules for Writing Safety-Critical Code” (www.spinroot.com/p10), rule 10 specifies that advanced static-analysis tools should be used proactively all through the development process. Systematic testing is the other prong. As well as being a good idea, often it’s also the law. Regulators such as the FAA specify strict rules about how code is tested before it can be deployed in a safety-critical device. In some cases, developers must demonstrate that test suites achieve full coverage of the code. The trouble with this is that it can be enormously expensive to develop these test suites. However, advanced staticanalysis tools can help reduce the cost by steering developers away from futile or unnecessary work. In this article, I focus on advanced static analysis, how it complements traditional testing, and how it can be used for both bug finding and for reducing testing costs. Advanced Static Analysis With roots in esoteric techniques such as model checking and abstract interpretation, advanced static analysis is not your father’s technology. Instead of complaining endlessly about stylistic discrepancies or superficial syntactic problems, this new breed of tools can find serious coding flaws. They integrate easily 22 Dr. Dobb’s Journal l www.ddj.com l March 2008 http://misra.org.uk http://www.research.att.com/~bs/JSF-AV-rules.pdf http://www.research.att.com/~bs/JSF-AV-rules.pdf http://www.spinroot.com/p10 http://www.ddj.com
Table of Contents Feed for the Digital Edition of Dr. Dobb's Journal - March 2008 Dr. Dobb's Journal - March 2008 Contents Hmmmm Alia Vox Developer Diaries Developer’s Notebook Social Networks and Software Development Conversations Detecting Bugs in Safety-Critical Code Change Code Without Fear Continuous Integration and Performance Testing Wt: A Web Toolkit Automating Release Notifications The Agile Edge Effective Concurrency Swaine’s Flames Dr. Dobb's Journal - March 2008 Dr. Dobb's Journal - March 2008 - (Page Belly1) Dr. Dobb's Journal - March 2008 - (Page Belly2) Dr. Dobb's Journal - March 2008 - Dr. Dobb's Journal - March 2008 (Page Cover1) Dr. Dobb's Journal - March 2008 - Dr. Dobb's Journal - March 2008 (Page Cover2) Dr. Dobb's Journal - March 2008 - Dr. Dobb's Journal - March 2008 (Page 1) Dr. Dobb's Journal - March 2008 - Dr. Dobb's Journal - March 2008 (Page 2) Dr. Dobb's Journal - March 2008 - Dr. Dobb's Journal - March 2008 (Page 3) Dr. Dobb's Journal - March 2008 - Contents (Page 4) Dr. Dobb's Journal - March 2008 - Contents (Page 5) Dr. Dobb's Journal - March 2008 - Hmmmm (Page 6) Dr. Dobb's Journal - March 2008 - Hmmmm (Page 7) Dr. Dobb's Journal - March 2008 - Hmmmm (Page 8) Dr. Dobb's Journal - March 2008 - Hmmmm (Page 9) Dr. Dobb's Journal - March 2008 - Alia Vox (Page 10) Dr. Dobb's Journal - March 2008 - Alia Vox (Page 11) Dr. Dobb's Journal - March 2008 - Developer Diaries (Page 12) Dr. Dobb's Journal - March 2008 - Developer Diaries (Page 13) Dr. Dobb's Journal - March 2008 - Developer’s Notebook (Page 14) Dr. Dobb's Journal - March 2008 - Developer’s Notebook (Page 15) Dr. Dobb's Journal - March 2008 - Social Networks and Software Development (Page 16) Dr. Dobb's Journal - March 2008 - Social Networks and Software Development (Page 17) Dr. Dobb's Journal - March 2008 - Social Networks and Software Development (Page 18) Dr. Dobb's Journal - March 2008 - Social Networks and Software Development (Page 19) Dr. Dobb's Journal - March 2008 - Conversations (Page 20) Dr. Dobb's Journal - March 2008 - Conversations (Page 21) Dr. Dobb's Journal - March 2008 - Detecting Bugs in Safety-Critical Code (Page 22) Dr. Dobb's Journal - March 2008 - Detecting Bugs in Safety-Critical Code (Page 23) Dr. Dobb's Journal - March 2008 - Detecting Bugs in Safety-Critical Code (Page 24) Dr. Dobb's Journal - March 2008 - Detecting Bugs in Safety-Critical Code (Page 25) Dr. Dobb's Journal - March 2008 - Detecting Bugs in Safety-Critical Code (Page 26) Dr. Dobb's Journal - March 2008 - Detecting Bugs in Safety-Critical Code (Page 27) Dr. Dobb's Journal - March 2008 - Change Code Without Fear (Page 28) Dr. Dobb's Journal - March 2008 - Change Code Without Fear (Page 29) Dr. Dobb's Journal - March 2008 - Change Code Without Fear (Page 30) Dr. Dobb's Journal - March 2008 - Change Code Without Fear (Page 31) Dr. Dobb's Journal - March 2008 - Change Code Without Fear (Page 32) Dr. Dobb's Journal - March 2008 - Change Code Without Fear (Page 33) Dr. Dobb's Journal - March 2008 - Change Code Without Fear (Page 34) Dr. Dobb's Journal - March 2008 - Change Code Without Fear (Page 35) Dr. Dobb's Journal - March 2008 - Continuous Integration and Performance Testing (Page 36) Dr. Dobb's Journal - March 2008 - Continuous Integration and Performance Testing (Page 37) Dr. Dobb's Journal - March 2008 - Continuous Integration and Performance Testing (Page 38) Dr. Dobb's Journal - March 2008 - Continuous Integration and Performance Testing (Page 39) Dr. Dobb's Journal - March 2008 - Continuous Integration and Performance Testing (Page 40) Dr. Dobb's Journal - March 2008 - Continuous Integration and Performance Testing (Page 41) Dr. Dobb's Journal - March 2008 - Continuous Integration and Performance Testing (Page 42) Dr. Dobb's Journal - March 2008 - Continuous Integration and Performance Testing (Page 43) Dr. Dobb's Journal - March 2008 - Continuous Integration and Performance Testing (Page 44) Dr. Dobb's Journal - March 2008 - Continuous Integration and Performance Testing (Page 45) Dr. Dobb's Journal - March 2008 - Continuous Integration and Performance Testing (Page 46) Dr. Dobb's Journal - March 2008 - Continuous Integration and Performance Testing (Page 47) Dr. Dobb's Journal - March 2008 - Continuous Integration and Performance Testing (Page 48) Dr. Dobb's Journal - March 2008 - Continuous Integration and Performance Testing (Page 49) Dr. Dobb's Journal - March 2008 - Continuous Integration and Performance Testing (Page 50) Dr. Dobb's Journal - March 2008 - Continuous Integration and Performance Testing (Page 51) Dr. Dobb's Journal - March 2008 - Continuous Integration and Performance Testing (Page 52) Dr. Dobb's Journal - March 2008 - Continuous Integration and Performance Testing (Page 53) Dr. Dobb's Journal - March 2008 - Continuous Integration and Performance Testing (Page 54) Dr. Dobb's Journal - March 2008 - Wt: A Web Toolkit (Page 55) Dr. Dobb's Journal - March 2008 - Wt: A Web Toolkit (Page 56) Dr. Dobb's Journal - March 2008 - Wt: A Web Toolkit (Page 57) Dr. Dobb's Journal - March 2008 - Wt: A Web Toolkit (Page 58) Dr. Dobb's Journal - March 2008 - Wt: A Web Toolkit (Page 59) Dr. Dobb's Journal - March 2008 - Automating Release Notifications (Page 60) Dr. Dobb's Journal - March 2008 - Automating Release Notifications (Page 61) Dr. Dobb's Journal - March 2008 - Automating Release Notifications (Page 62) Dr. Dobb's Journal - March 2008 - Automating Release Notifications (Page 63) Dr. Dobb's Journal - March 2008 - Automating Release Notifications (Page 64) Dr. Dobb's Journal - March 2008 - The Agile Edge (Page 65) Dr. Dobb's Journal - March 2008 - The Agile Edge (Page 66) Dr. Dobb's Journal - March 2008 - The Agile Edge (Page 67) Dr. Dobb's Journal - March 2008 - Effective Concurrency (Page 68) Dr. Dobb's Journal - March 2008 - Effective Concurrency (Page 69) Dr. Dobb's Journal - March 2008 - Effective Concurrency (Page 70) Dr. Dobb's Journal - March 2008 - Effective Concurrency (Page 71) Dr. Dobb's Journal - March 2008 - Swaine’s Flames (Page 72) Dr. Dobb's Journal - March 2008 - Swaine’s Flames (Page Cover3) Dr. Dobb's Journal - March 2008 - Swaine’s Flames (Page Cover4)
For optimal viewing of this digital publication, please enable JavaScript and then refresh the page. If you would like to try to load the digital publication without using Flash Player detection, please click here.