mfussenegger / nvim-dap

Debug Adapter Protocol client implementation for Neovim
GNU General Public License v3.0
5.46k stars 194 forks source link

Linux (centos 8 with GDB 14.1) native GDB debugging session hangs #1140

Closed rm374 closed 8 months ago

rm374 commented 8 months ago

Debug adapter definition and debug configuration

dap.adapters.gdb = { type = "executable", command = "gdb", -- args = { "-i", "dap" } -- NOTE: this gives interpretter error in dap.log args = { "-i", "mi" } -- NOTE: this simply hangs in neovim }

Debug adapter version

No response

Steps to Reproduce

Upgraded to latest NeoVim (0.95). Upgraded DAP and DAP-UI to latest using Lazy. I noticed that on Linux running gdb 14.1, the args -i dap result in 'Interpreter dap unrecognized' error. I switched to ("-i", "mi") and while that doesnt causes the gdb to exit, it goes unresponsive. I do see gdb running in terminal though.

Pasting the log from dap.out below -

[ DEBUG ] 2024-01-17T12:26:21Z-0500 ] ...1995/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1366 ] "Spawning debug adapter" { args = { "-i", "mi" }, command = "gdb", type = "executable" } [ DEBUG ] 2024-01-17T12:26:21Z-0500 ] ...1995/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1676 ] "request" { arguments = { adapterID = "nvim-dap", clientID = "neovim", clientName = "neovim", columnsStartAt1 = true, linesStartAt1 = true, locale = "en_US.UTF-8", pathFormat = "path", supportsProgressReporting = true, supportsRunInTerminalRequest = true, supportsStartDebuggingRequest = true, supportsVariableType = true }, command = "initialize", seq = 1, type = "request" }

Expected Result

Debugging session should continue and breakpoint should hit.

Actual Result

nvim-dap hangs with no further errors.

TheNemoNemesis commented 8 months ago

I have a similar error on Windows, I tried to do the same things as you and ended up with this message:

Debug adapter didn't respond. Either the adapter is slow (then wait and ignore this) or there is a problem with your adapter or `gdb` configuration. Check the logs for errors (:help dap.set_log_level)

I tried to post a question on Stackoverflow 26 days ago and still I haven't got an answer. Gdb even starts, but it seems like it is not responding to neovim

rm374 commented 8 months ago

Figured this out. Its an issue with GDB. It needs to be compiled with python support otherwise -i dap will not work. You can check if your gdb has python support by executing - gdb --config and verity that --with-python/libdir have values in them.

mfussenegger commented 8 months ago

Using -i mi does of course not work because then you're not using the debug adapter protocol.