-
-
Notifications
You must be signed in to change notification settings - Fork 38
DAP support shell
Zeioth edited this page Aug 11, 2023
·
6 revisions
Nothing special needs to be done to debug shell programs.
Please note that this section has nothing to do with compiler.nvim. I'm documenting this to make your life easier. To debug shell with DAP you have to:
- Install
bash-debug-adapter
using Mason, or manually with::bash-debug-adapter
. - Then add the bash
adapter
andconfiguration
to the dap plugin config like
local dap = require("dap")
-- Shell
dap.adapters.bashdb = {
type = 'executable';
command = vim.fn.stdpath("data") .. '/mason/packages/bash-debug-adapter/bash-debug-adapter';
name = 'bashdb';
}
dap.configurations.sh = {
{
type = 'bashdb';
request = 'launch';
name = "Launch file";
showDebugOutput = true;
pathBashdb = vim.fn.stdpath("data") .. '/mason/packages/bash-debug-adapter/extension/bashdb_dir/bashdb';
pathBashdbLib = vim.fn.stdpath("data") .. '/mason/packages/bash-debug-adapter/extension/bashdb_dir';
trace = true;
file = "${file}";
program = "${file}";
cwd = '${workspaceFolder}';
pathCat = "cat";
pathBash = "/bin/bash";
pathMkfifo = "mkfifo";
pathPkill = "pkill";
args = {};
env = {};
terminalKind = "integrated";
}
}
All there is left to do is adding a breakpoint to your code, and run :DapContinue
- Note that mason installs the debugger for you. You don't need to install any system dependency.
- If you find any issue while configuring DAP, run
:DapSetLogLevel trace
and:DapShowLog
to find the reason.