ITADN

BashDB Not Working in Nixvim DAP Configuration

#118Openback2nix 创建于 2024-07-21
B
back2nixcommented
## Description Greetings! 😃 I'd like to share an interesting observation regarding the behavior of BashDB when debugging Bash scripts using the Debug Adapter Protocol (DAP) configuration in Neovim. I've noticed that the debugger exits with code 1 and produces several intriguing error messages: 1. The `complete` command is missing, which might indicate issues with Bash autocompletion setup. 2. There are difficulties accessing `/dev/stdin`. This could be related to peculiarities in file permission management or standard input handling in the Nix environment. 3. BashDB reports the need for specifying a script to debug or using the `-c` option. It appears that the file or command for debugging isn't being passed to the debugger correctly. These observations may be valuable for understanding the current state of interaction between BashDB, Neovim, and DAP in the context of debugging Bash scripts. ## Configuration my nixvim config: https://github.com/back2nix/nixvim/blob/14c6325f4745a848048236d70e3287ab65e00646/config/plugins/dap.nix#L28 ### sh-config: ```nix sh-config = lib.mkIf pkgs.stdenv.isLinux { type = "bashdb"; request = "launch"; name = "Launch (BashDB)"; showDebugOutput = true; pathBashdb = "${pkgs.bashdb}/bin/bashdb"; pathBashdbLib = "${pkgs.bashdb}/share/bashdb/lib"; trace = true; file = '${file}'; program = '${file}'; cwd = '${workspaceFolder}'; pathCat = "cat"; pathBash = "${lib.getExe pkgs.bash}"; pathMkfifo = "mkfifo"; pathPkill = "pkill"; args = {}; env = {}; terminalKind = "integrated"; }; ``` ### DAP Configuration: ```nix plugin.dap = { enable = true; configurations = { sh = lib.optionals pkgs.stdenv.isLinux [sh-config]; }; adapters = { executables = { bashdb = lib.mkIf pkgs.stdenv.isLinux {command = "${lib.getExe pkgs.bashdb}";}; }; }; }; ``` ## Error Messages ``` [ ERROR ] 2024-07-21T14:13:31Z+0300 ] ...pack/myNeovimPackages/start/nvim-dap/lua/dap/session.lua:1466 ] "stderr" { command = "/nix/store/15lnx94a6ajjp95zm2kjg1y79xc1z1s2-bashdb-5.0-1.1.2/bin/bashdb", type = "executable" } "/nix/store/15lnx94a6ajjp95zm2kjg1y79xc1z1s2-bashdb-5.0-1.1.2/share/bashdb/lib/help.sh: line 40: complete: command not found\n" [ ERROR ] 2024-07-21T14:13:31Z+0300 ] ...pack/myNeovimPackages/start/nvim-dap/lua/dap/session.lua:1466 ] "stderr" { command = "/nix/store/15lnx94a6ajjp95zm2kjg1y79xc1z1s2-bashdb-5.0-1.1.2/bin/bashdb", type = "executable" } "/nix/store/15lnx94a6ajjp95zm2kjg1y79xc1z1s2-bashdb-5.0-1.1.2/share/bashdb/command/source.sh: line 41: /dev/stdin: No such device or address\n" [ ERROR ] 2024-07-21T14:13:31Z+0300 ] ...pack/myNeovimPackages/start/nvim-dap/lua/dap/session.lua:1466 ] "stderr" { command = "/nix/store/15lnx94a6ajjp95zm2kjg1y79xc1z1s2-bashdb-5.0-1.1.2/bin/bashdb", type = "executable" } ".bashdb-wrapped: need to give a script to debug or use the -c option.\n" [ INFO ] 2024-07-21T14:13:31Z+0300 ] ...pack/myNeovimPackages/start/nvim-dap/lua/dap/session.lua:1439 ] "Process closed" 1132885 ``` ### Additional Information Using, which is built with a custom overlay, resolves the: `"complete: command not found" error.` 😃 - overlays ```nix (final: prev: { bashdbInteractive = final.bashdb.overrideAttrs { buildInputs = (prev.buildInputs or []) ++ [final.bashInteractive]; }; }) ``` - change config ```nix ... pathBashdb = "/etc/profiles/per-user/bg/bin/bashdb" ... executables = { bashdb = lib.mkIf pkgs.stdenv.isLinux {command = "/etc/profiles/per-user/bg/bin/bashdb";}; }; ``` However, the error `"need to give a script to debug or use the -c option."` persists. 😞 Extensive research and attempts to solve the problem have been unsuccessful. 😞
0 条评论