At program counter sign

Currently at its most trivial
This commit is contained in:
Ben Jackson 2018-05-20 22:30:42 +01:00
commit 074c946d20
2 changed files with 28 additions and 2 deletions

View file

@ -119,7 +119,6 @@ class DebugAdapterConnection( object ):
_logger.error( 'Request failed: {0}'.format( message[ 'message' ] ) )
vim.command( "echom 'Request failed: {0}'".format(
message[ 'message' ] ) )
elif message[ 'type' ] == 'event':
method = 'OnEvent_' + message[ 'event' ]
if method in dir( self._handler ) and getattr( self._handler, method ):

View file

@ -20,6 +20,8 @@ from vimspector import debug_adapter_connection, stack_trace, utils, variables
_logger = logging.getLogger( __name__ )
SIGN_ID_OFFSET = 10000000
class DebugSession( object ):
def __init__( self, channel_send_func ):
@ -34,12 +36,16 @@ class DebugSession( object ):
self._threadsBuffer = None
self._outputBuffer = None
# TODO: How to hold/model this data
self._currentThread = None
self._currentFrame = None
self._SetUpUI()
self._next_sign_id = SIGN_ID_OFFSET
self._signs = {
'vimspectorPC': None,
}
def _SetUpUI( self ):
# Code window
vim.command( 'tabnew' )
@ -52,6 +58,8 @@ class DebugSession( object ):
vim.command( 'nnoremenu WinBar.Finish :call vimspector#StepOut()<CR>' )
vim.command( 'nnoremenu WinBar.Pause :call vimspector#Pause()<CR>' )
vim.command( 'sign define vimspectorPC text=>> texthl=Search' )
# Threads
vim.command( '50vspl' )
vim.command( 'enew' )
@ -83,6 +91,11 @@ class DebugSession( object ):
def SetCurrentFrame( self, frame ):
self._currentFrame = frame
vim.current.window = self._codeWindow
if self._signs[ 'vimspectorPC' ]:
vim.command( 'sign unplace {0}'.format( self._signs[ 'vimspectorPC' ] ) )
self._signs[ 'vimspectorPC' ] = None
buffer_number = vim.eval( 'bufnr( "{0}", 1 )'.format(
frame[ 'source' ][ 'path' ] ) )
@ -93,6 +106,16 @@ class DebugSession( object ):
raise
self._codeWindow.cursor = ( frame[ 'line' ], frame[ 'column' ] )
self._signs[ 'vimspectorPC' ] = self._next_sign_id
self._next_sign_id += 1
vim.command( 'sign place {0} line={1} name=vimspectorPC file={2}'.format(
self._signs[ 'vimspectorPC' ],
frame[ 'line' ],
frame[ 'source' ][ 'path' ] ) )
self._variablesView.LoadScopes( frame )
@ -103,6 +126,10 @@ class DebugSession( object ):
self._Initialise()
def Stop( self ):
if self._signs[ 'vimspectorPC' ]:
vim.command( 'sign unplace {0}'.format( self._signs[ 'vimspectorPC' ] ) )
self._signs[ 'vimspectorPC' ] = None
self._connection.DoRequest( None, {
'command': 'disconnect',
'arguments': {