Patent ID: 7950001

Claim:
A method of instrumentation of a program, comprising: identifying a location of an original instruction in the program; copying the original instruction into an unused user stack space; replacing the original instruction in the program by storing a breakpoint instruction in the identified location of the original instruction to form a modified program, wherein an instruction sequence of the modified program includes the breakpoint instruction in the identified location instead of the original instruction; executing the breakpoint instruction and instructions in the modified program that are before the breakpoint instruction in the sequence, wherein a breakpoint exception is generated in response to executing the breakpoint instruction; executing the original instruction in the unused user stack space out-of-line after executing the breakpoint instruction, wherein execution of the original instruction is single stepped, and wherein a debug exception is generated in response to the single stepping; after executing the original instruction, executing instructions in the modified program that are after the breakpoint instruction in the sequence; prior to copying the original instruction into an unused user stack space, copying the original instruction at the identified location into a kernel data mode in a kernel space; wherein a user probe mechanism defined within the kernel data mode stores the breakpoint instruction in the identified location, and wherein an instruction pointer points to the breakpoint instruction after the breakpoint instruction is stored in the identified location; defining a probe handler in the kernel space when the user probe mechanism uses two exceptions per probe, wherein the two exceptions are the debug exception and the breakpoint exception, wherein the debug exception and the breakpoint exception are handled in the kernel space in the kernel mode; wherein the probe handler executes to collect instrumentation data after the breakpoint instruction has executed; and wherein the probe handler expanded a stack to create the unused user stack space.