The gdb basics

We'll run our program again, this time with gdb using the rust-gdb wrapper by running rust-gdb --args target/debug/buggie 4. The --args flags are used to pass arguments to the program. Here, we pass the number 4. Here's the output from gdb:

After loading our program, gdb throws us into the (gdb) prompt. At this point, the program is not running—it's just been loaded. Let's take a quick look at the scope of gdb's features. Try using the help command (which displays high-level sections of commands) and the help all command(which displays a help message for all available commands):

Okay, so it seems that gdb can do a lot: there ...

Get Mastering Rust - Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.