liveBook · Manning

GDB

As explained in Embedded Software with Rust

GDB is the GNU source-level debugger for controlling and inspecting program execution.

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

How Embedded Software with Rust covers it

How deep it goes
Explains debugger commands, the remote protocol, the server boundary, and architecture-specific builds.
Examples
Names gdb-multiarch, arm-none-eabi-gdb, and RISC-V GDB builds as target-specific choices.
What you can do after
Operate GDB to inspect source and registers, set breakpoints, and evaluate expressions through a server.
How it connects
Links GDB with GDB servers, OpenOCD, probe-rs, pyocd, debug probes, JTAG, and SWD.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Embedded Software with Rust. The section links point to the parts of the book it draws on.