-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Debugger Configurations
This page can provide additional debugger configurations beyond the ones shipped by default in Helix.
linux (tested in ubuntu)
:
Access your user folder.
cd ~
Check the architecture of the cpu to later download the correct version of codelldb
.
lscpu | grep -oP 'Architecture:\s*\K.+'
create a folder named bin
and access it.
mkdir bin && cd bin
Will download codelldb
through curl
. ( .vsix
can be opened as .zip
).
sudo curl -L "https://github.com/vadimcn/vscode-lldb/releases/download/v1.7.0/codelldb-x86_64-linux.vsix" -o "codelldb-x86_64-linux.zip"
Unzip only the necessary folders, in this case extension/adapter
and extension/lldb
.
unzip "codelldb-x86_64-linux.zip" "extension/adapter/*" "extension/lldb/*"
Rename the extension/
folder to codelldb_adapter/
mv extension/ codelldb_adapter
Delete the unneeded codelldb-x86_64-linux.zip
at this time.
sudo rm "codelldb-x86_64-linux.zip"
Create the symlink from codelldb_adapter/adapter/codelldb
to /usr/bin/codelldb
and you're done.
ln -s codelldb_adapter/adapter/codelldb /usr/bin/codelldb
Test: codelldb -h
Helix supports debugging Rust, by default, with lldb-vscode
, which is part of llvm/lldb
.
However, you can also use vscode-lldb
's adapter named codelldb
. (Note, the names can be confusing. vscode-lldb
is a separate project from the aforementioned lldb-vscode
.)
[[language]]
name = "rust"
[language.debugger]
command = "codelldb"
name = "codelldb"
port-arg = "--port {}"
transport = "tcp"
[[language.debugger.templates]]
name = "binary"
request = "launch"
[[language.debugger.templates.completion]]
completion = "filename"
name = "binary"
[language.debugger.templates.args]
program = "{0}"
runInTerminal = true
Test with: debug-start binary target/debug/zellij
, for example.
Status: start/stop debugging works, breakpoints work
To simply install the default debugger that will work out of the box you need to:
- Install
LLVM
.
The easiest way to do this is to use the pre-compiled binaries from the releases page: https://github.com/llvm/llvm-project/releases, for example, at the time of writing the latest version for Linux is: https://github.com/llvm/llvm-project/releases/download/llvmorg-15.0.2/clang+llvm-15.0.2-x86_64-unknown-linux-gnu-rhel86.tar.xz
- Unpack the entire directory somewhere accessible in your system
$PATH
and create a symbolic link.
If you have ~/bin
in your path then unpack LLVM
there and make a symlink to the lldb-vscode
file that lives in the bin
directory.
Now when you run the debugger in Helix select launch debug target
and binary
, then for example, to debug Rust, target/debug/
and the name of your executable.
- Install LLVM:
brew install llvm
- Add
/usr/local/opt/llvm/bin
your PATH, usually in your ~/.bashrc or .zshrc file. - Restart your shell
If on Linux, trying to attach to a running process for debugging and being refused by the adapter due to a message similar to Operation not permitted
, ensure ptrace
is not blocking you. This can be done by following this Microsoft troubleshooting guide.
Summary of steps needed to be done are one of:
- Ensure
/proc/sys/kernel/yama/ptrace_scope
has a0
as value, instead of 1 - If the file is not present or Yama is not used, use
libcap2-bin
to assign ptrace specific permissions to the debug adapter (overriding the command used by Helix, usually set in alanguages.toml
file).