Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

DAP support shell

Zeioth edited this page Aug 11, 2023 · 6 revisions

Nothing special needs to be done to debug shell programs.

How to configure DAP for python

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 and configuration 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 screenshot_2023-08-08_17-27-28_480044851

Important for you to know

  • 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.

Clone this wiki locally

Morty Proxy This is a proxified and sanitized view of the page, visit original site.