GDB Integration Guide
LabWired features a built-in GDB Remote Serial Protocol (RSP) server that allows you to connect professional debugging tools (GDB, Ozone, Cortex-Debug) directly to the simulation.
๐ Connecting to GDB Server
By default, the GDB server starts automatically when you launch a simulation session via the DAP server (e.g., in VS Code).
- Default Address:
localhost:3333 - Protocol: GDB Remote Serial Protocol (RSP)
๐ Using Command Line GDB
- Start your simulation (e.g., via VS Code extension).
- In a terminal, run your cross-compiler GDB:
- Connect to the LabWired target:
- You can now use standard GDB commands:
i r: Info registersx/16wx 0x0: Examine memoryb main: Set breakpointc: Continues: Step
๐ป Visual Studio Code (Cortex-Debug)
For a superior debugging experience with peripheral views and disassembly, we recommend using the Cortex-Debug extension.
Configuration (launch.json)
Add the following to your .vscode/launch.json:
{
"version": "0.2.0",
"configurations": [
{
"type": "cortex-debug",
"request": "launch",
"name": "LabWired (Cortex-Debug)",
"servertype": "external",
"gdbTarget": "localhost:3333",
"executable": "${workspaceRoot}/examples/arm-c-hello/target/firmware",
"cwd": "${workspaceRoot}",
"runToEntryPoint": "main",
"armToolchainPath": "/usr/bin"
}
]
}
๐งช Automated Testing
We provide a verification script to test the GDB interface stability:
This script is also part of our CI Pipeline, ensuring that the GDB interface remains robust across all releases.
๐ ๏ธ Supported Packets
LabWired supports the core set of RSP packets required for professional debugging:
- g/G: Read/Write all registers
- P: Write single register
- m/M: Read/Write memory (hex)
- Z0/z0: Insert/Remove software breakpoints
- vCont: Resumption and stepping
- qSupported: Capability negotiation
- Ctrl-C: Break/Interrupt simulation