Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Debugging and interactive sessions

中文

Start with a deployed program. Confirm local and target contents match and the ELF contains debug information; an ELF suffix alone does not imply source line tables.

Choose the target state change

CommandBehavior
rvdbg statusInspect state without automatically halting
rvdbg attachConnect without reset, preserving running/halted state
rvdbg haltHalt the selected core
rvdbg goResume the selected core
rvdbg resetReset the chip and halt at the reset vector
rvdbg run-until <symbol-or-address>Run a halted core to a temporary hardware breakpoint
rvdbg downTRACE32 SYStem.Down

TRACE32 inspection/control needs PowerView already running. rvdbg open starts or reuses it. rvdbg load loads symbols but also resumes a halted target.

For example:

rvdbg halt
rvdbg run-until rustvisor_boot_main --timeout 30
rvdbg status

The symbol must exist and remain reachable. run-until does not first halt a running core. Stopping elsewhere returns 3. Timeout does not mean the target is halted: on StellarLINK it keeps running while the tool attempts to remove the breakpoint. Check status next. OpenOCD uses A32 hardware breakpoints; do not assume this works for another instruction set.

VS Code

rvdbg vscode

Configurations are merged into .vscode/launch.json and tasks.json, preserving existing entries and backing up modified files as *.bak.<timestamp>. Select the matching configuration in Run and Debug:

ConfigurationConnectionPreparation and effects
TRACE32: AttachHidden task starts rvdbg’s DAP proxyPowerView running, symbols loaded
StellarLINK: AttachCortex-Debug connects to rvdbg debugFlash first; SR6P6’s board script resets the core when GDB connects

The name “Attach” does not guarantee preservation of the current fault scene. Record inspection results before opening an IDE if necessary.

The TRACE32 proxy handles Restart by resetting through Remote API and resuming. It returns empty Locals lists to avoid crashes in some t32debugadapter versions on FreeRTOS interrupt frames; registers, stack, watch expressions, breakpoints and stepping remain available.

Generated files contain absolute rvdbg/config paths. Regenerate after moving the project or executable.

RustRover / JetBrains (TRACE32)

Install LSP4IJ, then run:

rvdbg rustrover

This creates .run/TRACE32 Attach.run.xml. Select TRACE32: Attach and Debug; LSP4IJ starts and connects to the DAP proxy. For StellarLINK use VS Code/Cortex-Debug or GDB.

Keep the service running in one terminal:

rvdbg --backend openocd debug

In another, load the actual primary image and connect on the default port:

arm-none-eabi-gdb build/el2.elf -ex 'target extended-remote :3333'

The service normally stops when GDB detaches; rvdbg debug --keep runs until Ctrl-C. Reusing a session’s OpenOCD leaves its lifetime under that session’s control. Load extra image symbols yourself in a manual GDB session; generated VS Code configuration does this for extra_elf.

gdb_target selects the debug core; inspection core can differ, as explained in configuration. External halt/resume commands affect the same core GDB is debugging; these are not isolated sessions.

Interactive commands

Run bare rvdbg. The following is illustrative; prompts depend on the backend and target state:

$ rvdbg
rvdbg [...]> status
rvdbg [...]> halt
rvdbg [...]> fault
rvdbg [...]> mem my_buffer 4
rvdbg [...]> go
rvdbg [...]> quit

Use help [command], Tab completion, backend trace32|openocd, reconnect, and quit/exit. Use reconnect after changing probes. History lives in .rvdbg/history. Ctrl-C interrupts waiting RTT/FDX/run-until commands without ending the session; command failures also leave it open.

A StellarLINK session keeps one OpenOCD shared by commands and GDB. TRACE32 inspection, ram and fdx share a lazily established connection. Failure drops it; the next command reconnects, without replaying the failed command. flash, load and open manage connections separately.

Custom TRACE32 operations

rvdbg eval 'Register(PC)'
rvdbg cmd 'Break.Set my_function /Program /Onchip'
rvdbg do scripts/trace_setup.cmm

eval evaluates expressions, cmd executes PRACTICE commands and do runs a script and waits. Scripts stopped by errors are cleaned up and reported; dialogs and STOP remain for the operator. Effects depend on content and may include register writes, reset and flashing.

See inspection for trace setup/export and troubleshooting for missing sources, ports and busy scripts.