• A Basil Plant@lemmy.world
    link
    fedilink
    arrow-up
    1
    ·
    edit-2
    7 months ago

    Excellent question!

    Before replacing the instruction with INT 3, the debugger keeps a note of what instruction was at that point in the code. When the CPU encounters INT 3, it hands control to the debugger.

    When the debugging operations are done, the debugger replaces the INT 3 with the original instruction and makes the instruction pointer go back one step, thereby ensuring that the original instruction is executed.