Skip to content

Commit a8b65df

Browse files
Add VSCode debugging documentation for macOS (#785)
### Add VSCode debugging documentation for macOS ### Summarize your change. Add the steps to set up VSCode on macOS to debug RV's C++ code. ### Describe the reason for the change. At the last Open RV TSC meeting, someone ask if some instructions could be added to the macOS documentation to set up the C++ debugger in VSCode. ### If possible, provide screenshots. <img width="565" alt="Screenshot 2025-05-20 at 12 14 25 PM" src="https://github.com/user-attachments/assets/b7a101d1-9071-4da3-9a38-56e005329c7b" /> Signed-off-by: Éloïse Brosseau <[email protected]> Co-authored-by: Bernard Laberge <[email protected]>
1 parent 673f2b7 commit a8b65df

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

docs/build_system/config_macos.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
- [Install tools and build dependencies](install_tools_and_build_dependencies)
1212
- [Install Qt](install_qt)
1313
- [Build Open RV](build_openrv)
14+
- [Setting up debugging in VSCode](debugging_openrv)
1415

1516
````{note}
1617
OpenRV can be built for *x86_64* by changing the architecture of the terminal to *x86_64* using the following command:
@@ -160,3 +161,62 @@ Once the build is completed, the Open RV application can be found in the Open RV
160161
Once the build is completed, the Open RV application can be found in the Open RV directory under `_build_debug/stage/app/RV.app/Contents/MacOS/RV`.
161162
```
162163
````
164+
165+
(debugging_openrv)=
166+
## 9. Setting up debugging in VSCode
167+
168+
For a general understanding on how to debug C++ code in VSCode, please refer to the [Microsoft documentation](https://code.visualstudio.com/docs/cpp/launch-json-reference).
169+
170+
To set up the C++ debugger in VSCode for Open RV, use the following steps:
171+
172+
1. **Install the [CodeLLDB](https://marketplace.visualstudio.com/items?itemName=vadimcn.vscode-lldb) extension**
173+
2. **Configure the debugger**
174+
Create a `.vscode` folder at the root of the project if it doesn't already exist. Inside this folder, create a `launch.json` file to configure the debugger with the following content:
175+
176+
```json
177+
{
178+
"version": "0.2.0",
179+
"configurations": [
180+
{
181+
"type": "lldb",
182+
"request": "launch",
183+
"name": "Debug Open RV (Debug Build)",
184+
"program": "${workspaceFolder}/_build_debug/stage/app/RV.app/Contents/MacOS/RV",
185+
"args": [],
186+
"cwd": "${workspaceFolder}",
187+
"preLaunchTask": "build"
188+
}
189+
]
190+
}
191+
```
192+
193+
**NOTE:** `program` should point to the build of the Open RV executable you want to debug. `preLaunchTask` is only necessary if you decide to follow step 3.
194+
195+
3. **Set up automatic rebuild (Optional)**
196+
If you want to automatically rebuild Open RV before starting the debugger, add a `tasks.json` file in the `.vscode` folder created in the previous step:
197+
198+
```json
199+
{
200+
"version": "2.0.0",
201+
"tasks": [
202+
{
203+
"label": "build",
204+
"type": "shell",
205+
"command": "cmake",
206+
"args": [
207+
"--build",
208+
"_build_debug",
209+
"--target",
210+
"main_executable"
211+
],
212+
"group": {
213+
"kind": "build",
214+
"isDefault": true
215+
},
216+
"presentation": {
217+
"reveal": "always"
218+
}
219+
}
220+
]
221+
}
222+
```

0 commit comments

Comments
 (0)