Setting up gdb
To get started with gdb, we first need to install it. Usually, it is installed by default on Linux systems, but if it isn't, refer to guides on the internet for setting it up on your machine. On Ubuntu, it's just a matter of running an installation command such as apt-get install gdb. We'll be using gdb version 7.11.1 for our demo here.
While gdb has amazing support for Rust programs, there are some Rust-specific things that it doesn't handle correctly, such as getting tidier output. The Rust toolchain, rustup, also installs wrappers for both gdb and lldb debuggers, rust-gdb and rust-lldb. It does this to account for some of the limitations in handling Rust code such as getting tidier output for mangled types and some pretty ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access