GDB is the command-facing debugger for inspecting source lines and registers, setting breakpoints, and evaluating expressions. It cannot communicate directly with a microcontroller or speak JTAG or SWD. section 6.5.2
GDB sends commands using its remote serial protocol over a TCP socket or pipe. A GDB server connects to the debug probe and translates that protocol into probe commands for the target. OpenOCD, probe-rs, and pyocd can serve this role. section 6.5 section 6.5.2
Choose a GDB build that supports the target architecture:
- gdb-multiarch supports multiple architectures, including Arm and RISC-V, and is a recommended Linux default. section 6.5.2
- arm-none-eabi-gdb comes with the Arm GNU toolchain and supports Cortex-M work. section 6.5.2
- riscv32-unknown-elf-gdb and riscv64-unknown-elf-gdb are options for RISC-V targets. section 6.5.2
In embedded Rust, the target has no operating system to mediate inspection; communication with its internal state runs through debug pins and connected tools. GDB with OpenOCD remains a traditional workflow alongside newer alternatives. section 2.6.5 section 6.5
Table 2.1 Knurling tools workflow benefits
| Scenario | Traditional Tools (OpenOCD, GDB, Semihosting) | Knurling Workflow (probe-rs, defmt) |
Rapid development iterations |
Moderate speed, involves multiple manual steps |
Very fast single-command workflow |
Logging & debugging verbosity |
Semihosting slower, more verbose setup |
Efficient, structured, compact logging via RTT |
Complexity |
More complex initial setup, explicit tooling |
Simpler, ergonomic, minimal configuration |
Deep hardware-specific debug |
More powerful for detailed investigation |
Basic real-time logs, less suitable for deep HW analysis |
Compare traditional GDB and OpenOCD workflows with Knurling tools, including their trade-offs for rapid iteration and detailed hardware investigation. section 2.6.5
