Effective Debugging: 66 Specific Ways to Debug Software and Systems

Book description

Every software developer and IT professional understands the crucial importance of effective debugging. Often, debugging consumes most of a developer’s workday, and mastering the required techniques and skills can take a lifetime. In Effective Debugging, Diomidis Spinellis helps experienced programmers accelerate their journey to mastery, by systematically categorizing, explaining, and illustrating the most useful debugging methods, strategies, techniques, and tools.

Drawing on more than thirty-five years of experience, Spinellis expands your arsenal of debugging techniques, helping you choose the best approaches for each challenge. He presents vendor-neutral, example-rich advice on general principles, high-level strategies, concrete techniques, high-efficiency tools, creative tricks, and the behavioral traits associated with effective debugging.

Spinellis’s 66 expert techniques address every facet of debugging and are illustrated with step-by-step instructions and actual code. He addresses the full spectrum of problems that can arise in modern software systems, especially problems caused by complex interactions among components and services running on hosts scattered around the planet. Whether you’re debugging isolated runtime errors or catastrophic enterprise system failures, this guide will help you get the job done—more quickly, and with less pain.

Key features include

  • High-level strategies and methods for addressing diverse software failures

  • Specific techniques to apply when programming, compiling, and running code

  • Better ways to make the most of your debugger

  • General-purpose skills and tools worth investing in

  • Advanced ideas and techniques for escaping dead-ends and the maze of complexity

  • Advice for making programs easier to debug

  • Specialized approaches for debugging multithreaded, asynchronous, and embedded code

  • Bug avoidance through improved software design, construction, and management

  • Table of contents

    1. About This E-Book
    2. Title Page
    3. Copyright Page
    4. Dedication Page
    5. Contents
    6. Figures
    7. Listings
    8. Preface
      1. What This Book Covers
      2. How to Use This Book
      3. How to Live Your Life
      4. A Few Notes on Terminology
      5. Typographical and Other Conventions
      6. Where to Get the Code and Errata
    9. Acknowledgments
    10. About the Author
    11. 1. High-Level Strategies
      1. Item 1: Handle All Problems through an Issue-Tracking System
        1. Things to Remember
      2. Item 2: Use Focused Queries to Search the Web for Insights into Your Problem
        1. Things to Remember
      3. Item 3: Confirm That Preconditions and Postconditions Are Satisfied
        1. Things to Remember
      4. Item 4: Drill Up from the Problem to the Bug or Down from the Program’s Start to the Bug
        1. Things to Remember
      5. Item 5: Find the Difference between a Known Good System and a Failing One
        1. Things to Remember
      6. Item 6: Use the Software’s Debugging Facilities
        1. Things to Remember
      7. Item 7: Diversify Your Build and Execution Environment
        1. Things to Remember
      8. Item 8: Focus Your Work on the Most Important Problems
        1. Things to Remember
    12. 2. General-Purpose Methods and Practices
      1. Item 9: Set Yourself Up for Debugging Success
        1. Things to Remember
      2. Item 10: Enable the Efficient Reproduction of the Problem
        1. Things to Remember
      3. Item 11: Minimize the Turnaround Time from Your Changes to Their Result
        1. Things to Remember
      4. Item 12: Automate Complex Testing Scenarios
        1. Things to Remember
      5. Item 13: Enable a Comprehensive Overview of Your Debugging Data
        1. Things to Remember
      6. Item 14: Consider Updating Your Software
        1. Things to Remember
      7. Item 15: Consult Third-Party Source Code for Insights on Its Use
        1. Things to Remember
      8. Item 16: Use Specialized Monitoring and Test Equipment
        1. Things to Remember
      9. Item 17: Increase the Prominence of a Failure’s Effects
        1. Things to Remember
      10. Item 18: Enable the Debugging of Unwieldy Systems from Your Desk
        1. Things to Remember
      11. Item 19: Automate Debugging Tasks
        1. Things to Remember
      12. Item 20: Houseclean Before and After Debugging
        1. Things to Remember
      13. Item 21: Fix All Instances of a Problem Class
        1. Things to Remember
    13. 3. General-Purpose Tools and Techniques
      1. Item 22: Analyze Debug Data with Unix Command-Line Tools
        1. Things to Remember
      2. Item 23: Utilize Command-Line Tool Options and Idioms
        1. Things to Remember
      3. Item 24: Explore Debug Data with Your Editor
        1. Things to Remember
      4. Item 25: Optimize Your Work Environment
        1. Things to Remember
      5. Item 26: Hunt the Causes and History of Bugs with the Revision Control System
        1. Things to Remember
      6. Item 27: Use Monitoring Tools on Systems Composed of Independent Processes
        1. Things to Remember
    14. 4. Debugger Techniques
      1. Item 28: Use Code Compiled for Symbolic Debugging
        1. Things to Remember
      2. Item 29: Step through the Code
        1. Things to Remember
      3. Item 30: Use Code and Data Breakpoints
        1. Things to Remember
      4. Item 31: Familiarize Yourself with Reverse Debugging
        1. Things to Remember
      5. Item 32: Navigate along the Calls between Routines
        1. Things to Remember
      6. Item 33: Look for Errors by Examining the Values of Variables and Expressions
        1. Things to Remember
      7. Item 34: Know How to Attach a Debugger to a Running Process
        1. Things to Remember
      8. Item 35: Know How to Work with Core Dumps
        1. Things to Remember
      9. Item 36: Tune Your Debugging Tools
        1. Things to Remember
      10. Item 37: Know How to View Assembly Code and Raw Memory
        1. Things to Remember
    15. 5. Programming Techniques
      1. Item 38: Review and Manually Execute Suspect Code
        1. Things to Remember
      2. Item 39: Go Over Your Code and Reasoning with a Colleague
        1. Things to Remember
      3. Item 40: Add Debugging Functionality
        1. Things to Remember
      4. Item 41: Add Logging Statements
        1. Things to Remember
      5. Item 42: Use Unit Tests
        1. Things to Remember
      6. Item 43: Use Assertions
        1. Things to Remember
      7. Item 44: Verify Your Reasoning by Perturbing the Debugged Program
        1. Things to Remember
      8. Item 45: Minimize the Differences between a Working Example and the Failing Code
        1. Things to Remember
      9. Item 46: Simplify the Suspect Code
        1. Things to Remember
      10. Item 47: Consider Rewriting the Suspect Code in Another Language
        1. Things to Remember
      11. Item 48: Improve the Suspect Code’s Readability and Structure
        1. Things to Remember
      12. Item 49: Fix the Bug’s Cause, Rather Than Its Symptom
        1. Things to Remember
    16. 6. Compile-Time Techniques
      1. Item 50: Examine Generated Code
        1. Things to Remember
      2. Item 51: Use Static Program Analysis
        1. Things to Remember
      3. Item 52: Configure Deterministic Builds and Executions
        1. Things to Remember
      4. Item 53: Configure the Use of Debugging Libraries and Checks
        1. Things to Remember
    17. 7. Runtime Techniques
      1. Item 54: Find the Fault by Constructing a Test Case
        1. Things to Remember
      2. Item 55: Fail Fast
        1. Things to Remember
      3. Item 56: Examine Application Log Files
        1. Things to Remember
      4. Item 57: Profile the Operation of Systems and Processes
        1. Things to Remember
      5. Item 58: Trace the Code’s Execution
        1. Things to Remember
      6. Item 59: Use Dynamic Program Analysis Tools
        1. Things to Remember
    18. 8. Debugging Multi-threaded Code
      1. Item 60: Analyze Deadlocks with Postmortem Debugging
        1. Things to Remember
      2. Item 61: Capture and Replicate
        1. Things to Remember
      3. Item 62: Uncover Deadlocks and Race Conditions with Specialized Tools
        1. Things to Remember
      4. Item 63: Isolate and Remove Nondeterminism
        1. Things to Remember
      5. Item 64: Investigate Scalability Issues by Looking at Contention
        1. Things to Remember
      6. Item 65: Locate False Sharing by Using Performance Counters
        1. Things to Remember
      7. Item 66: Consider Rewriting the Code Using Higher-Level Abstractions
        1. Things to Remember
    19. Web Resources
    20. Index
    21. Code Snippets

    Product information

    • Title: Effective Debugging: 66 Specific Ways to Debug Software and Systems
    • Author(s): Diomidis Spinellis
    • Release date: June 2016
    • Publisher(s): Addison-Wesley Professional
    • ISBN: 9780134394909