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
|
||||
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 {{{
|
||||
let &cpoptions=s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
|
|
|||
|
|
@ -155,7 +155,9 @@ if ! has( 'gui_running' )
|
|||
" å is the right-option+q
|
||||
nnoremap <buffer> å :cfirst<CR>
|
||||
" å 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
|
||||
nnoremap <buffer> Ω :cprevious<CR>
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -765,6 +765,8 @@ and have to tell cpptools a few more options.
|
|||
"remote": {
|
||||
"host": "${host}",
|
||||
"account": "${account}",
|
||||
// or, alternatively "container": "${ContainerID}"
|
||||
|
||||
"runCommand": [
|
||||
"gdbserver",
|
||||
"--once",
|
||||
|
|
@ -772,14 +774,19 @@ and have to tell cpptools a few more options.
|
|||
"--disable-randomisation",
|
||||
"0.0.0.0:${port}",
|
||||
"%CMD%"
|
||||
}
|
||||
},
|
||||
"delay": "1000m" // optional
|
||||
},
|
||||
"attach": {
|
||||
"remote": {
|
||||
"host": "${host}",
|
||||
"account": "${account}",
|
||||
// or, alternatively "container": "${ContainerID}"
|
||||
|
||||
"pidCommand": [
|
||||
"/path/to/secret/script/GetPIDForService", "${ServiceName}"
|
||||
// e.g. "/path/to/secret/script/GetPIDForService", "${ServiceName}"
|
||||
// or...
|
||||
"pgrep", "executable"
|
||||
],
|
||||
"attachCommand": [
|
||||
"gdbserver",
|
||||
|
|
@ -796,12 +803,13 @@ and have to tell cpptools a few more options.
|
|||
// application never attaches, try using the following to manually
|
||||
// force the trap signal.
|
||||
//
|
||||
"initCompleteCommand": [
|
||||
"kill",
|
||||
"-TRAP",
|
||||
"%PID%"
|
||||
]
|
||||
}
|
||||
// "initCompleteCommand": [
|
||||
// "kill",
|
||||
// "-TRAP",
|
||||
// "%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-request": "launch",
|
||||
"configuration": {
|
||||
"request": "attach", // yes, attach!
|
||||
"request": "launch",
|
||||
|
||||
"program": "/path/to/the/local/executable",
|
||||
"cwd": "${workspaceRoot},
|
||||
"MIMode": "gdb",
|
||||
"miDebuggerAddress": "${host}:${port}"
|
||||
"miDebuggerServerAddress": "${host}:${port}",
|
||||
"sourceFileMap#json": "{\"${RemoteRoot}\": \"${workspaceRoot}\"}"
|
||||
}
|
||||
},
|
||||
"remote attach": {
|
||||
"adapter": "cpptools-remote",
|
||||
"remote-request": "attach",
|
||||
"configuration": {
|
||||
"request": "attach",
|
||||
"request": "launch",
|
||||
|
||||
"program": "/path/to/the/local/executable",
|
||||
"cwd": "${workspaceRoot},
|
||||
"MIMode": "gdb",
|
||||
"miDebuggerAddress": "${host}:${port}"
|
||||
"miDebuggerServerAddress": "${host}:${port}",
|
||||
"sourceFileMap#json": "{\"${RemoteRoot}\": \"${workspaceRoot}\"}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -145,9 +145,14 @@ augroup VimspectorUserAutoCmds
|
|||
augroup END
|
||||
|
||||
" FIXME: Only register this _while_ debugging is active
|
||||
let g:vimspector_resetting = 0
|
||||
augroup Vimspector
|
||||
autocmd!
|
||||
autocmd BufNew * call vimspector#OnBufferCreated( expand( '<afile>' ) )
|
||||
autocmd TabClosed *
|
||||
\ if !g:vimspector_resetting
|
||||
\ | call vimspector#internal#state#TabClosed()
|
||||
\ | endif
|
||||
augroup END
|
||||
|
||||
" boilerplate {{{
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@ class DebugSession( object ):
|
|||
self._stackTraceView = None
|
||||
self._variablesView = None
|
||||
self._outputView = None
|
||||
self._codeView = None
|
||||
self._breakpoints = breakpoints.ProjectBreakpoints()
|
||||
self._splash_screen = None
|
||||
self._remote_term = None
|
||||
|
|
@ -404,22 +405,19 @@ class DebugSession( object ):
|
|||
self._Reset()
|
||||
|
||||
def _Reset( self ):
|
||||
vim.vars[ 'vimspector_resetting' ] = 1
|
||||
self._logger.info( "Debugging complete." )
|
||||
if self._uiTab:
|
||||
self._logger.debug( "Clearing down UI" )
|
||||
|
||||
del vim.vars[ 'vimspector_session_windows' ]
|
||||
vim.current.tabpage = self._uiTab
|
||||
def ResetUI():
|
||||
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._variablesView = None
|
||||
self._outputView = None
|
||||
|
|
@ -427,6 +425,24 @@ class DebugSession( object ):
|
|||
self._remote_term = 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
|
||||
self._breakpoints.UpdateUI()
|
||||
|
||||
|
|
@ -894,6 +910,7 @@ class DebugSession( object ):
|
|||
self._splash_screen,
|
||||
"Unable to start adapter" )
|
||||
else:
|
||||
handlers = [ self ]
|
||||
if 'custom_handler' in self._adapter:
|
||||
spec = self._adapter[ 'custom_handler' ]
|
||||
if isinstance( spec, dict ):
|
||||
|
|
@ -902,10 +919,12 @@ class DebugSession( object ):
|
|||
else:
|
||||
module, cls = spec.rsplit( '.', 1 )
|
||||
|
||||
CustomHandler = getattr( importlib.import_module( module ), cls )
|
||||
handlers = [ CustomHandler( self ), self ]
|
||||
else:
|
||||
handlers = [ self ]
|
||||
try:
|
||||
CustomHandler = getattr( importlib.import_module( module ), cls )
|
||||
handlers = [ CustomHandler( self ), self ]
|
||||
except ImportError:
|
||||
self._logger.exception( "Unable to load custom adapter %s",
|
||||
spec )
|
||||
|
||||
self._connection = debug_adapter_connection.DebugAdapterConnection(
|
||||
handlers,
|
||||
|
|
|
|||
|
|
@ -6,6 +6,17 @@ function! ClearDown()
|
|||
call vimspector#test#setup#ClearDown()
|
||||
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()
|
||||
lcd testdata/cpp/simple
|
||||
edit simple.cpp
|
||||
|
|
@ -154,3 +165,16 @@ function! Test_All_Buffers_Deleted_Installer()
|
|||
au! Test_All_Buffers_Deleted_Installer
|
||||
%bwipe!
|
||||
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