effective-debugging
effective-debugging copied to clipboard
Code examples used in the book Effective Debugging (Addison-Wesley, 2016)
Effective Debugging: Source Code
This repository contains the source code used in the book Effective Debugging (Addison-Wesley, 2016).
Chapter 1: High-Level Strategies
Item 7: Diversify Your Build and Execution Environment
- Demonstrate differences in the size of primitive elements among various architectures and operating systems
Chapter 2: General-Purpose Methods and Practices
Item 12: Automate Complex Testing Scenarios
- Demonstrate debugging through the embedding of Lua
Chapter 4: Debugger Techniques
Item 31: Familiarize Yourself with Reverse Debugging
- Simple program to demonstrate reverse debugging
Item 33: Look for Errors by Examining the Values of Variables and Expressions
- A doubly-linked list in Python
Item 37: Know How to View Assembly Code and Raw Memory
- Examples of how source code is compiled into assembly language
Chapter 5: Programming Techniques
Item 41: Add Logging Statements
- Logging in diverse languages and frameworks
Item 42: Use Unit Tests
- Unit testing of a simple C++ class
Item 43: Use Assertions
- Demonstration of assertions
Item 49: Fix the Bug's Cause, Rather Than Its Symptom
- Demonstrate and verify the use of modulo arithmetic rather than special cases
Chapter 6: Compile-Time Techniques
Item 50: Examine Generated Code
- Demonstrate how assembly code can reveal hidden method calls
Item 51: Use Static Program Analysis
- Demonstrate how FindBugs will report an incorrect spin loop
Item 52: Configure Deterministic Builds and Executions
- Demonstrate deterministic and non-deterministic builds
Item 53: Configure the Use of Debugging Libraries and Checks
- Examples demonstrating bugs caught by enabling compilation options
Chapter 7: Runtime Techniques
Item 57: Profile the Operation of Systems and Processes
- Demonstrate resource utilization issues
Item 59: Use Dynamic Program Analysis Tools
- Demonstrate the use of Valgrind to find memory errors
Chapter 8: Debugging Multi-threaded Code
Item 60: Analyze Deadlocks with Postmortem Debugging
- Programs that deadlock
Item 61: Capture and Replicate
- Source code used for the PinPlay demonstration
Item 62: Uncover Deadlocks and Race Conditions with Specialized Tools
- A race condition in Java
- Source code used for Intel Inspector XE demonstration
Item 64: Investigate Scalability Issues by Looking at Contention
- Demonstrate scalability problem due to lock contention
Item 65: Locate False Sharing by Using Performance Counters
- Demonstrate scalability problem due false sharing
Item 66: Consider Rewriting the Code Using Higher-Level Abstractions
- Demonstrate the speedup that can be obtained through the use of ATLAS
- Demonstrate speedup of R's mclapply function
- Demonstrate the concurrent name resolution of IP addresses