Computer Science I / Machine-Level Debugging Logic
Practice question · Put in order

Order the steps of narrowing down a machine-level bug by binary search in time.

Hints
  1. You cannot search a range until you know the range has a good end and a bad end.
  2. Halving is only meaningful once both ends of the gap have been established.
Show the answer
  1. Reproduce the failure so the wrong value appears on every run
  2. Set a breakpoint early and confirm the state is still correct there
  3. Set a breakpoint late and confirm the state is already wrong there
  4. Halve the gap and inspect the state at the midpoint
  5. 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.

Read the lesson: Machine-Level Debugging Logic →

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