nvim-dap cpp degbug - win gnu

$ tree -a
.
├── .cache
│   └── clangd
│       └── index
│           └── hello.cpp.48B5401E85030568.idx
├── .ccls
├── .ccls-cache
│   ├── @C@@Users@dev@Desktop@gnuwin@testProject@cpp
│   │   ├── C@@gnu@msys64@mingw64@include@_mingw.h
│   │   ├── C@@gnu@msys64@mingw64@include@_mingw.h.blob
│   │   ├── C@@gnu@msys64@mingw64@include@_mingw_mac.h
│   │   ├── C@@gnu@msys64@mingw64@include@_mingw_mac.h.blob
│   │   ├── C@@gnu@msys64@mingw64@include@_mingw_off_t.h
│   │   ├── C@@gnu@msys64@mingw64@include@_mingw_off_t.h.blob
│   │   ├── C@@gnu@msys64@mingw64@include@_mingw_secapi.h
│   │   ├── C@@gnu@msys64@mingw64@include@_mingw_secapi.h.blob
│   │   ├── C@@gnu@msys64@mingw64@include@_mingw_stat64.h
│   │   ├── C@@gnu@msys64@mingw64@include@_mingw_stat64.h.blob
│   │   ├── C@@gnu@msys64@mingw64@include@_timeval.h
│   │   ├── C@@gnu@msys64@mingw64@include@_timeval.h.blob
│   │   ├── C@@gnu@msys64@mingw64@include@assert.h
│   │   ├── C@@gnu@msys64@mingw64@include@assert.h.blob
│   │   ├── C@@gnu@msys64@mingw64@include@c++@12.2.0@array
│   │   ├── C@@gnu@msys64@mingw64@include@c++@12.2.0@array.blob
│   │   ├── C@@gnu@msys64@mingw64@include@c++@12.2.0@atomic
│   │   ├── C@@gnu@msys64@mingw64@include@c++@12.2.0@atomic.blob
│   │   ├── C@@gnu@msys64@mingw64@include@c++@12.2.0@backward@auto_ptr.h
│   │   ├── C@@gnu@msys64@mingw64@include@c++@12.2.0@backward@auto_ptr.h.blob
│   │   ├── C@@gnu@msys64@mingw64@include@c++@12.2.0@backward@binders.h
│   │   ├── C@@gnu@msys64@mingw64@include@c++@12.2.0@backward@binders.h.blob
│   │   ├── C@@gnu@msys64@mingw64@include@c++@12.2.0@bit
│   │   ├── C@@gnu@msys64@mingw64@include@c++@12.2.0@bit.blob
│   │   ├── C@@gnu@msys64@mingw64@include@c++@12.2.0@bits@algorithmfwd.h
│   │   ├── C@@gnu@msys64@mingw64@include@c++@12.2.0@bits@algorithmfwd.h.blob
│   │   ├── C@@gnu@msys64@mingw64@include@c++@12.2.0@bits@align.h
│   │   ├── C@@gnu@msys64@mingw64@include@c++@12.2.0@bits@align.h.blob
│   │   ├── C@@gnu@msys64@mingw64@include@c++@12.2.0@bits@alloc_traits.h
│   │   ├── C@@gnu@msys64@mingw64@include@c++@12.2.0@bits@alloc_traits.h.blob
│   │   ├── C@@gnu@msys64@mingw64@include@c++@12.2.0@bits@allocated_ptr.h
│   │   ├── C@@gnu@msys64@mingw64@include@c++@12.2.0@bits@allocated_ptr.h.blob
│   │   ├── C@@gnu@msys64@mingw64@include@c++@12.2.0@bits@allocator.h
│   │   ├── C@@gnu@msys64@mingw64@include@c++@12.2.0@bits@allocator.h.blob
│   │   ├── C@@gnu@msys64@mingw64@include@c++@12.2.0@bits@atomic_base.h
...
│   │   └── C@@gnu@msys64@mingw64@lib@clang@16@include@vadefs.h.blob
│   └── C@@Users@dev@Desktop@gnuwin@testProject@cpp
│       ├── src@hello.cpp
│       └── src@hello.cpp.blob
├── .nvim
│   └── nvim-dap.lua
├── CMakeLists.txt
├── bin
│   └── hello.exe
├── build
│   ├── .ninja_deps
│   ├── .ninja_log
│   ├── CMakeCache.txt
│   ├── CMakeFiles
│   │   ├── 3.26.3
│   │   │   ├── CMakeCCompiler.cmake
│   │   │   ├── CMakeCXXCompiler.cmake
│   │   │   ├── CMakeDetermineCompilerABI_C.bin
│   │   │   ├── CMakeDetermineCompilerABI_CXX.bin
│   │   │   ├── CMakeRCCompiler.cmake
│   │   │   ├── CMakeSystem.cmake
│   │   │   ├── CompilerIdC
│   │   │   │   ├── CMakeCCompilerId.c
│   │   │   │   ├── a.exe
│   │   │   │   └── tmp
│   │   │   └── CompilerIdCXX
│   │   │       ├── CMakeCXXCompilerId.cpp
│   │   │       ├── a.exe
│   │   │       └── tmp
│   │   ├── CMakeConfigureLog.yaml
│   │   ├── CMakeScratch
│   │   ├── TargetDirectories.txt
│   │   ├── cmake.check_cache
│   │   ├── hello.dir
│   │   │   └── src
│   │   │       └── hello.cpp.obj
│   │   ├── pkgRedirects
│   │   └── rules.ninja
│   ├── build.ninja
│   ├── cmake_install.cmake
│   └── compile_commands.json
├── read.md
└── src
    └── hello.cpp

20 directories, 424 files

.ccls

%compile_commands.json

%h -x
%h c++-header

%hpp

.nvim\nvim-dap.lua


local dap = require("dap")

dap.adapters.cppdbg = {
  id = 'cppdbg',
  type = 'executable',
  command = 'c:\\gnu\\tool\\cpptools\\extension\\debugAdapters\\bin\\OpenDebugAD7.exe',
  options = {
    detached = false
  }
}


local dap = require('dap')
dap.configurations.cpp = {
  {
    name = "Launch file",
    type = "cppdbg",
    request = "launch",
    program = function()
      return vim.fn.input('', vim.fn.getcwd() .. '/bin', 'file')
    end,
    cwd = '${workspaceFolder}/bin',
    stopAtEntry = false,
  }
}

dap.configurations.c = dap.configurations.cpp
dap.configurations.rust = dap.configurations.cpp

dapui = require("dapui")
dap.listeners.after.event_initialized["dapui_config"] = function()
  dapui.open()
end
dap.listeners.before.event_terminated["dapui_config"] = function()
  dapui.close()
end
dap.listeners.before.event_exited["dapui_config"] = function()
  dapui.close()
end

coc-settings.json

没有进行配置,还是可以debug cpp。

posted @ 2023-04-09 10:25  fndefbwefsowpvqfx  阅读(70)  评论(0编辑  收藏  举报