This chapter will cover various approaches to debugging Rust programs. Rust programs, at the binary level, are very similar to C programs. This means that we can leverage the strong legacy of industry standard debuggers such as gdb and lldb that are used for debugging C/C++ programs and use the same tools to debug Rust code as well. In this chapter, we'll interactively walk through some basic debugging workflow and commands with gdb. We'll also cover integrating the gdb debugger with Visual Studio Code (vscode) editor and, later, give a quick overview of another debugger, called rr.
In this chapter, we will cover the following topics:
- Introduction to debugging
- The gdb basics and debugging a Rust program
- The gdb integration with Visual Studio Code
- RR debugger—a quick overview