Practice question · Put in order
Order the steps of narrowing down a machine-level bug by binary search in time.
- Halve the gap and inspect the state at the midpoint
- Set a breakpoint early and confirm the state is still correct there
- Repeat the halving until a single instruction is left, and inspect it
- Reproduce the failure so the wrong value appears on every run
- Set a breakpoint late and confirm the state is already wrong there
Hints
- You cannot search a range until you know the range has a good end and a bad end.
- Halving is only meaningful once both ends of the gap have been established.
Show the answer
- Reproduce the failure so the wrong value appears on every run
- Set a breakpoint early and confirm the state is still correct there
- Set a breakpoint late and confirm the state is already wrong there
- Halve the gap and inspect the state at the midpoint
- Repeat the halving until a single instruction is left, and inspect it
Why
A binary search needs bracketing before bisecting: a point known good and a point known bad, with the fault somewhere between. Halving before establishing both ends leaves you unable to interpret the result at the midpoint, and none of it is repeatable without a reliable reproduction first.
Practise Machine-Level Debugging Logic
The app has 7 more questions on this lesson, and keeps your place in the course. Computer Science I is free to start.
More questions on Machine-Level Debugging Logic
- Sort each debugging move by whether it reasons from evidence or merely guesses.
- A program is made to run on eight cores instead of one and gets four times faster, not eight. What sets the…
- Moore's law described transistor counts doubling roughly every two years, and single-core clock speeds…
- An 8-bit register holds the pattern 11111111. Select every statement that is true.