在调试C++时,在Vimspector的调试窗口中没有看到变量Neovim的程序。断点集也看不到

发布于 2025-02-10 14:56:16 字数 3511 浏览 3 评论 0原文

我是使用vimspector的新诺沃姆调试的新手。当我设置断点并打开调试器时,我无法看到任何变量或看到断点本身。这里可能怎么了? vimspector debugger打开时,没有显示变量或断点点。

带有断点设置的代码。

是我的.vimspector.json。

{
"configurations": {
  "C - Launch": {
    "adapter": "vscode-cpptools",
    "configuration": {
      "request": "launch",
      "externalConsole": true,
      "stopOnEntry": true,
      "stopAtEntry": true,
      "MIMode": "gdb",
      "cwd": "${workspaceRoot}",
      "program": "${workspaceRoot}/test"
    }
  }
  }
} 

下面

:set number
:set relativenumber
:set autoindent
:set tabstop=4
:set shiftwidth=4
:set smarttab
:set softtabstop=4
:set mouse=a

call plug#begin()
Plug 'voldikss/vim-browser-search'
   Plug 'preservim/nerdtree'
    Plug 'pineapplegiant/spaceduck', { 'branch': 'main' }
Plug 'https://github.com/tc50cal/vim-terminal'
Plug 'http://github.com/tpope/vim-surround' " Surrounding ysw)
Plug 'https://github.com/tpope/vim-commentary' " For Commenting gcc & gc
Plug 'https://github.com/vim-airline/vim-airline' " Status bar
Plug 'https://github.com/lifepillar/pgsql.vim' 
Plug 'https://github.com/ap/vim-css-color' " CSS Color Preview
Plug 'https://github.com/rafi/awesome-vim-colorschemes' " Retro Scheme
Plug 'https://github.com/neoclide/coc.nvim'  " Auto Completion
Plug 'https://github.com/ryanoasis/vim-devicons' " Developer Icons
Plug 'https://github.com/preservim/tagbar' " Tagbar for code navigation
Plug 'https://github.com/terryma/vim-multiple-cursors' " CTRL + N for multiple cursors
Plug 'https://github.com/puremourning/vimspector'
set encoding=UTF-8
call plug#end()

let g:vimspector_enable_mappings = 'HUMAN'



nmap <silent> <Leader>s <Plug>SearchNormal
vmap <silent> <Leader>s <Plug>SearchVisual
nnoremap <C-f> :NERDTreeFocus<CR>
nnoremap <C-n> :NERDTree<CR>
nnoremap <C-t> :NERDTreeToggle<CR>
nnoremap <C-l> :call CocActionAsync('jumpDefinition')<CR>

nmap <F8> :TagbarToggle<CR>

:set completeopt-=preview " For No Previews

let g:NERDTreeDirArrowExpandable="+"
let g:NERDTreeDirArrowCollapsible="~"

" --- Just Some Notes ---
" :PlugClean :PlugInstall :UpdateRemotePlugins
"
" :CocInstall coc-python
" :CocInstall coc-clangd
" :CocInstall coc-snippets
" :CocCommand snippets.edit... FOR EACH FILE TYPE

" air-line
let g:airline_powerline_fonts = 1

if !exists('g:airline_symbols')
    let g:airline_symbols = {}
endif

" airline symbols
let g:airline_left_sep = ''
let g:airline_left_alt_sep = ''
let g:airline_right_sep = ''
let g:airline_right_alt_sep = ''
let g:airline_symbols.branch = ''
let g:airline_symbols.readonly = ''
let g:airline_symbols.linenr = ''

inoremap <expr> <Tab> pumvisible() ? coc#_select_confirm() : "<Tab>"


  if exists('+termguicolors')
      let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
      let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
      set termguicolors
    endif

   colorscheme spaceduck

let g:vimspector_enable_mappings = 'HUMAN'
nnoremap <Leader>dd :call vimspector#Launch()<CR>
nnoremap <Leader>dx :call vimspector#Reset()<CR>
nnoremap <Leader>de :call vimspectorEval
nnoremap <Leader>dw :call vimspectorWatch
nnoremap <Leader>do :call vimspectorShowOutput

I am new to this Neovim debugging using Vimspector. When i set breakpoints and open debugger i am unable to see any variables or see breakpoints itself. What might be wrong here?
Vimspector Debugger when opened,showing no variables or break points.

Code with breakpoint set.

