A descriptio of all the steps to be able to debug Zed using Zed. This is useful if you want to add features and fix errors within the Zed codebase using Zed itself.
First you need to download and compile the debugger branch:
$ cd zed
$ git checkout pull/13433/head
Assuming you have followed the Building Zed instructions
you should be able to run:
$ cargo run --profile release-fast
This now will be your ned zed editor environment. You have to use this app and not your default zed editor for the following commands to work.
Open your zed codebase (this folder should be different from the prevoius checked out debugger codebase to avoid confusion).
CTRL+O
create a new debug.json
file inside the project $ZED_ROOT/.zed/debug.json:
[
{
"label": "Zed debugger",
"adapter": "lldb",
"program": "$ZED_WORKTREE_ROOT/target/debug/zed"
}
]
make sure you have lldb and rust-analyzer installed.
# on macosx
$ brew install lldb rust-analyzer
Add a breakpoint by clicking on the gutter of rust file:
Show the task selection dialog with
CTRL+ALT+P
and select debugger:start
(type debug to autocomplete)
After a while you should see a panel like this (as of Nov 2024). Notice that the console is giving us some warnings.