Skip to content

Commit aa27f65

Browse files
authored
Merge pull request #71 from Distributive-Network/Xmader/docs/debugging-steps
Add docs for debugging steps & Support debugging in VSCode's built-in debugger
2 parents 301fa37 + f0108de commit aa27f65

File tree

4 files changed

+125
-3
lines changed

4 files changed

+125
-3
lines changed

.vscode/launch.json

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"name": "(gdb) Debug",
6+
"type": "cppdbg",
7+
"request": "launch",
8+
"program": "python",
9+
"args": [
10+
"${file}"
11+
],
12+
"pipeTransport": {
13+
"pipeCwd": "${workspaceFolder}",
14+
"pipeProgram": "poetry",
15+
"quoteArgs": false,
16+
"pipeArgs": [
17+
"run"
18+
],
19+
},
20+
"preLaunchTask": "Build",
21+
"cwd": "${fileDirname}",
22+
"environment": [],
23+
"externalConsole": false,
24+
"MIMode": "gdb",
25+
"setupCommands": [
26+
{
27+
"description": "Enable pretty-printing for gdb",
28+
"text": "-enable-pretty-printing",
29+
"ignoreFailures": true
30+
},
31+
{
32+
"description": "Set Disassembly Flavor to Intel",
33+
"text": "-gdb-set disassembly-flavor intel",
34+
"ignoreFailures": true
35+
}
36+
]
37+
},
38+
]
39+
}

.vscode/tasks.json

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
{
2+
"tasks": [
3+
//
4+
// Setup
5+
//
6+
{
7+
"label": "Setup SpiderMonkey",
8+
"type": "process",
9+
"command": "./setup.sh",
10+
},
11+
//
12+
// Build
13+
//
14+
{
15+
"label": "Build",
16+
"type": "process",
17+
"command": "poetry",
18+
"args": [
19+
"install",
20+
],
21+
"problemMatcher": [
22+
"$gcc"
23+
],
24+
"group": {
25+
"kind": "build",
26+
"isDefault": true
27+
}
28+
},
29+
//
30+
// Test
31+
//
32+
{
33+
"label": "Install development dependencies",
34+
"type": "process",
35+
"command": "poetry",
36+
"args": [
37+
"install",
38+
"--no-root",
39+
"--only=dev"
40+
],
41+
},
42+
{
43+
"label": "Run pytest",
44+
"type": "process",
45+
"command": "poetry",
46+
"args": [
47+
"run",
48+
"pytest",
49+
"./tests/python"
50+
],
51+
},
52+
{
53+
"label": "Test",
54+
"dependsOrder": "sequence",
55+
"dependsOn": [
56+
"Install development dependencies",
57+
"Run pytest",
58+
],
59+
"group": {
60+
"kind": "test",
61+
"isDefault": true
62+
}
63+
},
64+
],
65+
"options": {
66+
"cwd": "${workspaceFolder}"
67+
},
68+
"problemMatcher": [],
69+
"version": "2.0.0"
70+
}

README.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,10 @@ this package to execute our complex `dcp-client` library, which is written in JS
4545
- JS TypedArrays coerce to Python TypeArrays
4646

4747
## Build Instructions
48-
1. You will need the following installed (which can be done automatically by running ``./setup.sh``):
48+
49+
Read this if you want to build a local version.
50+
51+
1. You will need the following installed (which can be done automatically by running `./setup.sh`):
4952
- cmake
5053
- doxygen
5154
- graphviz
@@ -59,11 +62,15 @@ this package to execute our complex `dcp-client` library, which is written in JS
5962

6063
2. Run `poetry install`. This command automatically compiles the project and installs the project as well as dependencies into the poetry virtualenv.
6164

65+
If you are using VSCode, you can just press <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>B</kbd> to [run build task](https://code.visualstudio.com/docs/editor/tasks#_custom-tasks) - We have [the `tasks.json` file configured for you](.vscode/tasks.json).
66+
6267
## Running tests
6368
1. Compile the project
6469
2. Install development dependencies: `poetry install --no-root --only=dev`
6570
3. From the root directory, run `poetry run pytest ./tests/python`
6671

72+
For VSCode users, similar to the Build Task, we have a Test Task ready to use.
73+
6774
## Using the library
6875

6976
### Install from [PyPI](https://pypi.org/project/pythonmonkey/)
@@ -98,6 +105,14 @@ Type "help", "copyright", "credits" or "license" for more information.
98105

99106
Alternatively, you can build a `wheel` package by running `poetry build --format=wheel`, and install it by `pip install dist/*.whl`.
100107

108+
## Debugging Steps
109+
110+
1. [build the project locally](#build-instructions)
111+
2. To use gdb, run `poetry run gdb python`.
112+
See [Python Wiki: DebuggingWithGdb](https://wiki.python.org/moin/DebuggingWithGdb)
113+
114+
If you are using VSCode, it's more convenient to debug in [VSCode's built-in debugger](https://code.visualstudio.com/docs/editor/debugging). Simply press <kbd>F5</kbd> on an open Python to start debugging - We have [the `launch.json` file configured for you](.vscode/launch.json).
115+
101116
## Examples
102117

103118
* [examples/](examples/)

TODO.md

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)