### 1. Choose Your Debugger (`docker-compose.debug-override.yml`)
The `docker-compose.debug-override.yml` file is the central point for configuring your debug session. You must choose which debugger to use by setting the `DEBUG_SERVER` environment variable.
- Open `docker-compose.debug-override.yml`.
- Under the `environment` section for the `tuliprox` service, set `DEBUG_SERVER` to either `gdb` or `lldb`.
**Example for using GDB:**
```yaml
services:
tuliprox:
# ... other settings
environment:
- DEBUG_SERVER=gdb
- RUST_TARGET=x86_64-unknown-linux-musl
```
**Example for using LLDB:**
```yaml
services:
tuliprox:
# ... other settings
environment:
- DEBUG_SERVER=lldb
- RUST_TARGET=x86_64-unknown-linux-musl
```
This file also:
- Exposes the debug port (default: `10586`).
- Sets up privileged mode, which is required for some debuggers.
- Mounts cargo cache volumes for faster subsequent builds.
- **Check `DEBUG_SERVER` variable**: Ensure the `DEBUG_SERVER` variable in `docker-compose.debug-override.yml` matches the launch configuration you selected in VSCode.
- **Check Ports**: Verify that the debug port (default `10586`) is not being used by another application on your host machine.
- **Check Container Logs**: Look at the Docker container logs. You should see output from `debug-entrypoint.sh` indicating that the debug server (GDB or LLDB) has started and is listening.
- **Verify Build Target**: Ensure the `RUST_TARGET` in your `docker-compose.debug-override.yml` matches the target you are building for.
- **Check Source Mapping**:
- For GDB (`cppdbg`), verify the `sourceFileMap` in `.vscode/launch.json`. The remote path (`/usr/src/tuliprox`) should map to your local project directory (`${workspaceFolder}`).
- For LLDB, verify the `sourceMap` setting.
-**Debug Build**: Make sure you are running a debug build, not a release build, as release builds may optimize out debug symbols. The provided scripts default to a debug build.