Below is my .vimspector.json

{
"configurations": {
  "C - Launch": {
    "adapter": "vscode-cpptools",
    "configuration": {
      "request": "launch",
      "externalConsole": true,
      "stopOnEntry": true,
      "stopAtEntry": true,
      "MIMode": "gdb",
      "cwd": "${workspaceRoot}",
      "program": "${workspaceRoot}/test"
    }
  }
  }
} 

Below is my innit.vim code if needed:

:set number
:set relativenumber
:set autoindent
:set tabstop=4
:set shiftwidth=4
:set smarttab
:set softtabstop=4
:set mouse=a

call plug#begin()
Plug 'voldikss/vim-browser-search'
   Plug 'preservim/nerdtree'
    Plug 'pineapplegiant/spaceduck', { 'branch': 'main' }
Plug 'https://github.com/tc50cal/vim-terminal'
Plug 'http://github.com/tpope/vim-surround' " Surrounding ysw)
Plug 'https://github.com/tpope/vim-commentary' " For Commenting gcc & gc
Plug 'https://github.com/vim-airline/vim-airline' " Status bar
Plug 'https://github.com/lifepillar/pgsql.vim' 
Plug 'https://github.com/ap/vim-css-color' " CSS Color Preview
Plug 'https://github.com/rafi/awesome-vim-colorschemes' " Retro Scheme
Plug 'https://github.com/neoclide/coc.nvim'  " Auto Completion
Plug 'https://github.com/ryanoasis/vim-devicons' " Developer Icons
Plug 'https://github.com/preservim/tagbar' " Tagbar for code navigation
Plug 'https://github.com/terryma/vim-multiple-cursors' " CTRL + N for multiple cursors
Plug 'https://github.com/puremourning/vimspector'
set encoding=UTF-8
call plug#end()

let g:vimspector_enable_mappings = 'HUMAN'



nmap <silent> <Leader>s <Plug>SearchNormal
vmap <silent> <Leader>s <Plug>SearchVisual
nnoremap <C-f> :NERDTreeFocus<CR>
nnoremap <C-n> :NERDTree<CR>
nnoremap <C-t> :NERDTreeToggle<CR>
nnoremap <C-l> :call CocActionAsync('jumpDefinition')<CR>

nmap <F8> :TagbarToggle<CR>

:set completeopt-=preview " For No Previews

let g:NERDTreeDirArrowExpandable="+"
let g:NERDTreeDirArrowCollapsible="~"

" --- Just Some Notes ---
" :PlugClean :PlugInstall :UpdateRemotePlugins
"
" :CocInstall coc-python
" :CocInstall coc-clangd
" :CocInstall coc-snippets
" :CocCommand snippets.edit... FOR EACH FILE TYPE

" air-line
let g:airline_powerline_fonts = 1

if !exists('g:airline_symbols')
    let g:airline_symbols = {}
endif

" airline symbols
let g:airline_left_sep = ''
let g:airline_left_alt_sep = ''
let g:airline_right_sep = ''
let g:airline_right_alt_sep = ''
let g:airline_symbols.branch = ''
let g:airline_symbols.readonly = ''
let g:airline_symbols.linenr = ''

inoremap <expr> <Tab> pumvisible() ? coc#_select_confirm() : "<Tab>"


  if exists('+termguicolors')
      let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
      let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
      set termguicolors
    endif

   colorscheme spaceduck

let g:vimspector_enable_mappings = 'HUMAN'
nnoremap <Leader>dd :call vimspector#Launch()<CR>
nnoremap <Leader>dx :call vimspector#Reset()<CR>
nnoremap <Leader>de :call vimspectorEval
nnoremap <Leader>dw :call vimspectorWatch
nnoremap <Leader>do :call vimspectorShowOutput

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

蘸点软妹酱 2025-02-17 14:56:16

我的问题与我一样,解决方案是:
与选项-G一起编译源代码以生成调试信息,例如。 GCC -G -O Test Test.c

之后,Vimspector可及时正确。

您应该先尝试GDB,例如。 GDB测试,无需选项-G,输出:

从测试中读取符号...(在测试中找不到调试符号)

This issue is same with me, solution is:
Compile source code with option -g to generate debug info, eg. gcc -g -o test test.c .

after that Vimspector vairable diplay correctly.

You should try gdb first, eg. gdb test, gcc without option -g, output:

Reading symbols from test... (No debugging symbols found in test)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文