# US 11,113,182 B2 · Reversible debugging in a runtime environment

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 11,113,182 B2
- Document ID: US11113182B2
- Status: Granted
- Kind: B2
- Application number: 16/372,210
- Filed: 2019-04-01
- Published: 2020-10-01
- Granted: 2021-09-07
- Earliest claimed: 2019-04-01
- Assignees: Microsoft Technology Licensing, LLC
- Applicants: Microsoft Technology Licensing, LLC
- Inventors: Patrick Lothian Nelson; Jackson Michael Davis; Del Myers; Thomas Lai
- Web page: https://patentgrep.com/patent/US11113182B2

## CPC

- G06F 11/3636: {by tracing the execution of the program}
- G06F 11/3698: Environments for analysis, debugging or testing of software
- G06F 9/45558: {Hypervisor-specific management and integration aspects}
- G06F 30/20: Design optimisation, verification or simulation (optimisation, verification or simulation of circuit designs G06F30/30)
- G06F 2009/45575: {Starting, stopping, suspending or resuming virtual machine instances}
- G06F 2009/45591: {Monitoring or debugging support}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

Performing reverse execution debugging of an application. The method includes identifying a snapshot of application state for an application in an application framework. The method further includes emulating execution of the application, using bytecode, in a forward direction from the snapshot to an end point, causing generation of historical execution state at various points along the emulation of the application. The method further includes collecting the historical execution state. The method further includes using the collected historical execution state, emulating reverse execution of the application by substituting collected historical execution state, when needed, to restore previous state needed as a result of emulation of reverse execution of the application.

## Claims

### Claim 1

A method of performing reverse execution debugging of an application, the method comprising:
identifying a snapshot of application state for the application;
emulating execution of the application on a debugger virtual machine that emulates functionality of a runtime virtual machine, wherein the debugger virtual machines uses intermediate level code to emulate execution of the application on the runtime virtual machine such that at least a portion of the intermediate level code is not converted to native machine instructions and executed on the runtime virtual machine, in a forward direction from the snapshot to an end point, causing generation of emulated historical execution state at various points along the emulation of the application;
collecting the emulated historical execution state; and
using the collected emulated historical execution state, emulating reverse execution of the application by substituting the collected emulated historical execution state, when needed, to restore previous state needed as a result of emulation of reverse execution of the application.

### Claim 2 (depends on 1)

The method of claim 1, wherein collecting the emulated historical execution state comprises collecting the emulated historical execution state into a stack such that the previous state is restored by popping elements of the emulated historical execution state from the stack.

### Claim 3 (depends on 2)

The method of claim 2, wherein there is a different stack for each thread being emulated.

### Claim 4 (depends on 2)

The method of claim 2, wherein an element is popped from the stack when emulated reverse execution identifies an instruction that changes application state to restore the application state to state that was valid immediately prior to the identified instruction.

### Claim 5 (depends on 1)

The method of claim 1, wherein collecting the emulated historical execution state comprises collecting the emulated historical execution state by iteratively emulating execution from the snapshot toward the endpoint, where each iteration of emulated execution emulates execution of progressively smaller portions of the application, such that reverse execution of the application is emulated by surfacing state as a result of each iteration.

### Claim 6 (depends on 5)

The method of claim 5, wherein each iteration executes one less bytecode instruction than the previous iteration.

### Claim 7 (depends on 1)

The method of claim 1, further comprising collecting runtime virtual machine external state for the application by executing machine code for the application in conjunction with emulating execution of the application.

### Claim 8

A computer system comprising:
one or more processors; and
one or more computer-readable media having stored thereon instructions that are executable by the one or more processors to configure the computer system to perform reverse execution debugging of an application, including instructions that are executable to configure the computer system to perform at least the following:
identify a snapshot of application state for the application;
emulate execution of the application on an debugger virtual machine that emulates functionality of a runtime virtual machine, wherein the debugger virtual machines uses intermediate level code to emulate execution of the application on the runtime virtual machine such that at least a portion of the intermediate level code is not converted to native machine instructions and executed on the runtime virtual machine, in a forward direction from the snapshot to an end point, causing generation of emulated historical execution state at various points along the emulation of the application;
collect the emulated historical execution state; and
use the collected emulated historical execution state, emulating reverse execution of the application by substituting the collected emulated historical execution state, when needed, to restore previous state needed as a result of emulation of reverse execution of the application.

### Claim 9 (depends on 8)

The computer system of claim 8, wherein collecting the emulated historical execution state comprises collecting the emulated historical execution state into a stack such that the previous state can be restored by popping elements of the historical execution state from the stack.

### Claim 10 (depends on 9)

The computer system of claim 9, wherein there is a different stack for each thread being emulated.

### Claim 11 (depends on 9)

The computer system of claim 9, wherein an element is popped from the stack when emulated reverse execution identifies an instruction that changes application state.

### Claim 12 (depends on 8)

The computer system of claim 8, wherein collecting the emulated historical execution state comprises collecting the emulated historical execution state by iteratively emulating execution from the snapshot toward the endpoint, where each iteration of emulated execution emulates execution of progressively smaller portions of the application, such that reverse execution of the application is emulated by surfacing state as a result of each iteration.

### Claim 13 (depends on 12)

The computer system of claim 12, wherein each iteration executes one less bytecode instruction than the previous iteration.

### Claim 14 (depends on 8)

The computer system of claim 8, wherein one or more computer-readable media further have stored thereon instructions that are executable by the one or more processors to configure the computer system to collect non-deterministic state for the application by executing lower level application code for the application in conjunction with emulating execution of the application.

### Claim 15

A computer physical readable media having stored thereon instructions that are executable by one or more processors to configure a computer system to perform reverse execution debugging of an application, including instructions that are executable to configure the computer system to perform at least the following:
identify a snapshot of application state for an application in an application framework;
emulate execution of the application on a debugger virtual machine that emulates functionality of a runtime virtual machine, using bytecode, to emulate execution of the application on the runtime virtual machine such that at least a portion of the intermediate level code is not converted to native machine instructions and executed on the runtime virtual machine in a forward direction from the snapshot to an end point, causing generation of emulated historical execution state at various points along the emulation of the application;
collect the emulated historical execution state; and
use the collected emulated historical execution state, emulating reverse execution of the application by substituting the collected emulated historical execution state, when needed, to restore previous state needed as a result of emulation of reverse execution of the application.

### Claim 16 (depends on 15)

The computer readable storage media of claim 15, wherein collecting the emulated historical execution state comprises collecting the emulated historical execution state into a stack such that the previous state can be restored by popping elements of the emulated historical execution state from the stack.

### Claim 17 (depends on 16)

The computer readable storage media of claim 16, wherein there is a different stack for each thread being emulated.

### Claim 18 (depends on 16)

The computer readable storage media of claim 16, wherein an element is popped from the stack when emulated reverse execution identifies an instruction that changes application state.

### Claim 19 (depends on 15)

The computer readable storage media of claim 15, wherein collecting the historical execution state comprises collecting the emulated historical execution state by iteratively emulating execution from the snapshot toward the endpoint, where each iteration of emulated execution emulates execution of progressively smaller portions of the application, such that reverse execution of the application is emulated by surfacing state as a result of each iteration.

### Claim 20 (depends on 16)

The computer readable storage media of claim 16, further comprising instructions that are executable by the one or more processors to configure the computer system to collect runtime virtual machine external state for the application by executing lower level application code for the application in conjunction with emulating execution of the application.
