Home > other >  Is there a one byte "trap" instruction in x86?
Is there a one byte "trap" instruction in x86?

Time:02-15

I'm looking for a trap instruction that raises a hardware exception so that the program will stop abruptly and the debugger can show where this point is.

ud2 seems to do the job, but is there a one byte option?

CodePudding user response:

Use the int3 instruction with opcode cc. When debugging the program, this instruction causes a breakpoint. When not debugging the program, it usually causes some sort of trap.

  • Related