|
1 | | -Node.js on ChakraCore |
2 | | -=== |
3 | | -This project enables Node.js to optionally use the ChakraCore JavaScript engine. This project is still **work in progress** and not an officially supported Node.js branch. Please refer to the original [PR](https://github.com/nodejs/node/pull/4765). |
| 1 | +# Time Travel Debugging with Node-ChakraCore |
| 2 | + |
| 3 | +Stepping forward after hitting a breakpoint is a familiar experience but what |
| 4 | +if you can step back in time? Frequently developers find themselves hunting |
| 5 | +for failure clues (e.g. error text) in the log files and then searching for |
| 6 | +that in the code. Once the log statement is found in the source code, the |
| 7 | +developer is left to re-construct the context for the error. |
| 8 | + |
| 9 | +Not anymore! Time-Travel debugging (TTD) allows developers to look at the |
| 10 | +faulting code within the full fidelity of the debugger with all the runtime |
| 11 | +context preserved. TTD works on the record and playback principle, the record |
| 12 | +mode creates a trace file during execution which can then be played back |
| 13 | +allowing developers to deeply inspect the code as it was during the original |
| 14 | +execution. |
| 15 | + |
| 16 | +## How to get started |
| 17 | +This is a preview of the TTD functionality we are adding to Node & ChakraCore. |
| 18 | +There are bugs and performance issues that make it unsuitable for use as a |
| 19 | +production debugger. However, we are developing in the open we want to share |
| 20 | +our progress and hopefully get feedback, bug reports, functionality requests, |
| 21 | +and pull-requests from the community. We are working to stabilize and rapidly |
| 22 | +improve the TTD functionality so check in often for updates! |
| 23 | + |
| 24 | +### Setup |
| 25 | +To get started with TTD you will need the following: |
| 26 | + |
| 27 | +- VSCode Insider Build from here |
| 28 | +- Install Node-ChakraCore with TTD from [here]() |
| 29 | + (or build the ```debugging-ttd-preview``` branch from [node/node-chakracore](https://github.com/nodejs/node-chakracore)) |
| 30 | + |
| 31 | +Note: Currently TTD support is available on Windows only. Linux support will be available soon. |
| 32 | + |
| 33 | +### Record TTD trace |
| 34 | +To record a trace for debugging run the TTD enabled build of node with the record flag: |
| 35 | +```node.exe -TTRecord:<Location to save Trace> <app script>``` |
| 36 | +Where the location of the saved trace is a **relative path** from the location of the TTD node.exe file. |
| 37 | + |
| 38 | +### Debug a TTD Trace with VSCode |
| 39 | +Make the following additions to the launch.json configuration in the VSCode project: |
| 40 | +- Add the following to ```runtimeArgs``` ```["--nolazy", "-TTReplay:<Location of saved Trace>", "-TTBreakFirst"]```. |
| 41 | +- Set the runtime executable to the TTD enabled build of node.js. |
| 42 | + |
| 43 | +### Sample Program |
| 44 | +The code for the WorkItemTracker sample is available [here](https://github.com/mrkmarron/WorkItemTrackerDemo). |
| 45 | + |
| 46 | +## Feedback |
| 47 | +Please let us know on our [issues page](https://github.com/nodejs/node-chakracore/issues) if you have any question or comment. |
4 | 48 |
|
5 | | -### How it works |
6 | | - |
7 | | -To enable building and running Node.js with the ChakraCore JavaScript engine, a V8 API shim (ChakraShim) is created on top of the ChakraCore runtime hosting API ([JSRT] |
8 | | -(https://msdn.microsoft.com/en-us/library/dn249673(v=vs.94).aspx)). ChakraShim implements the most essential V8 APIs so that the underlying JavaScript engine change is transparent to Node.js and other native addon modules written for V8. |
9 | | - |
10 | | -A rebuild node.exe and native addon modules with ChakraCore is required for this to work. |
11 | | - |
12 | | -### Issues |
13 | | -Please report all issues related to Node-ChakraCore on this separate [issue page](https://github.com/nodejs/node-chakracore/issues). |
14 | | - |
15 | | -### Prebuilt Node binaries |
16 | | -You can download and install prebuilt Node-ChakraCore from [here](https://github.com/nodejs/node-chakracore/releases). |
17 | | - |
18 | | -### How to build |
19 | | -If you are looking to build this yourself. Here's what you will need. |
20 | | - |
21 | | -Prerequisites: |
22 | | -* Windows 7 SP1 or higher (Windows 8.1 or higher for ARM builds) |
23 | | -* [Python 2.6 or 2.7](https://www.python.org) |
24 | | -* [Visual |
25 | | -Studio](https://www.visualstudio.com/en-us/downloads/download-visual-studio-vs.aspx) |
26 | | - |
27 | | -Build Command: |
28 | | -```batch |
29 | | -vcbuild chakracore nosign [x86|x64|arm] |
30 | | -``` |
31 | | - |
32 | | -### How to test |
33 | | - |
34 | | -```batch |
35 | | -vcbuild chakracore nobuild test [x86|x64|arm] |
36 | | -``` |
37 | | - |
38 | | -To test if Node.js was built correctly with ChakraCore: |
39 | | - |
40 | | -```batch |
41 | | -C:\>node -e "console.log('Hello from Node.js ' + process.jsEngine)" |
42 | | -Hello from Node.js chakracore |
43 | | -``` |
|
0 commit comments