O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Why Programs Fail, 2nd Edition

Book Description

Why Programs Fail: A Guide to Systematic Debugging is proof that debugging has graduated from a black art to a systematic discipline. It demystifies one of the toughest aspects of software programming, showing clearly how to discover what caused software failures, and fix them with minimal muss and fuss.

The fully updated second edition includes 100+ pages of new material, including new chapters on Verifying Code, Predicting Erors, and Preventing Errors. Cutting-edge tools such as FindBUGS and AGITAR are explained, techniques from integrated environments like Jazz.net are highlighted, and all-new demos with ESC/Java and Spec#, Eclipse and Mozilla are included.

This complete and pragmatic overview of debugging is authored by Andreas Zeller, the talented researcher who developed the GNU Data Display Debugger(DDD), a tool that over 250,000 professionals use to visualize the data structures of programs while they are running. Unlike other books on debugging, Zeller's text is product agnostic, appropriate for all programming languages and skill levels.

The book explains best practices ranging from systematically tracking error reports, to observing symptoms, reproducing errors, and correcting defects. It covers a wide range of tools and techniques from hands-on observation to fully automated diagnoses, and also explores the author's innovative techniques for isolating minimal input to reproduce an error and for tracking cause and effect through a program. It even includes instructions on how to create automated debugging tools.

The text includes exercises and extensive references for further study, and a companion website with source code for all examples and additional debugging resources is available.

  • The new edition of this award-winning productivity-booster is for any developer who has ever been frustrated by elusive bugs
  • Brand new chapters demonstrate cutting-edge debugging techniques and tools, enabling readers to put the latest time-saving developments to work for them
  • Learn by doing. New exercises and detailed examples focus on emerging tools, languages and environments, including AGITAR, FindBUGS, Python and Eclipse

Table of Contents

  1. Cover image
  2. Title page
  3. Table of Contents
  4. Copyright
  5. Foreword
  6. Preface
  7. ACKNOWLEDGMENTS
  8. Chapter 1: How Failures Come to Be
    1. 1.1 MY PROGRAM DOES NOT WORK!
    2. 1.2 FROM DEFECTS TO FAILURES
    3. 1.3 LOST IN TIME AND SPACE
    4. 1.4 FROM FAILURES TO FIXES
    5. 1.5 AUTOMATED DEBUGGING TECHNIQUES
    6. 1.6 BUGS, FAULTS, OR DEFECTS?
    7. 1.7 CONCEPTS
    8. 1.8 TOOLS
    9. 1.9 FURTHER READING
  9. Chapter 2: Tracking Problems
    1. 2.1 OH! ALL THESE PROBLEMS
    2. 2.2 REPORTING PROBLEMS
    3. 2.3 MANAGING PROBLEMS
    4. 2.4 CLASSIFYING PROBLEMS
    5. 2.5 PROCESSING PROBLEMS
    6. 2.6 MANAGING PROBLEM TRACKING
    7. 2.7 REQUIREMENTS AS PROBLEMS
    8. 2.8 MANAGING DUPLICATES
    9. 2.9 RELATING PROBLEMS AND FIXES
    10. 2.10 RELATING PROBLEMS AND TESTS
    11. 2.11 CONCEPTS
    12. 2.12 TOOLS
    13. 2.13 FURTHER READING
  10. Chapter 3: Making Programs Fail
    1. 3.1 TESTING FOR DEBUGGING
    2. 3.2 CONTROLLING THE PROGRAM
    3. 3.3 TESTING AT THE PRESENTATION LAYER
    4. 3.4 TESTING AT THE FUNCTIONALITY LAYER
    5. 3.5 TESTING AT THE UNIT LAYER
    6. 3.6 ISOLATING UNITS
    7. 3.7 DESIGNING FOR DEBUGGING
    8. 3.8 PREVENTING UNKNOWN PROBLEMS
    9. 3.9 CONCEPTS
    10. 3.10 TOOLS
    11. 3.11 FURTHER READING
  11. Chapter 4: Reproducing Problems
    1. 4.1 THE FIRST TASK IN DEBUGGING
    2. 4.2 REPRODUCING THE PROBLEM ENVIRONMENT
    3. 4.3 REPRODUCING PROGRAM EXECUTION
    4. 4.4 REPRODUCING SYSTEM INTERACTION
    5. 4.5 FOCUSING ON UNITS
    6. 4.6 REPRODUCING CRASHES
    7. 4.7 CONCEPTS
    8. 4.8 TOOLS
    9. 4.9 FURTHER READING
  12. Chapter 5: Simplifying Problems
    1. 5.1 SIMPLIFYING THE PROBLEM
    2. 5.2 THE GECKO BUGATHON
    3. 5.3 MANUAL SIMPLIFICATION
    4. 5.4 AUTOMATIC SIMPLIFICATION
    5. 5.5 A SIMPLIFICATION ALGORITHM
    6. 5.6 SIMPLIFYING USER INTERACTION
    7. 5.7 RANDOM INPUT SIMPLIFIED
    8. 5.8 SIMPLIFYING FASTER
    9. 5.9 CONCEPTS
    10. 5.10 TOOLS
    11. 5.11 FURTHER READING
  13. Chapter 6: Scientific Debugging
    1. 6.1 HOW TO BECOME A DEBUGGING GURU
    2. 6.2 THE SCIENTIFIC METHOD
    3. 6.3 APPLYING THE SCIENTIFIC METHOD
    4. 6.4 EXPLICIT DEBUGGING
    5. 6.5 KEEPING A LOGBOOK
    6. 6.6 DEBUGGING QUICK-AND-DIRTY
    7. 6.7 ALGORITHMIC DEBUGGING
    8. 6.8 DERIVING A HYPOTHESIS
    9. 6.9 REASONING ABOUT PROGRAMS
    10. 6.10 CONCEPTS
    11. 6.11 FURTHER READING
  14. Chapter 7: Deducing Errors
    1. 7.1 ISOLATING VALUE ORIGINS
    2. 7.2 UNDERSTANDING CONTROL FLOW
    3. 7.3 TRACKING DEPENDENCES
    4. 7.4 SLICING PROGRAMS
    5. 7.5 DEDUCING CODE SMELLS
    6. 7.6 LIMITS OF STATIC ANALYSIS
    7. 7.7 CONCEPTS
    8. 7.8 TOOLS
    9. 7.9 FURTHER READING
  15. Chapter 8: Observing Facts
    1. 8.1 OBSERVING STATE
    2. 8.2 LOGGING EXECUTION
    3. 8.3 USING DEBUGGERS
    4. 8.4 QUERYING EVENTS
    5. 8.5 HOOKING INTO THE INTERPRETER
    6. 8.6 VISUALIZING STATE
    7. 8.7 CONCEPTS
    8. 8.8 TOOLS
    9. 8.9 FURTHER READING
  16. Chapter 9: Tracking Origins
    1. 9.1 REASONING BACKWARD
    2. 9.2 EXPLORING EXECUTION HISTORY
    3. 9.3 DYNAMIC SLICING
    4. 9.4 LEVERAGING ORIGINS
    5. 9.5 TRACKING DOWN INFECTIONS
    6. 9.6 CONCEPTS
    7. 9.7 TOOLS
    8. 9.8 FURTHER READING
  17. Chapter 10: Asserting Expectations
    1. 10.1 AUTOMATING OBSERVATION
    2. 10.2 BASIC ASSERTIONS
    3. 10.3 ASSERTING INVARIANTS
    4. 10.4 ASSERTING CORRECTNESS
    5. 10.5 ASSERTIONS AS SPECIFICATIONS
    6. 10.6 FROM ASSERTIONS TO VERIFICATION
    7. 10.7 REFERENCE RUNS
    8. 10.8 SYSTEM ASSERTIONS
    9. 10.9 CHECKING PRODUCTION CODE
    10. 10.10 CONCEPTS
    11. 10.11 TOOLS
    12. 10.12 FURTHER READING
  18. Chapter 11: Detecting Anomalies
    1. 11.1 CAPTURING NORMAL BEHAVIOR
    2. 11.2 COMPARING COVERAGE
    3. 11.3 STATISTICAL DEBUGGING
    4. 11.4 COLLECTING DATA IN THE FIELD
    5. 11.5 DYNAMIC INVARIANTS
    6. 11.6 INVARIANTS ON-THE-FLY
    7. 11.7 FROM ANOMALIES TO DEFECTS
    8. 11.8 CONCEPTS
    9. 11.9 TOOLS
    10. 11.10 FURTHER READING
  19. Chapter 12: Causes and Effects
    1. 12.1 CAUSES AND ALTERNATE WORLDS
    2. 12.2 VERIFYING CAUSES
    3. 12.3 CAUSALITY IN PRACTICE
    4. 12.4 FINDING ACTUAL CAUSES
    5. 12.5 NARROWING DOWN CAUSES
    6. 12.6 A NARROWING EXAMPLE
    7. 12.7 THE COMMON CONTEXT
    8. 12.8 CAUSES IN DEBUGGING
    9. 12.9 CONCEPTS
    10. 12.10 FURTHER READING
  20. Chapter 13: Isolating Failure Causes
    1. 13.1 ISOLATING CAUSES AUTOMATICALLY
    2. 13.2 ISOLATING VERSUS SIMPLIFYING
    3. 13.3 AN ISOLATION ALGORITHM
    4. 13.4 IMPLEMENTING ISOLATION
    5. 13.5 ISOLATING FAILURE-INDUCING INPUT
    6. 13.6 ISOLATING FAILURE-INDUCING SCHEDULES
    7. 13.7 ISOLATING FAILURE-INDUCING CHANGES
    8. 13.8 PROBLEMS AND LIMITATIONS
    9. 13.9 CONCEPTS
    10. 13.10 TOOLS
    11. 13.11 FURTHER READING
  21. Chapter 14: Isolating Cause–Effect Chains
    1. 14.1 USELESS CAUSES
    2. 14.2 CAPTURING PROGRAM STATES
    3. 14.3 COMPARING PROGRAM STATES
    4. 14.4 ISOLATING RELEVANT PROGRAM STATES
    5. 14.5 ISOLATING CAUSE–EFFECT CHAINS
    6. 14.6 ISOLATING FAILURE-INDUCING CODE
    7. 14.7 ISSUES AND RISKS
    8. 14.8 CONCEPTS
    9. 14.9 TOOLS
    10. 14.10 FURTHER READING
  22. Chapter 15: Fixing the Defect
    1. 15.1 LOCATING THE DEFECT
    2. 15.2 FOCUSING ON THE MOST LIKELY ERRORS
    3. 15.3 VALIDATING THE DEFECT
    4. 15.4 CORRECTING THE DEFECT
    5. 15.5 WORKAROUNDS
    6. 15.6 CONCEPTS
    7. 15.7 FURTHER READING
  23. Chapter 16: Learning from Mistakes
    1. 16.1 WHERE THE DEFECTS ARE
    2. 16.2 MINING THE PAST
    3. 16.3 WHERE DEFECTS COME FROM
    4. 16.4 ERRORS DURING SPECIFICATION
    5. 16.5 ERRORS DURING PROGRAMMING
    6. 16.6 ERRORS DURING QUALITY ASSURANCE
    7. 16.7 PREDICTING PROBLEMS
    8. 16.8 FIXING THE PROCESS
    9. 16.9 CONCEPTS
    10. 16.10 FURTHER READING
  24. APPENDIX: Formal Definitions
  25. GLOSSARY
  26. BIBLIOGRAPHY
  27. INDEX