From aff1e7f3b052237612e1b67f7de409b7d14579ff Mon Sep 17 00:00:00 2001 From: Alex Allmont Date: Sat, 9 Nov 2024 20:39:32 +0000 Subject: [PATCH] feat: example_launch.json for debug scenarios (#148) - Contains various python and C++ debug scenarios. - Copy to .vscode/launch.json to use in development. - See .devcontainer/README.md for full information. --- .devcontainer/README.md | 4 +- .devcontainer/example_launch.json | 73 +++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+), 2 deletions(-) create mode 100644 .devcontainer/example_launch.json diff --git a/.devcontainer/README.md b/.devcontainer/README.md index 019f933c..ff247eaa 100644 --- a/.devcontainer/README.md +++ b/.devcontainer/README.md @@ -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. diff --git a/.devcontainer/example_launch.json b/.devcontainer/example_launch.json new file mode 100644 index 00000000..71d6548f --- /dev/null +++ b/.devcontainer/example_launch.json @@ -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" + } + ] +} \ No newline at end of file