Updates for latest Python debug adapter
They moved the location of the main application. But also: - ignore multiple responses for the same request - ignore protocol violations for variablesReference (assume 0) - ignore protocol violations for missing 'name' (assume basename of path)
This commit is contained in:
parent
14603ae72f
commit
673de95283
8 changed files with 43 additions and 15 deletions
|
|
@ -9,7 +9,7 @@
|
||||||
},
|
},
|
||||||
"cppdbg": {
|
"cppdbg": {
|
||||||
"name": "cppdbg",
|
"name": "cppdbg",
|
||||||
"command": [ "$HOME/.vscode/extensions/ms-vscode.cpptools-0.17.4/debugAdapters/OpenDebugAD7" ],
|
"command": [ "$HOME/.vscode/extensions/ms-vscode.cpptools-0.20.1/debugAdapters/OpenDebugAD7" ],
|
||||||
"attach": {
|
"attach": {
|
||||||
"pidProperty": "processId",
|
"pidProperty": "processId",
|
||||||
"pidSelect": "ask"
|
"pidSelect": "ask"
|
||||||
|
|
@ -49,7 +49,7 @@
|
||||||
"target": "support/test/cpp/simple_c_program/test",
|
"target": "support/test/cpp/simple_c_program/test",
|
||||||
"args": [],
|
"args": [],
|
||||||
"cwd": ".",
|
"cwd": ".",
|
||||||
"lldbmipath": "$HOME/.vscode/extensions/ms-vscode.cpptools-0.17.4/debugAdapters/lldb/bin/lldb-mi",
|
"lldbmipath": "$HOME/.vscode/extensions/ms-vscode.cpptools-0.20.1/debugAdapters/lldb/bin/lldb-mi",
|
||||||
"trace": true,
|
"trace": true,
|
||||||
"logFilePath": "$HOME/.vimspector.protocol.log"
|
"logFilePath": "$HOME/.vimspector.protocol.log"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -283,7 +283,7 @@ not always (or not completely).
|
||||||
"name": "python",
|
"name": "python",
|
||||||
"command": [
|
"command": [
|
||||||
"node",
|
"node",
|
||||||
"<path to extension>/out/client/debugger/Main.js"
|
"<path to extension>/out/client/debugger/debugAdapter/main.js"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
...
|
...
|
||||||
|
|
|
||||||
|
|
@ -142,6 +142,8 @@ class DebugAdapterConnection( object ):
|
||||||
payload = str( self._buffer[ : content_length ], 'utf-8' )
|
payload = str( self._buffer[ : content_length ], 'utf-8' )
|
||||||
self._buffer = self._buffer[ content_length : ]
|
self._buffer = self._buffer[ content_length : ]
|
||||||
|
|
||||||
|
self._logger.debug( 'Message received (raw): %s', payload )
|
||||||
|
|
||||||
message = json.loads( payload )
|
message = json.loads( payload )
|
||||||
|
|
||||||
self._logger.debug( 'Message received: {0}'.format( message ) )
|
self._logger.debug( 'Message received: {0}'.format( message ) )
|
||||||
|
|
@ -157,7 +159,16 @@ class DebugAdapterConnection( object ):
|
||||||
return
|
return
|
||||||
|
|
||||||
if message[ 'type' ] == 'response':
|
if message[ 'type' ] == 'response':
|
||||||
request = self._outstanding_requests.pop( message[ 'request_seq' ] )
|
try:
|
||||||
|
request = self._outstanding_requests.pop( message[ 'request_seq' ] )
|
||||||
|
except KeyError:
|
||||||
|
# Sigh. It looks like the ms python debug adapter sends duplicate
|
||||||
|
# initialize responses.
|
||||||
|
utils.UserMessage(
|
||||||
|
"Protocol error: duplicate response for request {}".format(
|
||||||
|
message[ 'request_seq' ] ) )
|
||||||
|
self._logger.exception( 'Duplicate response: {}'.format( message ) )
|
||||||
|
return
|
||||||
|
|
||||||
if message[ 'success' ]:
|
if message[ 'success' ]:
|
||||||
if request.handler:
|
if request.handler:
|
||||||
|
|
|
||||||
|
|
@ -516,6 +516,19 @@ class DebugSession( object ):
|
||||||
|
|
||||||
self._connection.DoResponse( message, None, response )
|
self._connection.DoResponse( message, None, response )
|
||||||
|
|
||||||
|
def OnEvent_exited( self, message ):
|
||||||
|
utils.UserMessage( 'The debugee exited with status code: {}'.format(
|
||||||
|
message[ 'body' ][ 'exitCode' ] ) )
|
||||||
|
|
||||||
|
def OnEvent_process( self, message ):
|
||||||
|
utils.UserMessage( 'The debugee was started: {}'.format(
|
||||||
|
message[ 'body' ][ 'name' ] ) )
|
||||||
|
|
||||||
|
def OnEvent_module( self, message ):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def OnEvent_continued( self, message ):
|
||||||
|
pass
|
||||||
|
|
||||||
def Clear( self ):
|
def Clear( self ):
|
||||||
self._codeView.Clear()
|
self._codeView.Clear()
|
||||||
|
|
|
||||||
|
|
@ -88,8 +88,12 @@ class OutputView( object ):
|
||||||
def print_result( message ):
|
def print_result( message ):
|
||||||
utils.AppendToBuffer( console,
|
utils.AppendToBuffer( console,
|
||||||
'Evaluated: ' + expression )
|
'Evaluated: ' + expression )
|
||||||
utils.AppendToBuffer( console,
|
|
||||||
' Result: ' + message[ 'body' ][ 'result' ] )
|
result = message[ 'body' ][ 'result' ]
|
||||||
|
if message[ 'body' ].get( 'result' ) is None:
|
||||||
|
result = 'null'
|
||||||
|
|
||||||
|
utils.AppendToBuffer( console, ' Result: ' + result )
|
||||||
|
|
||||||
self._connection.DoRequest( print_result, {
|
self._connection.DoRequest( print_result, {
|
||||||
'command': 'evaluate',
|
'command': 'evaluate',
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
import vim
|
import vim
|
||||||
|
import os
|
||||||
|
|
||||||
from vimspector import utils
|
from vimspector import utils
|
||||||
|
|
||||||
|
|
@ -196,6 +197,9 @@ class StackTraceView( object ):
|
||||||
else:
|
else:
|
||||||
source = { 'name': '<unknown>' }
|
source = { 'name': '<unknown>' }
|
||||||
|
|
||||||
|
if 'name' not in source:
|
||||||
|
source[ 'name' ] = os.path.basename( source[ 'path' ] )
|
||||||
|
|
||||||
line = utils.AppendToBuffer(
|
line = utils.AppendToBuffer(
|
||||||
self._buf,
|
self._buf,
|
||||||
' {0}: {1}@{2}:{3}'.format( frame[ 'id' ],
|
' {0}: {1}@{2}:{3}'.format( frame[ 'id' ],
|
||||||
|
|
|
||||||
|
|
@ -214,10 +214,7 @@ class VariablesView( object ):
|
||||||
view.draw()
|
view.draw()
|
||||||
return
|
return
|
||||||
|
|
||||||
# Expand. (only if there is anything to expand)
|
if variable.get( 'variablesReference', 0 ) <= 0:
|
||||||
if 'variablesReference' not in variable:
|
|
||||||
return
|
|
||||||
if variable[ 'variablesReference' ] <= 0:
|
|
||||||
return
|
return
|
||||||
|
|
||||||
variable[ '_expanded' ] = True
|
variable[ '_expanded' ] = True
|
||||||
|
|
@ -236,7 +233,7 @@ class VariablesView( object ):
|
||||||
view.win.buffer,
|
view.win.buffer,
|
||||||
'{indent}{icon} {name} ({type_}): {value}'.format(
|
'{indent}{icon} {name} ({type_}): {value}'.format(
|
||||||
indent = ' ' * indent,
|
indent = ' ' * indent,
|
||||||
icon = '+' if ( variable[ 'variablesReference' ] > 0 and
|
icon = '+' if ( variable.get( 'variablesReference', 0 ) > 0 and
|
||||||
'_variables' not in variable ) else '-',
|
'_variables' not in variable ) else '-',
|
||||||
name = variable[ 'name' ],
|
name = variable[ 'name' ],
|
||||||
type_ = variable.get( 'type', '<unknown type>' ),
|
type_ = variable.get( 'type', '<unknown type>' ),
|
||||||
|
|
@ -275,7 +272,7 @@ class VariablesView( object ):
|
||||||
self._DrawWatchResult( 2, watch )
|
self._DrawWatchResult( 2, watch )
|
||||||
|
|
||||||
def _DrawScope( self, indent, scope ):
|
def _DrawScope( self, indent, scope ):
|
||||||
icon = '+' if ( scope[ 'variablesReference' ] > 0 and
|
icon = '+' if ( scope.get( 'variablesReference', 0 ) > 0 and
|
||||||
'_variables' not in scope ) else '-'
|
'_variables' not in scope ) else '-'
|
||||||
|
|
||||||
line = utils.AppendToBuffer( self._vars.win.buffer,
|
line = utils.AppendToBuffer( self._vars.win.buffer,
|
||||||
|
|
@ -294,7 +291,7 @@ class VariablesView( object ):
|
||||||
|
|
||||||
result = watch[ '_result' ]
|
result = watch[ '_result' ]
|
||||||
|
|
||||||
icon = '+' if ( result[ 'variablesReference' ] > 0 and
|
icon = '+' if ( result.get( 'variablesReference', 0 ) > 0 and
|
||||||
'_variables' not in result ) else '-'
|
'_variables' not in result ) else '-'
|
||||||
|
|
||||||
line = '{0}{1} Result: {2} '.format( ' ' * indent,
|
line = '{0}{1} Result: {2} '.format( ' ' * indent,
|
||||||
|
|
@ -347,7 +344,6 @@ class VariablesView( object ):
|
||||||
# TODO: this result count be expandable, but we have no way to allow the
|
# TODO: this result count be expandable, but we have no way to allow the
|
||||||
# user to interact with the balloon to expand it.
|
# user to interact with the balloon to expand it.
|
||||||
body = message[ 'body' ]
|
body = message[ 'body' ]
|
||||||
ref = body.get( 'variablesReference', 0 )
|
|
||||||
display = [
|
display = [
|
||||||
'Type: ' + body.get( 'type', '<unknown>' ),
|
'Type: ' + body.get( 'type', '<unknown>' ),
|
||||||
'Value: ' + body[ 'result' ]
|
'Value: ' + body[ 'result' ]
|
||||||
|
|
|
||||||
2
tox.ini
2
tox.ini
|
|
@ -1,3 +1,3 @@
|
||||||
[flake8]
|
[flake8]
|
||||||
ignore = E111,E114,E121,E125,E126,E127,E128,E129,E131,E133,E201,E202,E203,E211,E221,E222,E241,E251,E261,E303,E402,W503
|
ignore = E111,E114,E121,E125,E126,E127,E128,E129,E131,E133,E201,E202,E203,E211,E221,E222,E241,E251,E261,E303,E402,W503,W504
|
||||||
max-line-length = 80
|
max-line-length = 80
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue