• Valmond@lemmy.world
    link
    fedilink
    arrow-up
    2
    ·
    1 month ago

    Hey thank you!

    Not what I thought it was for sure 😃

    How does it work if an instruction gets replaced by the INT3 though?

    • A Basil Plant@lemmy.world
      link
      fedilink
      arrow-up
      3
      ·
      edit-2
      1 month 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.