Home Explore Blog CI



zed

2nd chunk of `docs/src/development/debuggers.md`
9e7a8d21d861119502cd766aca55fddc1afd285c918b52d2000000010000086a
> If you wish to avoid passing the `--config` flag on every invocation of `cargo`. You may also change the section in the [root `Cargo.toml`](https://github.com/zed-industries/zed/blob/main/Cargo.toml)
>
> from
>
> ```toml
> [profile.dev]
> debug = "limited"
> ```
>
> to
>
> ```toml
> [profile.dev]
> debug = "full"
> ```
>
> This will ensure all invocations of `cargo run` or `cargo build` will compile with full debug info.
>
> **WARNING:** Make sure to avoid committing these changes!

## GDB/LLDB

### Background

When installing rust through rustup, (the recommended way to do so when developing Zed, see the documentation for getting started on your platform [here](../development.md))
a few additional scripts are installed and put on your path to assist with debugging binaries compiled with rust.

These are `rust-gdb` and `rust-lldb` respectively.

You can read more information about these scripts and why they are useful [here](https://michaelwoerister.github.io/2015/03/27/rust-xxdb.html) if you are interested.

However, the summary is that they are simple shell scripts that wrap the standard `gdb` and `lldb` commands, injecting the relevant commands and flags to enable additional
rust-specific features such as pretty-printers and type information.

Therefore, in order to use `rust-gdb` or `rust-lldb`, you must have `gdb` or `lldb` installed on your system. If you don't have them installed, you will need to install them in a manner appropriate for your platform.

According to the [previously linked article](https://michaelwoerister.github.io/2015/03/27/rust-xxdb.html), "The minimum supported debugger versions are GDB 7.7 and LLDB 310. However, the general rule is: the newer the better." Therefore, it is recommended to install the latest version of `gdb` or `lldb` if possible.

> **Note**: `rust-gdb` is not installed by default on Windows, as `gdb` support for windows is not very stable. It is recommended to use `lldb` with `rust-lldb` instead on Windows.

If you are unfamiliar with `gdb` or `lldb`, you can learn more about them [here](https://www.gnu.org/software/gdb/) and [here](https://lldb.llvm.org/) respectively.

Title: Using GDB/LLDB for Rust Debugging
Summary
This section explains how to use `rust-gdb` and `rust-lldb`, which are wrapper scripts around `gdb` and `lldb` that add Rust-specific features for debugging. It notes that `gdb` or `lldb` must be installed, and that newer versions are generally better. It also mentions that `rust-gdb` is not installed by default on Windows due to `gdb` instability and recommends using `lldb` instead.