Skip to content

Commit

Permalink
feat: example_launch.json for debug scenarios (#148)
Browse files Browse the repository at this point in the history
- Contains various python and C++ debug scenarios.
- Copy to .vscode/launch.json to use in development.
- See .devcontainer/README.md for full information.
  • Loading branch information
alexallmont committed Nov 9, 2024
1 parent ae5d841 commit aff1e7f
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .devcontainer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ Run the editor command `CMake: Select Configure Preset` and select `Debug Develo

The devcontainer automatically installs the pytest and CTest extension, so after building you can launch any of the tests from the VSCode test explorer panel. Alternatively, you can run directly `pytest` directly from the integrated terminal.

VSCode loads debug scenarios from `.vscode/launch.json`. However, developers frequently need to edit this file with changes that should not be committed, so here they are stored in `example_launch.json` which must be manually copied over with:
VSCode loads debug scenarios from `.vscode/launch.json`. However, developers frequently need to edit this file with changes that should not be committed, so instead it is stored in `.devcontainer/example_launch.json`. Manually copy this over with:

```sh
cp .vscode/example_launch.json .vscode/launch.json
cp .devcontainer/example_launch.json .vscode/launch.json
```

Select a debug scenario in the Run and Debug panel, add a breakpoint on the code to stop on, and launch with F5.
Expand Down
73 changes: 73 additions & 0 deletions .devcontainer/example_launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "debugpy pytest",
"type": "debugpy",
"request": "launch",
"module": "pytest",
"console": "integratedTerminal",
"args": [
"-k", "test_exp_log_roundtrip_poly_coeffs"
],
"env": {},
"preLaunchTask": "CMake: build"
},
{
"name": "gdb pytest",
"type": "cppdbg",
"request": "launch",
"program": "${config:python.defaultInterpreterPath}",
"args": [
"-m", "pytest",
"-k", "test_exp_log_roundtrip_poly_coeffs"
],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "Set Disassembly Flavor to Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true
}
],
"preLaunchTask": "CMake: build"
},
{
"name": "gdb gtest",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build/dev-debug/intervals/src/test_intervals",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "Set Disassembly Flavor to Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true
}
],
"preLaunchTask": "CMake: build"
}
]
}

0 comments on commit aff1e7f

Please sign in to comment.