Oh Oh, stack corruption. Or at least it looks like stack corruption. Someone's scrawling on memory, it doesn't always happen the same way, and you're able to Use Tracing to rule out noxious thread interactions. When you Ask The Code it doesn't happen the same way.
Therefore,
Chop out the first half of your program. Do things still screw up? If so, the problem must be in the second half. Otherwise it's likely in the first. Verify that. Now take the half where you know the problem lies and chop out half of it. Repeat until you say Ah Ha, or you discover an Environment Problem. -- Peter Merel
However,
Remember that the Binary Chop is one of the least efficient debugging tricks you have in your bag. While it will almost always converge on a solution, regardless of environmental problems, it will do so slowly, at a high cost in time and effort. Binary Chop is a "technique of last resort" - to be used after other appropriate techniques fail.
I think that's much too strong. Binary Chop can be time-consuming if pursued as a matter of course, but often one or two iterations of it can be combined with the rest of the Debugging Pattern Language to shorten the time taken. Debugging is helped by controlled experiments - show me a positive before a negative - and a little Binary Chop can often get you that faster.
In terms of efficiency (and only efficiency), Binary Chop is to Code Unit Test First, as Binary Search is to Hash Table. I.e. O(log n) vs. O(1). Binary Chop is definitely more efficient on a large scale than linear debugging methods such as reading the code or stepping through the debugger, although once you have narrowed the problem area, stepping through the debugger can be better than continuing with Binary Chop.
The two parts don't have to have equal size or complexity. You should aim to get the same probability of error in each one. -- Dave Harris
If you know a large portion of the program is correct, then this can reduce to Spike Solution. Forget all the mundane stuff; just write a small test program involving the new library/algorithm/language feature that's the Simplest Thing That Could Possibly Work (or not work). I use this often when playing around with Haskell Language. -- Jonathan Tang
POD is good for doing this since Perl doesn't have block comments.
=head1 Here's some cruddy code to switch off $foo = 73; do_something_stupid($foo); =cut
The Binary Chop is also the method you used to have to use on Mac Os Classic to pin down a misbehaving Extension or Control Panel that was causing crashes or weird behavior. -- Earle Martin
Binary Chop was the only technique available in my most Heroic Debugging performance. -- John Farrell
(Description moved to Heroic Debugging page.)
Vaguely related to Abstraction Chop.
See original on c2.com