P
US9875173B2ActiveUtilityPatentIndex 89

Time travel debugging in managed runtime

Assignee: MICROSOFT CORPPriority: Jun 30, 2014Filed: Jun 30, 2014Granted: Jan 23, 2018
Est. expiryJun 30, 2034(~8 yrs left)· nominal 20-yr term from priority
Inventors:MARRON MARKBARR EARL THEODORE
G06F 11/362
89
PatentIndex Score
21
Cited by
89
References
20
Claims

Abstract

Various technologies described herein pertain to time travel debugging in a managed runtime system. The managed runtime system can include an execution component that executes a managed program component. Moreover, the managed runtime system can include a time travel debugger component. The time travel debugger component can be configured to record a sequence of live-object snapshots of program states during execution of the managed program component. A live-object snapshot can include live objects from a heap in memory at a given time during the execution. Moreover, the time travel debugger component can be configured to replay at least a portion of the execution of the managed program component based upon the live-object snapshots.

Claims

exact text as granted — not AI-modified
What is claimed is: 
     
       1. A computing system, comprising:
 at least one processor; and 
 memory that comprises computer-executable instructions that, when executed by the at least one processor, cause the at least one processor to perform acts including:
 executing a managed program component, the managed program component being executed under control of a managed runtime system; and 
 performing time travel debugging of the managed program component executed under control of the managed runtime system, wherein performing the time travel debugging comprises:
 recording a sequence of live-object snapshots of program states during execution of the managed program component, a live-object snapshot comprises live objects from a heap in the memory at a given time during the execution, and at least one dead object amongst the live objects in the heap is omitted from the live-object snapshot; and 
 replaying at least a portion of the execution of the managed program component to enable forwards and backwards navigation through the execution of the managed program component from a target time, wherein replaying the portion of the managed program component comprises restoring a selected live-object snapshot from the sequence of live-object snapshots that precedes the target time and re-executing the managed program component from the selected live-object snapshot. 
 
 
 
     
     
       2. The computing system of  claim 1 , performing the time travel debugging further comprises performing copying traversal of the live objects in the heap at the given time during the execution to record the live objects as part of the live-object snapshot, wherein the at least one dead object amongst the live objects in the heap at the given time is omitted from the live-object snapshot by performing the copying traversal of the live objects. 
     
     
       3. The computing system of  claim 2 , performing the time travel debugging further comprises selectively controlling whether the copying traversal of the live objects in the heap is performed at the given time based on performance of a garbage collection. 
     
     
       4. The computing system of  claim 1 , performing the time travel debugging further comprises dynamically adjusting a time interval at which the live-object snapshots are sequentially recorded, the time interval being dynamically adjusted during the execution of the managed program component. 
     
     
       5. The computing system of  claim 1 , the memory further comprising computer-executable instructions that, when executed by the at least one processor, cause the at least one processor to perform acts including:
 performing a garbage collection to release portions of the memory for the at least one dead object in the heap and compact the live objects into a contiguous range in the memory, the garbage collection performed by the managed runtime system, performance of the garbage collection triggered based upon an amount of free memory in the heap and a remaining amount of time until the live-object snapshot is due to be captured, the live-object snapshot being a next live-object snapshot in the sequence; 
 wherein performing the time travel debugging further comprises directly outputting the contiguous range in the memory that includes the live objects as at least part of the live-object snapshot, the contiguous range in the memory being directly outputted responsive to performance of the garbage collection. 
 
     
     
       6. The computing system of  claim 1 , wherein:
 the heap is divided into a nursery and an old space; and 
 the memory further comprising computer-executable instructions that, when executed by the at least one processor, cause the at least one processor to perform acts including:
 tracking objects in the old space modified since a last live-object snapshot in the sequence utilizing a write barrier; 
 wherein performing the time travel debugging further comprises capturing the live-object snapshot, capturing the live-object snapshot further comprises:
 performing copying traversal of live objects in the nursery of the heap at the given time during the execution to record the live objects in the nursery as part of the live-object snapshot; and 
 recording, as part of the live-object snapshot, the objects in the old space indicated as being modified since the last live-object snapshot in the sequence. 
 
 
 
     
     
       7. The computing system of  claim 1 , wherein:
 the heap is divided into a nursery and an old space; and 
 the memory further comprising computer-executable instructions that, when executed by the at least one processor, cause the at least one processor to perform acts including:
 performing a garbage collection to release portions of the memory for dead objects in the nursery and compact live objects in the nursery into a contiguous range in the memory, the garbage collection performed by the managed runtime system, performance of the garbage collection triggered based upon an amount of free memory in the heap and a remaining amount of time until the live-object snapshot is due to be captured, the live-object snapshot being a next live-object snapshot in the sequence; and 
 tracking objects in the old space modified since a last live-object snapshot in the sequence utilizing a write barrier; 
 wherein performing the time travel debugging further comprises capturing the live-object snapshot, capturing the live-object snapshot further comprises:
 responsive to performing the garbage collection, directly outputting the contiguous range in the memory that includes the live objects in the nursery as part of the live-object snapshot; and 
 recording, as part of the live-object snapshot, the objects in the old space indicated as being modified since the last live-object snapshot in the sequence. 
 
 
 
     
     
       8. The computing system of  claim 1 , wherein the heap is divided into a nursery and an old space, the computing system further comprises:
 hardware page protection that protects pages in the old space, the hardware page protection performs a copy-on-write on a page in the old space to create the live-object snapshot of contents of the page, the live-object snapshot of the contents of the page created subsequent to a last live-object snapshot in the sequence; 
 wherein performing the time travel debugging further comprises capturing the live-object snapshot, capturing the live-object snapshot further comprises:
 recording live objects in the nursery as part of the live-object snapshot; and 
 recording the copy of the page as part of the live-object snapshot. 
 
 
     
     
       9. The computing system of  claim 1 , wherein:
 the sequence of the live-object snapshots of the program states during the execution of the managed program component being recorded during execution of an optimized build of the managed program component; and 
 the execution of the managed program component being replayed utilizing a debug build of the managed program component with the live-object snapshots of the program states recorded during the execution of the first optimized of the managed program component. 
 
     
     
       10. The computing system of  claim 1 , wherein:
 the managed program component interacts with a persistent file during the execution; and 
 the memory further comprising computer-executable instructions that, when executed by the at least one processor, cause the at least one processor to perform acts including:
 managing storage and retrieval of contents of the persistent file, the storage and the retrieval of the contents of the persistent file being managed by the managed runtime system, the persistent file comprises:
 current file contents; and 
 persistent structures that comprise a history of previous versions for bytes written to the persistent file during the execution of the managed program component. 
 
 
 
     
     
       11. The computing system of  claim 10 , wherein managing the storage and the retrieval of the contents of the persistent file further comprises:
 identifying whether a write operation to a file position in the persistent file is within a range of file positions previously read during the execution of the managed program component; 
 overwriting an old value at the file position in the current file contents if the file position is outside the range of the file positions; and 
 writing the old value at the file position to the persistent structures and overwriting the old value at the file position in the current file contents if the file position is within the range of the file positions. 
 
     
     
       12. The computing system of  claim 1 , the memory further comprising computer-executable instructions that, when executed by the at least one processor, cause the at least one processor to perform acts including:
 performing a garbage collection utilizing a mark-region garbage collector, the garbage collection being performed by the managed runtime system, wherein at least a particular region is dense with live objects subsequent to performance of the garbage collection; 
 wherein performing the time travel debugging further comprises capturing at least the particular region as part of the live-object snapshot responsive to the performance of the garbage collection. 
 
     
     
       13. The computing system of  claim 1 , performing the time travel debugging further comprises:
 capturing log data from a trace of external interactions handled by the managed runtime system between the live-object snapshots during the execution of the managed program component; 
 wherein the portion of the execution of the managed program component is further replayed based upon the log data. 
 
     
     
       14. A method of performing time travel debugging in a managed runtime system, comprising:
 executing a managed program component, the managed program component being executable under control of the managed runtime system, the managed program component interacts with a persistent file during execution, the persistent file comprises current file contents and persistent structures that comprise a history of previous versions for bytes written to the persistent file during the execution of the managed program component; 
 recording a sequence of live-object snapshots of program states during the execution of the managed program component, a live-object snapshot comprises live objects from a heap in memory at a given time during the execution, and at least one dead object amongst the live objects in the heap is omitted from the live-object snapshot; and 
 replaying at least a portion of the execution of the managed program component to enable forwards and backwards navigation through the execution of the managed program component, the portion of the execution of the managed program component being replayed based upon:
 the history of the previous versions for the bytes written to the persistent file during the execution of the managed program component; and 
 the live-object snapshots. 
 
 
     
     
       15. The method of  claim 14 , further comprising:
 during the execution of the managed program component and responsive to a write operation at a position in the persistent file:
 identifying whether the file position is within a range of file positions previously read during the execution of the managed program component; 
 if the file position is identified as being within the range of the file positions:
 writing an old value at the file position to the persistent structures; and 
 overwriting the old value at the file position in the current file contents; and 
 
 if the file position is identified as being outside the range of the file positions:
 overwriting the old value at the file position in the current file contents without writing the old value at the file position to the persistent structures. 
 
 
 
     
     
       16. The method of  claim 14 , the persistent structures further comprise a range of previously read file positions, the method further comprising:
 during the execution of the managed program component and responsive to a read operation at a position in the persistent file;
 adjusting the range of the previously read file positions to include the position in the persistent file. 
 
 
     
     
       17. A method of performing time travel debugging in a managed runtime system, comprising:
 executing a managed program component, the managed program component being executable under control of the managed runtime system; 
 recording a sequence of live-object snapshots of program states during execution of the managed program component, a live-object snapshot comprises live objects from a heap in memory at a given time during the execution of the managed program component, and at least one dead object amongst the live objects in the heap is omitted from the live-object snapshot; 
 capturing log data from a trace of external interactions handled by the managed runtime system between the live-object snapshots during the execution of the managed program component; and 
 replaying at least a portion of the execution of the managed program component to enable forwards and backwards navigation through the execution of the managed program component from a target time, wherein replaying the portion of the execution of the managed program component comprises:
 restoring a selected live-object snapshot from the sequence of the live-object snapshots that precedes the target time; and 
 re-executing the managed program component from the selected live-object snapshot based on the external interactions from the log data. 
 
 
     
     
       18. The method of  claim 17 , further comprising:
 performing a garbage collection; and 
 responsive to performance of the garbage collection, recording the live-object snapshot at the given time during the execution of the managed program component, a contiguous range in the memory that includes the live objects being recorded as at least part of the live object snapshot. 
 
     
     
       19. The method of  claim 18 , further comprising:
 triggering the performance of the garbage collection based upon an amount of free memory in the heap and a remaining amount of time until the live-object snapshot is due to be captured, the live-object snapshot being a next live-object snapshot in the sequence. 
 
     
     
       20. The method of  claim 17 , further comprising:
 performing copying traversal of the live objects in the heap at the given time during the execution of the managed program component to record the live objects as part of the live-object snapshot, wherein the at least one dead object amongst the live objects in the heap at the given time is omitted from the live-object snapshot by performing the copying traversal of the live objects.

Cited by (0)

No later patents cite this yet.

References (0)

No backward citations on record.