You can replace the first byte with INT3.
I guess the handler looks up the address and can replace the byte, and the code will run as intended.
But what happens if you do not want the break point removed?
I can think of two options.
- Save (RIP - 1), set single step, after single step put INT3 back, remove single step
- Have code that knows the instruction and its size, copy this to memory with a jump after the original code.
I would love to hear any feed back on how others have handled this.
Regards, Ali.