Rust-GDB

Use rust-gdb to launch gdb with the Rust-specific pretty-printers enabled, PR#19954 – add rust-gdb for Rust pretty printers.

GDB Rust Breakpoints

In gdb use break FILENAME:LINE_NUM instead of rbreak FUNCTION_NAME.

Rust has lifetime parameters, which can cause the gdb error umatched quote.

Example

Code: struct Foo<‘a> {num: i32} impl<‘a> Foo<‘a> { fn add_one(self) {} }

GDB:

(gdb) rbreak add_one

unmatched quote

(gdb)

Emacs GUD

To Launch: M-x gdb Instead of gdb enter rust-gdb, add –-args to pass arguments to the proccess being debugged. Example: rust-gdb --i=mi --args PATH_TO_EXECUTABLE EXECUTABLE_ARGS

Emacs GUD – Keybindings

I never remember the Emacs GUD keybindings, instead my .emacs includes:



(global-set-key [f5] 'gud-cont)

(global-set-key [f7] 'gud-tbreak)

(global-set-key [S-f11] 'gud-finish)

(global-set-key [f9] 'gud-break)

(global-set-key [f10] 'gud-next)

(global-set-key [f11] 'gud-step)

