actually fix debugger to not crash on <Leader>cdt

This commit is contained in:
Mitchell Hingley committed 2026-10-15 14:46:24 -04:00
1 parent 0d79f8485b
commit 4ae09d7685
2 files changed
+40 -24

No files matched your search

+16
View File
@@ -124,6 +124,22 @@ return {
dapui.setup()
require("nvim-dap-virtual-text").setup()
-- The dap-ui "disconnect" control (the plug icon) and dap.disconnect in
-- general send a DAP `disconnect` request. With the codelldb server
-- adapter that path crashes the adapter
-- (STATUS_ACCESS_VIOLATION / 0xC0000005, see dap.log) while the inferior
-- is still attached, and on Windows that takes Neovim down with it.
--
-- The `terminate` request path (the square Stop button / <leader>cdt)
-- tears the inferior down cleanly first, so codelldb's crash on the way
-- out is harmless. Route the disconnect control through terminate too.
-- (_G._dapui is created when dapui.controls is required; force-load it so
-- the override is in place before the controls winbar renders.)
require("dapui.controls")
_G._dapui.disconnect = function()
dap.terminate()
end
-- Automatically manage debugger installations via Mason
require("mason-nvim-dap").setup({
ensure_installed = { "codelldb", "cppdbg" }, -- Auto-installs CodeLLDB