At program counter sign
Currently at its most trivial
This commit is contained in:
parent
ef5ac26f48
commit
074c946d20
2 changed files with 28 additions and 2 deletions
|
|
@ -119,7 +119,6 @@ class DebugAdapterConnection( object ):
|
||||||
_logger.error( 'Request failed: {0}'.format( message[ 'message' ] ) )
|
_logger.error( 'Request failed: {0}'.format( message[ 'message' ] ) )
|
||||||
vim.command( "echom 'Request failed: {0}'".format(
|
vim.command( "echom 'Request failed: {0}'".format(
|
||||||
message[ 'message' ] ) )
|
message[ 'message' ] ) )
|
||||||
|
|
||||||
elif message[ 'type' ] == 'event':
|
elif message[ 'type' ] == 'event':
|
||||||
method = 'OnEvent_' + message[ 'event' ]
|
method = 'OnEvent_' + message[ 'event' ]
|
||||||
if method in dir( self._handler ) and getattr( self._handler, method ):
|
if method in dir( self._handler ) and getattr( self._handler, method ):
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,8 @@ from vimspector import debug_adapter_connection, stack_trace, utils, variables
|
||||||
|
|
||||||
_logger = logging.getLogger( __name__ )
|
_logger = logging.getLogger( __name__ )
|
||||||
|
|
||||||
|
SIGN_ID_OFFSET = 10000000
|
||||||
|
|
||||||
|
|
||||||
class DebugSession( object ):
|
class DebugSession( object ):
|
||||||
def __init__( self, channel_send_func ):
|
def __init__( self, channel_send_func ):
|
||||||
|
|
@ -34,12 +36,16 @@ class DebugSession( object ):
|
||||||
self._threadsBuffer = None
|
self._threadsBuffer = None
|
||||||
self._outputBuffer = None
|
self._outputBuffer = None
|
||||||
|
|
||||||
# TODO: How to hold/model this data
|
|
||||||
self._currentThread = None
|
self._currentThread = None
|
||||||
self._currentFrame = None
|
self._currentFrame = None
|
||||||
|
|
||||||
self._SetUpUI()
|
self._SetUpUI()
|
||||||
|
|
||||||
|
self._next_sign_id = SIGN_ID_OFFSET
|
||||||
|
self._signs = {
|
||||||
|
'vimspectorPC': None,
|
||||||
|
}
|
||||||
|
|
||||||
def _SetUpUI( self ):
|
def _SetUpUI( self ):
|
||||||
# Code window
|
# Code window
|
||||||
vim.command( 'tabnew' )
|
vim.command( 'tabnew' )
|
||||||
|
|
@ -52,6 +58,8 @@ class DebugSession( object ):
|
||||||
vim.command( 'nnoremenu WinBar.Finish :call vimspector#StepOut()<CR>' )
|
vim.command( 'nnoremenu WinBar.Finish :call vimspector#StepOut()<CR>' )
|
||||||
vim.command( 'nnoremenu WinBar.Pause :call vimspector#Pause()<CR>' )
|
vim.command( 'nnoremenu WinBar.Pause :call vimspector#Pause()<CR>' )
|
||||||
|
|
||||||
|
vim.command( 'sign define vimspectorPC text=>> texthl=Search' )
|
||||||
|
|
||||||
# Threads
|
# Threads
|
||||||
vim.command( '50vspl' )
|
vim.command( '50vspl' )
|
||||||
vim.command( 'enew' )
|
vim.command( 'enew' )
|
||||||
|
|
@ -83,6 +91,11 @@ class DebugSession( object ):
|
||||||
def SetCurrentFrame( self, frame ):
|
def SetCurrentFrame( self, frame ):
|
||||||
self._currentFrame = frame
|
self._currentFrame = frame
|
||||||
vim.current.window = self._codeWindow
|
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(
|
buffer_number = vim.eval( 'bufnr( "{0}", 1 )'.format(
|
||||||
frame[ 'source' ][ 'path' ] ) )
|
frame[ 'source' ][ 'path' ] ) )
|
||||||
|
|
||||||
|
|
@ -93,6 +106,16 @@ class DebugSession( object ):
|
||||||
raise
|
raise
|
||||||
|
|
||||||
self._codeWindow.cursor = ( frame[ 'line' ], frame[ 'column' ] )
|
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 )
|
self._variablesView.LoadScopes( frame )
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -103,6 +126,10 @@ class DebugSession( object ):
|
||||||
self._Initialise()
|
self._Initialise()
|
||||||
|
|
||||||
def Stop( self ):
|
def Stop( self ):
|
||||||
|
if self._signs[ 'vimspectorPC' ]:
|
||||||
|
vim.command( 'sign unplace {0}'.format( self._signs[ 'vimspectorPC' ] ) )
|
||||||
|
self._signs[ 'vimspectorPC' ] = None
|
||||||
|
|
||||||
self._connection.DoRequest( None, {
|
self._connection.DoRequest( None, {
|
||||||
'command': 'disconnect',
|
'command': 'disconnect',
|
||||||
'arguments': {
|
'arguments': {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue