Compare commits
4 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d12c0897f2 | ||
|
|
e7fb49f03d | ||
|
|
f003d66d35 | ||
|
|
7a8f479f66 |
6 changed files with 103 additions and 30 deletions
|
|
@ -47,6 +47,16 @@ function! vimspector#internal#state#GetAPIPrefix() abort
|
||||||
return s:prefix
|
return s:prefix
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! vimspector#internal#state#TabClosed() abort
|
||||||
|
py3 << EOF
|
||||||
|
|
||||||
|
if ( '_vimspector_session' in globals() and _vimspector_session
|
||||||
|
and not _vimspector_session._HasUI() ):
|
||||||
|
_vimspector_session.Reset( interactive = False )
|
||||||
|
|
||||||
|
EOF
|
||||||
|
endfunction
|
||||||
|
|
||||||
" Boilerplate {{{
|
" Boilerplate {{{
|
||||||
let &cpoptions=s:save_cpo
|
let &cpoptions=s:save_cpo
|
||||||
unlet s:save_cpo
|
unlet s:save_cpo
|
||||||
|
|
|
||||||
|
|
@ -155,7 +155,9 @@ if ! has( 'gui_running' )
|
||||||
" å is the right-option+q
|
" å is the right-option+q
|
||||||
nnoremap <buffer> å :cfirst<CR>
|
nnoremap <buffer> å :cfirst<CR>
|
||||||
" å is the right-option+a
|
" å is the right-option+a
|
||||||
nnoremap <buffer> œ :FuncLine<CR>
|
nnoremap <buffer> œ :cnext<CR>
|
||||||
|
" å is the right-option+f
|
||||||
|
nnoremap <buffer> ƒ :FuncLine<CR>
|
||||||
" Ω is the right-option+z
|
" Ω is the right-option+z
|
||||||
nnoremap <buffer> Ω :cprevious<CR>
|
nnoremap <buffer> Ω :cprevious<CR>
|
||||||
endif
|
endif
|
||||||
|
|
|
||||||
|
|
@ -765,6 +765,8 @@ and have to tell cpptools a few more options.
|
||||||
"remote": {
|
"remote": {
|
||||||
"host": "${host}",
|
"host": "${host}",
|
||||||
"account": "${account}",
|
"account": "${account}",
|
||||||
|
// or, alternatively "container": "${ContainerID}"
|
||||||
|
|
||||||
"runCommand": [
|
"runCommand": [
|
||||||
"gdbserver",
|
"gdbserver",
|
||||||
"--once",
|
"--once",
|
||||||
|
|
@ -772,14 +774,19 @@ and have to tell cpptools a few more options.
|
||||||
"--disable-randomisation",
|
"--disable-randomisation",
|
||||||
"0.0.0.0:${port}",
|
"0.0.0.0:${port}",
|
||||||
"%CMD%"
|
"%CMD%"
|
||||||
}
|
},
|
||||||
|
"delay": "1000m" // optional
|
||||||
},
|
},
|
||||||
"attach": {
|
"attach": {
|
||||||
"remote": {
|
"remote": {
|
||||||
"host": "${host}",
|
"host": "${host}",
|
||||||
"account": "${account}",
|
"account": "${account}",
|
||||||
|
// or, alternatively "container": "${ContainerID}"
|
||||||
|
|
||||||
"pidCommand": [
|
"pidCommand": [
|
||||||
"/path/to/secret/script/GetPIDForService", "${ServiceName}"
|
// e.g. "/path/to/secret/script/GetPIDForService", "${ServiceName}"
|
||||||
|
// or...
|
||||||
|
"pgrep", "executable"
|
||||||
],
|
],
|
||||||
"attachCommand": [
|
"attachCommand": [
|
||||||
"gdbserver",
|
"gdbserver",
|
||||||
|
|
@ -796,12 +803,13 @@ and have to tell cpptools a few more options.
|
||||||
// application never attaches, try using the following to manually
|
// application never attaches, try using the following to manually
|
||||||
// force the trap signal.
|
// force the trap signal.
|
||||||
//
|
//
|
||||||
"initCompleteCommand": [
|
// "initCompleteCommand": [
|
||||||
"kill",
|
// "kill",
|
||||||
"-TRAP",
|
// "-TRAP",
|
||||||
"%PID%"
|
// "%PID%"
|
||||||
]
|
// ]
|
||||||
}
|
},
|
||||||
|
"delay": "1000m" // optional
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -811,22 +819,27 @@ and have to tell cpptools a few more options.
|
||||||
"remote-cmdLine": [ "/path/to/the/remote/executable", "args..." ],
|
"remote-cmdLine": [ "/path/to/the/remote/executable", "args..." ],
|
||||||
"remote-request": "launch",
|
"remote-request": "launch",
|
||||||
"configuration": {
|
"configuration": {
|
||||||
"request": "attach", // yes, attach!
|
"request": "launch",
|
||||||
|
|
||||||
"program": "/path/to/the/local/executable",
|
"program": "/path/to/the/local/executable",
|
||||||
|
"cwd": "${workspaceRoot},
|
||||||
"MIMode": "gdb",
|
"MIMode": "gdb",
|
||||||
"miDebuggerAddress": "${host}:${port}"
|
"miDebuggerServerAddress": "${host}:${port}",
|
||||||
|
"sourceFileMap#json": "{\"${RemoteRoot}\": \"${workspaceRoot}\"}"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"remote attach": {
|
"remote attach": {
|
||||||
"adapter": "cpptools-remote",
|
"adapter": "cpptools-remote",
|
||||||
"remote-request": "attach",
|
"remote-request": "attach",
|
||||||
"configuration": {
|
"configuration": {
|
||||||
"request": "attach",
|
"request": "launch",
|
||||||
|
|
||||||
"program": "/path/to/the/local/executable",
|
"program": "/path/to/the/local/executable",
|
||||||
|
"cwd": "${workspaceRoot},
|
||||||
"MIMode": "gdb",
|
"MIMode": "gdb",
|
||||||
"miDebuggerAddress": "${host}:${port}"
|
"miDebuggerServerAddress": "${host}:${port}",
|
||||||
|
"sourceFileMap#json": "{\"${RemoteRoot}\": \"${workspaceRoot}\"}"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -145,9 +145,14 @@ augroup VimspectorUserAutoCmds
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
" FIXME: Only register this _while_ debugging is active
|
" FIXME: Only register this _while_ debugging is active
|
||||||
|
let g:vimspector_resetting = 0
|
||||||
augroup Vimspector
|
augroup Vimspector
|
||||||
autocmd!
|
autocmd!
|
||||||
autocmd BufNew * call vimspector#OnBufferCreated( expand( '<afile>' ) )
|
autocmd BufNew * call vimspector#OnBufferCreated( expand( '<afile>' ) )
|
||||||
|
autocmd TabClosed *
|
||||||
|
\ if !g:vimspector_resetting
|
||||||
|
\ | call vimspector#internal#state#TabClosed()
|
||||||
|
\ | endif
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
" boilerplate {{{
|
" boilerplate {{{
|
||||||
|
|
|
||||||
|
|
@ -61,6 +61,7 @@ class DebugSession( object ):
|
||||||
self._stackTraceView = None
|
self._stackTraceView = None
|
||||||
self._variablesView = None
|
self._variablesView = None
|
||||||
self._outputView = None
|
self._outputView = None
|
||||||
|
self._codeView = None
|
||||||
self._breakpoints = breakpoints.ProjectBreakpoints()
|
self._breakpoints = breakpoints.ProjectBreakpoints()
|
||||||
self._splash_screen = None
|
self._splash_screen = None
|
||||||
self._remote_term = None
|
self._remote_term = None
|
||||||
|
|
@ -404,22 +405,19 @@ class DebugSession( object ):
|
||||||
self._Reset()
|
self._Reset()
|
||||||
|
|
||||||
def _Reset( self ):
|
def _Reset( self ):
|
||||||
|
vim.vars[ 'vimspector_resetting' ] = 1
|
||||||
self._logger.info( "Debugging complete." )
|
self._logger.info( "Debugging complete." )
|
||||||
if self._uiTab:
|
|
||||||
self._logger.debug( "Clearing down UI" )
|
|
||||||
|
|
||||||
del vim.vars[ 'vimspector_session_windows' ]
|
def ResetUI():
|
||||||
vim.current.tabpage = self._uiTab
|
if self._stackTraceView:
|
||||||
|
self._stackTraceView.Reset()
|
||||||
|
if self._variablesView:
|
||||||
|
self._variablesView.Reset()
|
||||||
|
if self._outputView:
|
||||||
|
self._outputView.Reset()
|
||||||
|
if self._codeView:
|
||||||
|
self._codeView.Reset()
|
||||||
|
|
||||||
self._splash_screen = utils.HideSplash( self._api_prefix,
|
|
||||||
self._splash_screen )
|
|
||||||
|
|
||||||
self._stackTraceView.Reset()
|
|
||||||
self._variablesView.Reset()
|
|
||||||
self._outputView.Reset()
|
|
||||||
self._codeView.Reset()
|
|
||||||
vim.command( 'tabclose!' )
|
|
||||||
vim.command( 'doautocmd <nomodeline> User VimspectorDebugEnded' )
|
|
||||||
self._stackTraceView = None
|
self._stackTraceView = None
|
||||||
self._variablesView = None
|
self._variablesView = None
|
||||||
self._outputView = None
|
self._outputView = None
|
||||||
|
|
@ -427,6 +425,24 @@ class DebugSession( object ):
|
||||||
self._remote_term = None
|
self._remote_term = None
|
||||||
self._uiTab = None
|
self._uiTab = None
|
||||||
|
|
||||||
|
if self._HasUI():
|
||||||
|
self._logger.debug( "Clearing down UI" )
|
||||||
|
vim.current.tabpage = self._uiTab
|
||||||
|
self._splash_screen = utils.HideSplash( self._api_prefix,
|
||||||
|
self._splash_screen )
|
||||||
|
ResetUI()
|
||||||
|
vim.command( 'tabclose!' )
|
||||||
|
else:
|
||||||
|
ResetUI()
|
||||||
|
|
||||||
|
try:
|
||||||
|
del vim.vars[ 'vimspector_session_windows' ]
|
||||||
|
except KeyError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
vim.command( 'doautocmd <nomodeline> User VimspectorDebugEnded' )
|
||||||
|
vim.vars[ 'vimspector_resetting' ] = 0
|
||||||
|
|
||||||
# make sure that we're displaying signs in any still-open buffers
|
# make sure that we're displaying signs in any still-open buffers
|
||||||
self._breakpoints.UpdateUI()
|
self._breakpoints.UpdateUI()
|
||||||
|
|
||||||
|
|
@ -894,6 +910,7 @@ class DebugSession( object ):
|
||||||
self._splash_screen,
|
self._splash_screen,
|
||||||
"Unable to start adapter" )
|
"Unable to start adapter" )
|
||||||
else:
|
else:
|
||||||
|
handlers = [ self ]
|
||||||
if 'custom_handler' in self._adapter:
|
if 'custom_handler' in self._adapter:
|
||||||
spec = self._adapter[ 'custom_handler' ]
|
spec = self._adapter[ 'custom_handler' ]
|
||||||
if isinstance( spec, dict ):
|
if isinstance( spec, dict ):
|
||||||
|
|
@ -902,10 +919,12 @@ class DebugSession( object ):
|
||||||
else:
|
else:
|
||||||
module, cls = spec.rsplit( '.', 1 )
|
module, cls = spec.rsplit( '.', 1 )
|
||||||
|
|
||||||
CustomHandler = getattr( importlib.import_module( module ), cls )
|
try:
|
||||||
handlers = [ CustomHandler( self ), self ]
|
CustomHandler = getattr( importlib.import_module( module ), cls )
|
||||||
else:
|
handlers = [ CustomHandler( self ), self ]
|
||||||
handlers = [ self ]
|
except ImportError:
|
||||||
|
self._logger.exception( "Unable to load custom adapter %s",
|
||||||
|
spec )
|
||||||
|
|
||||||
self._connection = debug_adapter_connection.DebugAdapterConnection(
|
self._connection = debug_adapter_connection.DebugAdapterConnection(
|
||||||
handlers,
|
handlers,
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,17 @@ function! ClearDown()
|
||||||
call vimspector#test#setup#ClearDown()
|
call vimspector#test#setup#ClearDown()
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
let s:fn='../support/test/python/simple_python/main.py'
|
||||||
|
|
||||||
|
function! s:StartDebugging()
|
||||||
|
exe 'edit ' . s:fn
|
||||||
|
call setpos( '.', [ 0, 23, 1 ] )
|
||||||
|
call vimspector#ToggleBreakpoint()
|
||||||
|
call vimspector#LaunchWithSettings( { 'configuration': 'run' } )
|
||||||
|
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( s:fn, 23, 1 )
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
function! Test_Step_With_Different_Tabpage()
|
function! Test_Step_With_Different_Tabpage()
|
||||||
lcd testdata/cpp/simple
|
lcd testdata/cpp/simple
|
||||||
edit simple.cpp
|
edit simple.cpp
|
||||||
|
|
@ -154,3 +165,16 @@ function! Test_All_Buffers_Deleted_Installer()
|
||||||
au! Test_All_Buffers_Deleted_Installer
|
au! Test_All_Buffers_Deleted_Installer
|
||||||
%bwipe!
|
%bwipe!
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! Test_Close_Tab_No_Vimspector()
|
||||||
|
tabnew
|
||||||
|
q
|
||||||
|
%bwipe!
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! Test_Close_Tab_With_Vimspector()
|
||||||
|
call s:StartDebugging()
|
||||||
|
tabclose!
|
||||||
|
call vimspector#test#setup#WaitForReset()
|
||||||
|
%bwipe!
|
||||||
|
endfunction
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue