dap-mode
dap-mode copied to clipboard
Dap debug fails with cryptic error
It's the first time I use dap-mode, I am trying to make a clean setup to debug Rust programs. I want to use gdb as debugger, with the rust-gdb wrapper to make it Rust-friendly. Here is the template I tried, taken from this tutorial.
launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Run Part A Debug (input.txt)",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/target/debug/day09-rs",
"args": ["a", "inputs/input.txt"],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"miDebuggerPath": "rust-gdb",
"dap-compilation": "cargo build",
"dap-compilation-dir": "${workspaceFolder}"
}
]
}
I then open the source with Emacs, and run dap-debug. This prompts some templates, I select Run Part A Debug (input.txt). This quickly opens a new window in Emacs, then closes it (I guess this is the cargo compilation output) and reports an error
error in process sentinel: dap-start-debugging-noexpand: Doing vfork: No such file or directory
error in process sentinel: Doing vfork: No such file or directory
It does compile the project, so the dap-compilation step must work, but nothing more. It looks like there it can't find something, but as it's not shown, I don't know what :cry:. I have no idea how to debug this further. I've tried grepping the error message in the source code of dap-mode but I haven't found anything, so I'm not even sure this is related to dap-mode.
rust-gdb is a script wrapper for gdb, do you have gdb installed?
Yes, I had gdb installed at the time I tried that, but since it was installed with nix in a development shell, this might be the issue. It's been a few months so I don't remember all the details, but if you are willing to help me and debug this, I can try to reproduce the issue and give you more details.
Well, I just meet a similar problem, missing gdb, then switching to using lldb, then meeting the problem of not supporting MI. All the emacs reported are vfork errors, really hard to find the problem.
BTW, I'm also a newbie to dap.
I run emacs under strace, and it shows that in my case " Doing vfork: No such file or directory", means that dap-mode can not run:
/home/user/.config/emacs/.extension/vscode/cpptools/extension/debugAdapters/bin/OpenDebugAD7
not sure why it search OpenDebugAD7 inside emacs config.
I use such template:
(dap-register-debug-template "Rust::GDB Run Configuration"
(list :type "gdb"
:request "launch"
:name "GDB::Run"
:gdbpath "/usr/bin/rust-gdb"
:target nil
:cwd nil))
The directory with vs-code extension inside emacs directory was create by "dap-cpp-tools". But looks like something failed, after deleting this directory and rerunning "M-x dap-cpptools-setup" it starts working.
#715 looks similar
I think I have an idea of what the problem is in my case: the setup requires installing the necessary binaries, but my Emacs configuration is on a read-only mount point, so the setup fails at installing anything, and so it therefore cannot find the executable.
I would argue that it is not up to Emacs (or any subsequently called process) to install anything for me. Ideally, these two features would be separated, and it would be possible to install all the required stuff without having Emacs doing it for me.
I'm also struggling to setup dap-mode with lldb, and hitting the same cryptic vfork message. It's unclear what isn't set up correctly in order to try to fix it.