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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.