| |
| |
About the Author | |
| |
| |
Acknowledgments | |
| |
| |
Introduction | |
| |
| |
| |
Preventative Medicine | |
| |
| |
| |
Core Problems | |
| |
| |
| |
Time to Market Pressure | |
| |
| |
| |
Fluid Specifications | |
| |
| |
| |
Trade Features for Time | |
| |
| |
| |
Get It in Writing | |
| |
| |
| |
Complexity | |
| |
| |
| |
Defensive Programming | |
| |
| |
| |
Cohesion and Coupling | |
| |
| |
| |
Checking for Bad Input | |
| |
| |
| |
Data Scope | |
| |
| |
| |
Logging | |
| |
| |
| |
Documentation | |
| |
| |
| |
Design for Change | |
| |
| |
| |
Incremental Refinement | |
| |
| |
| |
Unit Testing | |
| |
| |
| |
Motivation Behind Automated Testing | |
| |
| |
| |
Steps Towards a Framework | |
| |
| |
| |
Framework Extensions | |
| |
| |
| |
Tool Configuration | |
| |
| |
| |
Use Compiler Warnings | |
| |
| |
| |
Build Settings | |
| |
| |
| |
Machine Dependencies | |
| |
| |
| |
Endianess | |
| |
| |
| |
Memory Alignment | |
| |
| |
| |
Data Type Sizes | |
| |
| |
| |
The Benefits of a Virtual Machine | |
| |
| |
| |
Summary | |
| |
| |
The Bottom Line: Why Do Bugs Occur? | |
| |
| |
Refinement Checklist: Proactive Bug Prevention | |
| |
| |
| |
Debugging Tactics | |
| |
| |
| |
Initial Steps | |
| |
| |
| |
Duplicate the Bug | |
| |
| |
| |
Bugs That Can't Be Duplicated | |
| |
| |
| |
Verify the Bug Is Genuine | |
| |
| |
| |
Resolving the Bug: Quick Fixes | |
| |
| |
| |
Examine Recent Changes | |
| |
| |
| |
Use Tracing Information | |
| |
| |
| |
Deja Vu | |
| |
| |
| |
Know When to Quit | |
| |
| |
| |
Resolving the Bug: The Scientific Method | |
| |
| |
| |
General Approach | |
| |
| |
| |
Locating the Bug: Incremental Integration | |
| |
| |
| |
Locating the Bug: Binary Search | |
| |
| |
| |
Understand the Problem | |
| |
| |
| |
Preventing Careless Errors | |
| |
| |
| |
Diagnostic Tools | |
| |
| |
| |
Basic Debugger Operation | |
| |
| |
| |
Record Keeping | |
| |
| |
| |
Individual Record Keeping | |
| |
| |
| |
Collaborative Record Keeping | |
| |
| |
| |
Summary | |
| |
| |
| |
Understand the Problem | |
| |
| |
| |
How Knowledge Is Lost | |
| |
| |
| |
Competition | |
| |
| |
| |
Attrition | |
| |
| |
| |
Promotion | |
| |
| |
| |
Poorly Written Code | |
| |
| |
| |
Design Problems | |
| |
| |
| |
Obfuscation | |
| |
| |
| |
Misleading Code | |
| |
| |
| |
Reverse Engineering | |
| |
| |
| |
General Strategies | |
| |
| |
| |
Countermeasures | |
| |
| |
| |
Creating a Knowledge Base | |
| |
| |
| |
Summary | |
| |
| |
| |
Debugger Internals | |
| |
| |
| |
Types of Debuggers | |
| |
| |
| |
Machine Debuggers vs. Symbolic Debuggers | |
| |
| |
| |
Debugging Infrastructures: Custom Built | |
| |
| |
| |
Debugging Infrastructures: System Calls | |
| |
| |
| |
Debugging Infrastructures: Interpreters | |
| |
| |
| |
Kernel Debuggers | |
| |
| |
| |
Interface: Command Line vs. GUI | |
| |
| |
| |
Symbolic Debugger Extensions | |
| |
| |
| |
Dynamic Breakpoints | |
| |
| |
| |
Single Stepping | |
| |
| |
| |
Countertactics | |
| |
| |
| |
System Calls | |
| |
| |
| |
Remove Debug Information | |
| |
| |
| |
Code Salting | |
| |
| |
| |
Mixed Memory Models | |
| |
| |
| |
Summary | |
| |
| |
| |
Optimization: Memory Footprint | |
| |
| |
| |
Forgotten History | |
| |
| |
| |
Program Layout in Memory | |
| |
| |
| |
Scenario: A Single Segment | |
| |
| |
| |
Scenario: Code and Data Segments Only | |
| |
| |
| |
Scenario: All Four Segment Types | |
| |
| |
| |
Code Segment | |
| |
| |
| |
Cut-and-Paste Programming | |
| |
| |
| |
Macros | |
| |
| |
| |
Dead Code | |
| |
| |
| |
Data Segment | |
| |
| |
| |
Dual-Use Data Structures | |
| |
| |
| |
Bit Fields | |
| |
| |
| |
Compression Algorithms | |
| |
| |
| |
Stack Segment | |
| |
| |
| |
Activation Records | |
| |
| |
| |
Function Parameters | |
| |
| |
| |
Local Variables | |
| |
| |
| |
Heap | |
| |
| |
| |
Memory Pools | |
| |
| |
| |
Recycling | |
| |
| |
| |
Lazy Instantiation | |
| |
| |
| |
Tracking Memory Usage | |
| |
| |
| |
Summary | |
| |
| |
| |
Optimization: CPU Cycles | |
| |
| |
| |
Program Control Jumps | |
| |
| |
| |
Labels and GOTO | |
| |
| |
| |
Function Parameters | |
| |
| |
| |
Functions with a Varying Number of Arguments | |
| |
| |
| |
System Calls | |
| |
| |
| |
Recursion | |
| |
| |
| |
Program Control Branching | |
| |
| |
| |
Lookup Tables | |
| |
| |
| |
switch vs. if-else | |
| |
| |
| |
Common Case First, Infrequent Case Last | |
| |
| |
| |
Program Control Loops | |
| |
| |
| |
Loop Invariants | |
| |
| |
| |
Function Calls | |
| |
| |
| |
Array References | |
| |
| |
| |
Breaking Up Compound Boolean Expressions | |
| |
| |
| |
Loop Unrolling | |
| |
| |
| |
Loop Jamming | |
| |
| |
| |
Extracting Program Branching Statements | |
| |
| |
| |
Memory Management | |
| |
| |
| |
Dealing with the Overhead | |
| |
| |
| |
Locality of Reference | |
| |
| |
| |
Input/Output | |
| |
| |
| |
Caching | |
| |
| |
| |
Buffering | |
| |
| |
| |
Advanced Techniques | |
| |
| |
| |
Exceptions | |
| |
| |
| |
Dynamic Registration Model | |
| |
| |
| |
Static Table Model | |
| |
| |
| |
Dealing with Overhead | |
| |
| |
| |
Abusing Exceptions | |
| |
| |
| |
Expensive Operations | |
| |
| |
| |
Eliminate Common Subexpressions | |
| |
| |
| |
Floating Point Calculation Myths | |
| |
| |
| |
Strength Reduction | |
| |
| |
| |
Synchronization | |
| |
| |
| |
Shorthand Operator Myths | |
| |
| |
| |
Quick Fixes | |
| |
| |
| |
Better Hardware | |
| |
| |
| |
Constrain the Problem | |
| |
| |
| |
Compiler Settings | |
| |
| |
| |
Summary | |
| |
| |
| |
Putting It All Together | |
| |
| |
| |
Final Words of Advice | |
| |
| |
| |
Other Threats to Source Code Integrity | |
| |
| |
Fashionable Technology: A Case Study | |
| |
| |
Brainwashing 101 | |
| |
| |
The Real Issue | |
| |
| |
| |
Maintaining a Paper Trail | |
| |
| |
Quietly Keep Records | |
| |
| |
The Myth of Privacy | |
| |
| |
| |
History Repeats Itself | |
| |
| |
The "New Economy" Hits Home | |
| |
| |
Index | |