1. A method for tracing an instrumented program comprising: triggering a probe in the instrumented program; obtaining an original instruction associated with the probe; copying a program counter value into a register not used by the original instruction if the original instruction is a position-dependent instruction but not a control-flow instruction, the original instruction dependent on a program counter comprising the program counter value; obtaining a modified instruction by modifying the original instruction to be dependent on the register holding a copy of the program counter value; storing the modified instruction into a scratch space; storing a move instruction for an architecture that supports program counter (pc)-relative addressing into the scratch space, wherein the move instruction comprises data for restoring an original value of the register holding the copy of the program counter value; storing a jump instruction for the architecture that supports pc-relative addressing into the scratch space, wherein the jump instruction includes a next program counter value; executing the modified instruction in the scratch space using the thread; executing the move instruction in the scratch space using the thread to restore the original value of the register; and executing the jump instruction in the scratch space using the thread.