IP Library Granted Patent US 8,832,666
Granted Patent B2
US 8,832,666 · App. 12/642,973 · Granted Sep 9, 2014

Dynamic instrumentation

View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 8,832,666
App. No.
12/642,973
Granted
Sep 9, 2014
Kind
B2
Abstract

A method and system for instrumentation are provided along with a method for instrumentation preparation. The method for instrumentation preparation may comprise obtaining address data of an original instruction in an original instruction stream, obtaining kernel mode data comprising a kernel breakpoint handler, obtaining user mode data comprising a user breakpoint handler, allocating a page of a process address space, creating a trampoline, associating the trampoline with a breakpoint instruction, and replacing the original instruction with the breakpoint instruction. The method for instrumentation may comprise detecting the breakpoint instruction, calling the kernel breakpoint handler, modifying an instruction pointer via the kernel breakpoint handler such that the instruction pointer points to the trampoline, and executing the trampoline. The system for instrumentation may comprise a breakpoint setup module and a breakpoint execution module for respectively setting up and completing instrumentation involving the trampoline.

Claims (61)

1. A method comprising:

obtaining address data of an original instruction in an original instruction stream;

obtaining kernel mode data comprising a kernel breakpoint handler;

obtaining user mode data comprising a user breakpoint handler;

creating a trampoline comprising a copy of the original instruction, a set of instructions for performing a call to the user breakpoint handler, a set of instructions for saving register states and stack data of the original instruction, and a set of instructions for restoring the register states and the stack data of the original instruction;

registering the kernel breakpoint handler to associate the trampoline with a breakpoint instruction;

replacing the original instruction with the breakpoint instruction;

detecting the breakpoint instruction; and

subsequent to detecting the breakpoint instruction, executing the trampoline by operation of one or more processors, wherein executing the trampoline comprises executing the original instruction.

2. The method according to claim 1 , further comprising:

allocating a page of a process address space;

storing the trampoline in the page; and

copying the user breakpoint handler to the page.

3. The method according to claim 1 , wherein the trampoline further comprises a set of instructions for performing a jump to a next instruction following the original instruction in the original instruction stream.

4. The method according to claim 2 , wherein allocating the page comprises mapping the page to the process address space.

5. The method according to claim 1 , wherein executing the trampoline further comprises at least one of saving the register states and the stack data of the original instruction and restoring the register states and the stack data of the original instruction.

6. The method according to claim 1 , wherein executing the trampoline further comprises jumping to a next instruction following the original instruction in the original instruction stream.

7. The method according to claim 1 , further comprising:

calling the kernel breakpoint handler; and

modifying an instruction pointer via the kernel breakpoint handler such that the instruction pointer points to the trampoline.

8. A computer program product including a non-transitory computer readable medium having program code instructions embodied therewith, the program code instructions executable by a computing device to perform an operation comprising:

obtaining address data of an original instruction in an original instruction stream;

obtaining kernel mode data comprising a kernel breakpoint handler;

obtaining user mode data comprising a user breakpoint handler;

creating a trampoline comprising a copy of the original instruction, a set of instructions for performing a call to the user breakpoint handler, a set of instructions for saving register states and stack data of the original instruction, and a set of instructions for restoring the register states and the stack data of the original instruction;

registering the kernel breakpoint handler to associate the trampoline with a breakpoint instruction;

replacing the original instruction with the breakpoint instruction;

detecting the breakpoint instruction; and

subsequent to detecting the breakpoint instruction, executing the trampoline by operation of one or more processors, wherein executing the trampoline comprises executing the original instruction.

9. The computer program product according to claim 8 , wherein the operation further comprises:

allocating a page of a process address space;

storing the trampoline in the page; and

copying the user breakpoint handler to the page.

10. The computer program product according to claim 8 , wherein the trampoline further comprises a set of instructions for performing a jump to a next instruction following the original instruction in the original instruction stream.

11. The computer program product according to claim 9 , wherein allocating the page comprises mapping the page to the process address space.

12. The computer program product according to claim 8 , wherein executing the trampoline further comprises at least one of saving the register states and the stack data of the original instruction and restoring the register states and the stack data of the original instruction.

13. The computer program product according to claim 8 , wherein executing the trampoline further comprises jumping to a next instruction following the original instruction in the original instruction stream.

14. The computer program product according to claim 8 , wherein the operation further comprises:

calling the kernel breakpoint handler; and

modifying an instruction pointer via the kernel breakpoint handler such that the instruction pointer points to the trampoline.

15. A system comprising:

a processor; and

a memory storing instructions, which, when executed on the processor, perform an operation comprising:

obtaining address data of an original instruction in an original instruction stream;

obtaining kernel mode data comprising a kernel breakpoint handler;

obtaining user mode data comprising a user breakpoint handler;

creating a trampoline comprising a copy of the original instruction, a set of instructions for performing a call to the user breakpoint handler, a set of instructions for saving register states and stack data of the original instruction, and a set of instructions for restoring the register states and the stack data of the original instruction;

registering the kernel breakpoint handler to associate the trampoline with a breakpoint instruction;

replacing the original instruction with the breakpoint instruction;

detecting the breakpoint instruction; and

subsequent to detecting the breakpoint instruction, executing the trampoline by operation of one or more processors, wherein executing the trampoline comprises executing the original instruction.

16. The system according to claim 15 , wherein the operation further comprises:

allocating a page of a process address space;

storing the trampoline in the page; and

copying the user breakpoint handler to the page.

17. The system according to claim 15 , wherein the trampoline further comprises a set of instructions for performing a jump to a next instruction following the original instruction in the original instruction stream.

18. The system according to claim 15 , wherein executing the trampoline further comprises at least one of saving the register states and the stack data of the original instruction and restoring the register states and the stack data of the original instruction.

19. The system according to claim 15 , wherein executing the trampoline further comprises jumping to a next instruction following the original instruction in the original instruction stream.

20. The system according to claim 15 , wherein the operation further comprises:

calling the kernel breakpoint handler; and

modifying an instruction pointer via the kernel breakpoint handler such that the instruction pointer points to the trampoline.

Assignments (2)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Nov 10, 2014
From: INTERNATIONAL BUSINESS MACHINES CORPORATION
To: LENOVO INTERNATIONAL LIMITED
Reel/Frame 034194/0291 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Dec 21, 2009
From: SINGH, BALBIR; SONI, MANEESH
To: INTERNATIONAL BUSINESS MACHINES CORPORATION
Reel/Frame 023681/0465 →