You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+5-2Lines changed: 5 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,6 +37,9 @@ make test
37
37
# Cleans your current builds and removes potential cache
38
38
make clean
39
39
40
+
# Build binaries in Debug mode (https://github.com/mapbox/cpp/blob/master/glossary.md#debug-build)
41
+
make debug
42
+
40
43
# Cleans everything, including the things you download from the network in order to compile (ex: npm packages).
41
44
# This is useful if you want to nuke everything and start from scratch.
42
45
# For example, it's super useful for making sure everything works for Travis, production, someone else's machine, etc
@@ -133,9 +136,9 @@ Once your project has ported node-cpp-skel, follow these steps to integrate your
133
136
### Adding dependencies
134
137
With updated versions of npm, a `package-lock.json` file is created, which is now included in node-cpp-skel. See [`npm-and-package-lock.md`](./docs/npm-and-package-lock.md) for more info on how to interact with this file and how to add new dependencies.
135
138
136
-
### Debug
139
+
### Interactive Debugging
137
140
138
-
*[Debug with VS CODE](./docs/howToDebugWithVSCode.md)
141
+
*[Debugging with VS Code](./docs/debugging-with-vs-code.md)
Copy file name to clipboardExpand all lines: docs/debugging-with-vs-code.md
+18-10Lines changed: 18 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,14 +1,22 @@
1
1
# How to debug C++ with VS Code
2
2
3
-
VS Code is a great tool to develop code in many languages. This document is to tell you how to debug C++ addon with the VS Code.
3
+
VS Code is a great source code editor for developing code in many languages. This document is to tell you how to debug a node C++ addon with VS Code.
4
4
5
-
### 1. Setting up VSCode debug
5
+
### 1. Setting up VS Code debug
6
6
7
-
To Set up the VSCode debug you have two ways to achieve:
7
+
First open the node C++ addon folder in VS Code by choosing `File > Open`.
8
8
9
-
Option 1: Press Cmd + Shift + P to open the command bar, and type open `open launch.json`, choose `C++`.
9
+
Then to start debugging there are two ways:
10
10
11
-
Option 2: Click the debug button on the right sidebar, and Click the ⚙ button on the right top, choose `C++`.
11
+
#### Option 1
12
+
13
+
Press `Cmd + Shift + P` to open the command bar, type open `open launch.json`, and then choose `C++`.
14
+
15
+
Note: the first time you do this you will need to `install` the C++ Extension and reload the app.
16
+
17
+
#### Option 2
18
+
19
+
Click the debug button on the right sidebar, click the `⚙` button on the right top, and then choose `C++`.
12
20
13
21

14
22
@@ -34,15 +42,15 @@ In the `launch.json` you can see some template, like this:
34
42
}
35
43
```
36
44
37
-
`launch.json`defined which program you want to run after you click the run debug button, let's say we want run `node test/vtshaver.test.js`(In this command we want to use `node` to run `test/vtshaver.test.js`), so we need to change the configurations, put `program` to node's absolute path(you can use `which node` to find the path of current version of node), and change the `args` to `test/vtshaver.test.js`'s absolute path.
45
+
`launch.json`defines which program you want to run after you click the run debug button. Let's say we want run `node test/vtshaver.test.js`. In this case we need to change the configurations, put `program` to node's absolute path(you can use `which node` to find the path of current version of node), and change the `args` to `${workspaceFolder}/test/vtshaver.test.js`.
38
46
39
47
Additional we want build C++ everytime before we start debug, so we add `preLaunchTask` into the config:
40
48
41
49
```
42
50
"preLaunchTask": "npm: build:dev",
43
51
```
44
52
45
-
Untill now, the config file could looks like this:
53
+
Now the config file could look like this:
46
54
47
55
48
56
```json
@@ -55,7 +63,7 @@ Untill now, the config file could looks like this:
@@ -66,10 +74,10 @@ Untill now, the config file could looks like this:
66
74
}
67
75
```
68
76
69
-
Now you can open any C++ files and click the left side of the line number to add a breakpoint, then go to the debug button on the sidebar, click the run button on the top.
77
+
Now you can open any C++ files and click the left side of the line number to add a breakpoint, then go to the debug button on the sidebar, click the run button on the top.
70
78
71
79

72
80
73
-
Now everything is done! Debug is Done! The program will stop at the breakpoint, you can use your mouse to explore the variable. If you want you program to continue from the breakpoint, you can navigate the program use the top control box.
81
+
Now everything is done! Debug is Done! The program will stop at the breakpoint, you can use your mouse to explore the variable. If you want your program to continue past the breakpoint, you can navigate the program using the top control box.
0 commit comments