Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
"extensions": [
"llvm-vs-code-extensions.vscode-clangd",
"ms-vscode.cmake-tools",
"twxs.cmake"
"twxs.cmake",
"vadimcn.vscode-lldb"
],
"settings": {
"clangd.path": "/usr/bin/clangd",
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@ tags*
**.swp
**.DS_Store
**.ccls*
.vscode
env
.idea*
python/scrimmage/bindings
python/dist
.vscode/*
!.vscode/launch.json
!.vscode/tasks.json
81 changes: 81 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
{
// Debug configurations for SCRIMMAGE
// Requires: Debug build (cmake -DCMAKE_BUILD_TYPE=Debug ..)
"version": "0.2.0",
"configurations": [
{
"name": "Debug: scrimmage",
"type": "lldb",
"request": "launch",
"program": "${workspaceFolder}/build/bin/scrimmage",
"args": ["${workspaceFolder}/missions/straight-no-gui.xml"],
"cwd": "${workspaceFolder}",
"env": {
"SCRIMMAGE_DATA_PATH": "${workspaceFolder}/data",
"SCRIMMAGE_MISSION_PATH": "${workspaceFolder}/missions",
"SCRIMMAGE_PLUGIN_PATH": "${workspaceFolder}/build/plugin_libs:${workspaceFolder}/include/scrimmage/plugins",
"SCRIMMAGE_CONFIG_PATH": "${workspaceFolder}/config",
"SCRIMMAGE_KERNEL_PATH": "${workspaceFolder}/src/gpu/kernels",
"LD_LIBRARY_PATH": "${workspaceFolder}/build/lib:${workspaceFolder}/build/plugin_libs",
"JSBSIM_ROOT": "${workspaceFolder}/data"
},
"stopOnEntry": false
},
{
"name": "Debug: scrimmage (pick mission)",
"type": "lldb",
"request": "launch",
"program": "${workspaceFolder}/build/bin/scrimmage",
"args": ["${input:missionFile}"],
"cwd": "${workspaceFolder}",
"env": {
"SCRIMMAGE_DATA_PATH": "${workspaceFolder}/data",
"SCRIMMAGE_MISSION_PATH": "${workspaceFolder}/missions",
"SCRIMMAGE_PLUGIN_PATH": "${workspaceFolder}/build/plugin_libs:${workspaceFolder}/include/scrimmage/plugins",
"SCRIMMAGE_CONFIG_PATH": "${workspaceFolder}/config",
"SCRIMMAGE_KERNEL_PATH": "${workspaceFolder}/src/gpu/kernels",
"LD_LIBRARY_PATH": "${workspaceFolder}/build/lib:${workspaceFolder}/build/plugin_libs",
"JSBSIM_ROOT": "${workspaceFolder}/data"
},
"stopOnEntry": false
},
{
"name": "Debug: Current Test File",
"type": "lldb",
"request": "launch",
"program": "${workspaceFolder}/build/test/${fileBasenameNoExtension}",
"args": [],
"cwd": "${workspaceFolder}",
"env": {
"SCRIMMAGE_DATA_PATH": "${workspaceFolder}/data",
"SCRIMMAGE_MISSION_PATH": "${workspaceFolder}/missions",
"SCRIMMAGE_PLUGIN_PATH": "${workspaceFolder}/build/plugin_libs:${workspaceFolder}/include/scrimmage/plugins",
"SCRIMMAGE_CONFIG_PATH": "${workspaceFolder}/config",
"LD_LIBRARY_PATH": "${workspaceFolder}/build/lib:${workspaceFolder}/build/plugin_libs"
},
"preLaunchTask": "build-tests",
"stopOnEntry": false
},
{
"name": "Debug: Attach to Process",
"type": "lldb",
"request": "attach",
"pid": "${command:pickProcess}"
}
],
"inputs": [
{
"id": "missionFile",
"type": "pickString",
"description": "Select a mission file",
"options": [
"missions/straight-no-gui.xml",
"missions/straight.xml",
"missions/capture-the-flag.xml",
"missions/predator_prey_boids.xml",
"missions/cars.xml"
],
"default": "missions/straight-no-gui.xml"
}
]
}
120 changes: 120 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
{
// Build and test tasks for SCRIMMAGE
"version": "2.0.0",
"tasks": [
{
"label": "cmake-configure",
"type": "shell",
"command": "cmake",
"args": [
"-DCMAKE_EXPORT_COMPILE_COMMANDS=ON",
"-DCMAKE_BUILD_TYPE=${input:buildType}",
".."
],
"options": {
"cwd": "${workspaceFolder}/build"
},
"group": "build",
"problemMatcher": []
},
{
"label": "cmake-configure-debug",
"type": "shell",
"command": "cmake",
"args": [
"-DCMAKE_EXPORT_COMPILE_COMMANDS=ON",
"-DCMAKE_BUILD_TYPE=Debug",
".."
],
"options": {
"cwd": "${workspaceFolder}/build"
},
"group": "build",
"problemMatcher": []
},
{
"label": "build",
"type": "shell",
"command": "make",
"args": ["-j${input:jobs}"],
"options": {
"cwd": "${workspaceFolder}/build"
},
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": "$gcc"
},
{
"label": "build-tests",
"type": "shell",
"command": "make",
"args": ["-j8"],
"options": {
"cwd": "${workspaceFolder}/build"
},
"group": "build",
"problemMatcher": "$gcc"
},
{
"label": "clean",
"type": "shell",
"command": "make",
"args": ["clean"],
"options": {
"cwd": "${workspaceFolder}/build"
},
"group": "build",
"problemMatcher": []
},
{
"label": "rebuild",
"dependsOn": ["clean", "build"],
"dependsOrder": "sequence",
"group": "build",
"problemMatcher": []
},
{
"label": "test",
"type": "shell",
"command": "ctest",
"args": ["--output-on-failure"],
"options": {
"cwd": "${workspaceFolder}/build"
},
"group": {
"kind": "test",
"isDefault": true
},
"problemMatcher": []
},
{
"label": "test-verbose",
"type": "shell",
"command": "ctest",
"args": ["--output-on-failure", "-V"],
"options": {
"cwd": "${workspaceFolder}/build"
},
"group": "test",
"problemMatcher": []
}
],
"inputs": [
{
"id": "buildType",
"type": "pickString",
"description": "Select build type",
"options": ["Debug", "Release", "RelWithDebInfo"],
"default": "Debug"
},
{
"id": "jobs",
"type": "pickString",
"description": "Number of parallel jobs",
"options": ["4", "8", "12", "16"],
"default": "8"
}
]
}
1 change: 1 addition & 0 deletions ci/dockerfiles/ubuntu-24.04-slim-dependency-only
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ RUN apt-get update && apt-get install -y \
qtbase5-dev qttools5-dev qttools5-dev-tools libqt5opengl5-dev \
vim \
clangd \
lldb \
&& apt-get clean && rm -rf /var/lib/apt/lists/*

# Set working directory to /root/scrimmage on container start
Expand Down
64 changes: 64 additions & 0 deletions development-docs/CONTAINERIZED_DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,70 @@ cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ..

---

## Debugging with LLDB (VS Code)

The devcontainer includes LLDB and the CodeLLDB extension for integrated debugging.

### Setup (one-time)

Build with debug symbols:
```bash
cd /root/scrimmage/build
cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ..
make -j$(nproc)
```

Or use the VS Code task: `Ctrl+Shift+P` → "Tasks: Run Task" → "cmake-configure-debug"

### Debug a Mission

1. Set breakpoints in your code (click left gutter)
2. Press `F5` or go to Run → Start Debugging
3. Select "Debug: scrimmage" (uses `missions/straight-no-gui.xml`)

For other missions: use "Debug: scrimmage (pick mission)"

### Debug Tests

1. Open a test file (e.g., `test/test_quaternion.cpp`)
2. Set breakpoints
3. Run "Debug: Current Test File" from the debug dropdown

### Available Debug Configurations

Found in the **debug dropdown** (top of Run and Debug panel, `Ctrl+Shift+D`):

| Config | Description |
|--------|-------------|
| Debug: scrimmage | Run scrimmage with straight-no-gui.xml |
| Debug: scrimmage (pick mission) | Choose from common mission files |
| Debug: Current Test File | Debug test executable matching open file (e.g., `test_quaternion.cpp` → `build/test/test_quaternion`) |
| Debug: Attach to Process | Attach to a running scrimmage process |

### Available Build Tasks

Run via `Ctrl+Shift+P` → "Tasks: Run Task":

| Task | Description |
|------|-------------|
| cmake-configure | Configure with selectable build type |
| cmake-configure-debug | Configure with Debug build type |
| build | Build with parallel jobs (default task) |
| test | Run all tests with ctest |
| clean | Clean build artifacts |
| rebuild | Clean then build |

### Terminal Debugging (without VS Code)

```bash
source ~/.scrimmage/setup.bash
cd /root/scrimmage
lldb build/bin/scrimmage -- missions/straight-no-gui.xml
# step through debug with keybindings
```

---

## Neovim LSP with Docker

Configure clangd to exec into a running container:
Expand Down