1. A method for altering execution of a program on a computer, wherein the program resides in a memory unit that has a logical address space assigned to it, and wherein the method comprises: operating the computer to start executing the program; operating the computer to suspend execution of the program; selecting a patch insertion address within a logical address range of the program, saving original code residing at the patch insertion address; generating a patch routine; writing a jump instruction to the patch insertion address, thus overwriting said original code, wherein the jump instruction is arranged to instruct the computer to jump to a start address of the patch routine; and operating the computer to resume execution of the program; wherein the patch routine is arranged to prompt the computer to: save a current context of the program; execute a user code; restore the saved context of the program; and execute a surrogate code which is equivalent to said original code.