Assume a debugger(common x86 ring3 debugger such as olly, IDA, gdb...) sets a software breakpoint to virtual address 0x1234.
this is accomplished by replacing the whatever opcode at 0x1234 to '0xCC' now let's assume that debugee process runs this 0xCC instruction and raises software exception and debugger catches this.
debugger inspects memory contents, registers and do some stuff.. and now it wants to resume the debugee process.
this is as far as I know. from now, its my assumption.
debugger recovers the original opcode(which was replaced to 0xCC) of debugee in order to resume the execution.
debugger manipulates the EIP of debugee's CONTEXT to point the recovered instruction.
debugger handles the exception and now, debugee resumes from breakpoint.
but debugger wants the breakpoint to remain. how can debugger manage this?