("\n> Returned error: " + err.name + "\n") ("\n> Trace was successfully indexed in " + (timeE - timeS) + " ms\n") ("\n> Index Return Value: " + IndexOutput + "\n") To check to see if errors were raised when the indexing was run, enclose the indexing code in a try catch statement. Here is the output from a small trace file. ("\n> Trace was indexed in " + (timeE - timeS) + " ms\n") This code shows an example IndexTrace function that displays how long it takes to re-index a trace file. For more information, see Time Travel Debugging - Working with Trace Files. If just a trace file is copied over to a different PC, it will need to be re-indexed. Running the script now displays the proper message that indicates that the position was set to the start of the TTD trace. To test the script use the !tt command to navigate half way in the trace file. > Position was already set to the start of the TTD file In this example run, a message is displayed that we were all ready at the start of the trace file. ("> Position was already set to the start of the TTD file \n") If (parseInt(PositionOutputStart,16) != parseInt(PositionOutputNew,16)) WinDbg TTD JavaScript ResetTraceEx SampleĬonst PositionOutputStart = Ĭonst PositionOutputNew = In this expanded sample, the starting and ending position values are compared to see if the position in the trace changed. Running this code displays the current and new position. ("> New position in trace file: "+ PositionOutputNew +"\n") ("> Current position in trace file: "+ PositionOutputStart +"\n") WinDbg TTD JavaScript Sample to Reset Trace using objects directly In this example ResetTraceEnd function, the position is set to the end of the trace and the current and new position is displayed using the currentThread.TTD Position object. > Set position to the start of the TTD file (948.148c): Break instruction exception - code 80000003 (first/second chance not available) Running this code shows that we are able to move to the start of the trace file. ("> Set position to the start of the TTD file \n") WinDbg TTD JavaScript ResetTrace Sample The following example shows how to use the objects directly to complete the same task using the objects directly. A better approach is to use the TTD objects directly. And parsing that output leads to code that is brittle and hard to maintain. > Sent command to move to the start of the TTD fileĭ.Contents.ResetTrace()īut for all but the simplest situations, the approach of sending commands has drawbacks. Var dbgControl = .Control Īfter a TTD file is loaded in WinDbg, call the function ResetTraceCmd() function using the dx command in the debugger command window. WinDbg TTD JavaScript ResetTraceCmd Sample We can make this into a ResetTrace function, and save it as ResetTrace.js, using the JavaScript UI in WinDbg. ("> Sent command to move to the start of the TTD file \n") var dbgControl = .Control ĭbgControl.ExecuteCommand("!tt 0",false) This JavaScript shows how to move to the start of a time travel trace using the !tt command. One way to use JavaScript for TTD automation, is to send commands to automate working with time travel trace files. There are also JavaScript Debugger Example Scripts. You can use JavaScript automation to work with TTD traces in a number of ways, such as command automation or using queries to locate event data from the trace file.įor general information about working with JavaScript see JavaScript Debugger Scripting.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |