Why Single Stepping Instruction on X86?

后端 未结 5 1962
太阳男子
太阳男子 2021-01-01 00:03

So there is \"int 3\" which is an interrupt instruction used for breakpoints in debuggers.

But then there is also \"int 1\" which is used for single stepping. But wh

5条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-01 00:40

    int 3 is a special 1-byte interrupt. Invoking it will break into the debugger if one is present, otherwise the application will typically crash.

    When the debugger sets the trap flag, this causes the processor to automatically execute an int 1 interrupt after every instruction. This allows the debugger to single-step by instructions, without having to insert an int 3 instruction. You do not have to invoke this interrupt explicitly.

提交回复
热议问题