While debugging, use the correct path for breakpoints
This commit is contained in:
parent
d1bfe18e18
commit
bd09206caf
8 changed files with 203 additions and 8 deletions
|
|
@ -268,7 +268,10 @@ class ProjectBreakpoints( object ):
|
||||||
|
|
||||||
awaiting = awaiting + 1
|
awaiting = awaiting + 1
|
||||||
self._connection.DoRequest(
|
self._connection.DoRequest(
|
||||||
lambda msg: response_handler( source, msg ),
|
# The source=source here is critical to ensure that we capture each
|
||||||
|
# source in the iteration, rather than ending up passing the same source
|
||||||
|
# to each callback.
|
||||||
|
lambda msg, source=source: response_handler( source, msg ),
|
||||||
{
|
{
|
||||||
'command': 'setBreakpoints',
|
'command': 'setBreakpoints',
|
||||||
'arguments': {
|
'arguments': {
|
||||||
|
|
|
||||||
|
|
@ -119,7 +119,6 @@ class CodeView( object ):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
self._current_frame = frame
|
self._current_frame = frame
|
||||||
self._DisplayPC()
|
|
||||||
|
|
||||||
if not self._window.valid:
|
if not self._window.valid:
|
||||||
return False
|
return False
|
||||||
|
|
@ -148,6 +147,8 @@ class CodeView( object ):
|
||||||
self.current_syntax = utils.ToUnicode(
|
self.current_syntax = utils.ToUnicode(
|
||||||
vim.current.buffer.options[ 'syntax' ] )
|
vim.current.buffer.options[ 'syntax' ] )
|
||||||
|
|
||||||
|
self.ShowBreakpoints()
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def Clear( self ):
|
def Clear( self ):
|
||||||
|
|
|
||||||
21
support/test/python/multiple_files/.vimspector.json
Normal file
21
support/test/python/multiple_files/.vimspector.json
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
{
|
||||||
|
"configurations": {
|
||||||
|
"run": {
|
||||||
|
"adapter": "debugpy",
|
||||||
|
"default": true,
|
||||||
|
"configuration": {
|
||||||
|
"request": "launch",
|
||||||
|
"program": "${workspaceRoot}/moo.py",
|
||||||
|
"cwd": "${workspaceRoot}",
|
||||||
|
"stopOnEntry": true
|
||||||
|
},
|
||||||
|
"breakpoints": {
|
||||||
|
"exception": {
|
||||||
|
"raised": "N",
|
||||||
|
"uncaught": "",
|
||||||
|
"userUnhandled": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
15
support/test/python/multiple_files/cow.py
Normal file
15
support/test/python/multiple_files/cow.py
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
def Say( *args, **kwargs ):
|
||||||
|
print( *args, **kwargs )
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def Quiet():
|
||||||
|
pass
|
||||||
13
support/test/python/multiple_files/moo.py
Normal file
13
support/test/python/multiple_files/moo.py
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
import cow
|
||||||
|
|
||||||
|
|
||||||
|
def Moo():
|
||||||
|
for i in range( 1, 100 ):
|
||||||
|
cow.Say( 'Moo' )
|
||||||
|
|
||||||
|
for i in range( 1, 100 ):
|
||||||
|
cow.Say( 'Ooom' )
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
Moo()
|
||||||
|
|
@ -576,7 +576,7 @@ function! Test_Custom_Breakpoint_Priority()
|
||||||
\ 'vimspectorBPDisabled',
|
\ 'vimspectorBPDisabled',
|
||||||
\ 4 )
|
\ 4 )
|
||||||
call vimspector#ToggleBreakpoint()
|
call vimspector#ToggleBreakpoint()
|
||||||
call vimspector#test#signs#AssertSignGroupEmptyAtLine( 'VimspectorBP', 15 )
|
call vimspector#test#signs#AssertSignGroupEmptyAtLine( 'VimspectorBP', 16 )
|
||||||
|
|
||||||
call setpos( '.', [ 0, 17, 1 ] )
|
call setpos( '.', [ 0, 17, 1 ] )
|
||||||
call vimspector#ToggleBreakpoint( { 'condition': '1' } )
|
call vimspector#ToggleBreakpoint( { 'condition': '1' } )
|
||||||
|
|
@ -663,7 +663,7 @@ function! Test_Custom_Breakpoint_Priority_Partial()
|
||||||
\ 'vimspectorBPDisabled',
|
\ 'vimspectorBPDisabled',
|
||||||
\ 4 )
|
\ 4 )
|
||||||
call vimspector#ToggleBreakpoint()
|
call vimspector#ToggleBreakpoint()
|
||||||
call vimspector#test#signs#AssertSignGroupEmptyAtLine( 'VimspectorBP', 15 )
|
call vimspector#test#signs#AssertSignGroupEmptyAtLine( 'VimspectorBP', 16 )
|
||||||
|
|
||||||
call setpos( '.', [ 0, 17, 1 ] )
|
call setpos( '.', [ 0, 17, 1 ] )
|
||||||
call vimspector#ToggleBreakpoint( { 'condition': '1' } )
|
call vimspector#ToggleBreakpoint( { 'condition': '1' } )
|
||||||
|
|
@ -723,3 +723,72 @@ function! Test_Custom_Breakpoint_Priority_Partial()
|
||||||
%bwipeout!
|
%bwipeout!
|
||||||
unlet! g:vimspector_sign_priority
|
unlet! g:vimspector_sign_priority
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
function! Test_Add_Line_BP_In_Other_File_While_Debugging()
|
||||||
|
let moo = 'moo.py'
|
||||||
|
let cow = 'cow.py'
|
||||||
|
lcd ../support/test/python/multiple_files
|
||||||
|
exe 'edit' moo
|
||||||
|
|
||||||
|
call vimspector#Launch()
|
||||||
|
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( moo, 1, 1 )
|
||||||
|
call vimspector#test#signs#AssertPCIsAtLineInBuffer( moo, 1 )
|
||||||
|
|
||||||
|
call cursor( 6, 3 )
|
||||||
|
call vimspector#ToggleBreakpoint()
|
||||||
|
call vimspector#test#signs#AssertPCIsAtLineInBuffer( moo, 1 )
|
||||||
|
call WaitForAssert( {->
|
||||||
|
\vimspector#test#signs#AssertSignGroupSingletonAtLine(
|
||||||
|
\ 'VimspectorCode',
|
||||||
|
\ 6,
|
||||||
|
\ 'vimspectorBP',
|
||||||
|
\ 9 ) } )
|
||||||
|
|
||||||
|
exe 'edit' cow
|
||||||
|
call cursor( 2, 1 )
|
||||||
|
call vimspector#ToggleBreakpoint()
|
||||||
|
call vimspector#test#signs#AssertSignGroupEmptyAtLine( 'VimspectorCode', 6 )
|
||||||
|
call WaitForAssert( {->
|
||||||
|
\ vimspector#test#signs#AssertSignGroupSingletonAtLine(
|
||||||
|
\ 'VimspectorCode',
|
||||||
|
\ 2,
|
||||||
|
\ 'vimspectorBP',
|
||||||
|
\ 9 ) } )
|
||||||
|
|
||||||
|
call vimspector#Continue()
|
||||||
|
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( moo, 6, 1 )
|
||||||
|
call vimspector#test#signs#AssertPCIsAtLineInBuffer( moo, 6 )
|
||||||
|
|
||||||
|
call vimspector#test#signs#AssertSignGroupEmptyAtLine( 'VimspectorCode', 2 )
|
||||||
|
call vimspector#test#signs#AssertSignAtLine(
|
||||||
|
\ 'VimspectorCode',
|
||||||
|
\ 6,
|
||||||
|
\ 'vimspectorBP',
|
||||||
|
\ 9 )
|
||||||
|
call vimspector#test#signs#AssertSignAtLine(
|
||||||
|
\ 'VimspectorCode',
|
||||||
|
\ 6,
|
||||||
|
\ 'vimspectorPCBP',
|
||||||
|
\ 200 )
|
||||||
|
|
||||||
|
call vimspector#Continue()
|
||||||
|
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( cow, 2, 1 )
|
||||||
|
call vimspector#test#signs#AssertPCIsAtLineInBuffer( cow, 2 )
|
||||||
|
|
||||||
|
call vimspector#test#signs#AssertSignGroupEmptyAtLine( 'VimspectorCode', 6 )
|
||||||
|
call vimspector#test#signs#AssertSignAtLine(
|
||||||
|
\ 'VimspectorCode',
|
||||||
|
\ 2,
|
||||||
|
\ 'vimspectorBP',
|
||||||
|
\ 9 )
|
||||||
|
call vimspector#test#signs#AssertSignAtLine(
|
||||||
|
\ 'VimspectorCode',
|
||||||
|
\ 2,
|
||||||
|
\ 'vimspectorPCBP',
|
||||||
|
\ 200 )
|
||||||
|
|
||||||
|
lcd -
|
||||||
|
call vimspector#test#setup#Reset()
|
||||||
|
%bwipe!
|
||||||
|
endfunction
|
||||||
|
|
|
||||||
|
|
@ -577,7 +577,7 @@ function! Test_Custom_Breakpoint_Priority()
|
||||||
\ 'vimspectorBPDisabled',
|
\ 'vimspectorBPDisabled',
|
||||||
\ 4 )
|
\ 4 )
|
||||||
call vimspector#ToggleBreakpoint()
|
call vimspector#ToggleBreakpoint()
|
||||||
call vimspector#test#signs#AssertSignGroupEmptyAtLine( 'VimspectorBP', 15 )
|
call vimspector#test#signs#AssertSignGroupEmptyAtLine( 'VimspectorBP', 16 )
|
||||||
|
|
||||||
call setpos( '.', [ 0, 17, 1 ] )
|
call setpos( '.', [ 0, 17, 1 ] )
|
||||||
call vimspector#ToggleBreakpoint( { 'condition': '1' } )
|
call vimspector#ToggleBreakpoint( { 'condition': '1' } )
|
||||||
|
|
@ -664,7 +664,7 @@ function! Test_Custom_Breakpoint_Priority_Partial()
|
||||||
\ 'vimspectorBPDisabled',
|
\ 'vimspectorBPDisabled',
|
||||||
\ 4 )
|
\ 4 )
|
||||||
call vimspector#ToggleBreakpoint()
|
call vimspector#ToggleBreakpoint()
|
||||||
call vimspector#test#signs#AssertSignGroupEmptyAtLine( 'VimspectorBP', 15 )
|
call vimspector#test#signs#AssertSignGroupEmptyAtLine( 'VimspectorBP', 16 )
|
||||||
|
|
||||||
call setpos( '.', [ 0, 17, 1 ] )
|
call setpos( '.', [ 0, 17, 1 ] )
|
||||||
call vimspector#ToggleBreakpoint( { 'condition': '1' } )
|
call vimspector#ToggleBreakpoint( { 'condition': '1' } )
|
||||||
|
|
@ -724,3 +724,72 @@ function! Test_Custom_Breakpoint_Priority_Partial()
|
||||||
%bwipeout!
|
%bwipeout!
|
||||||
unlet! g:vimspector_sign_priority
|
unlet! g:vimspector_sign_priority
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
function! Test_Add_Line_BP_In_Other_File_While_Debugging()
|
||||||
|
let moo = 'moo.py'
|
||||||
|
let cow = 'cow.py'
|
||||||
|
lcd ../support/test/python/multiple_files
|
||||||
|
exe 'edit' moo
|
||||||
|
|
||||||
|
call vimspector#Launch()
|
||||||
|
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( moo, 1, 1 )
|
||||||
|
call vimspector#test#signs#AssertPCIsAtLineInBuffer( moo, 1 )
|
||||||
|
|
||||||
|
call cursor( 6, 3 )
|
||||||
|
call vimspector#ToggleBreakpoint()
|
||||||
|
call vimspector#test#signs#AssertPCIsAtLineInBuffer( moo, 1 )
|
||||||
|
call WaitForAssert( {->
|
||||||
|
\vimspector#test#signs#AssertSignGroupSingletonAtLine(
|
||||||
|
\ 'VimspectorCode',
|
||||||
|
\ 6,
|
||||||
|
\ 'vimspectorBP',
|
||||||
|
\ 9 ) } )
|
||||||
|
|
||||||
|
exe 'edit' cow
|
||||||
|
call cursor( 2, 1 )
|
||||||
|
call vimspector#ToggleBreakpoint()
|
||||||
|
call vimspector#test#signs#AssertSignGroupEmptyAtLine( 'VimspectorCode', 6 )
|
||||||
|
call WaitForAssert( {->
|
||||||
|
\ vimspector#test#signs#AssertSignGroupSingletonAtLine(
|
||||||
|
\ 'VimspectorCode',
|
||||||
|
\ 2,
|
||||||
|
\ 'vimspectorBP',
|
||||||
|
\ 9 ) } )
|
||||||
|
|
||||||
|
call vimspector#Continue()
|
||||||
|
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( moo, 6, 1 )
|
||||||
|
call vimspector#test#signs#AssertPCIsAtLineInBuffer( moo, 6 )
|
||||||
|
|
||||||
|
call vimspector#test#signs#AssertSignGroupEmptyAtLine( 'VimspectorCode', 2 )
|
||||||
|
call vimspector#test#signs#AssertSignAtLine(
|
||||||
|
\ 'VimspectorCode',
|
||||||
|
\ 6,
|
||||||
|
\ 'vimspectorBP',
|
||||||
|
\ 9 )
|
||||||
|
call vimspector#test#signs#AssertSignAtLine(
|
||||||
|
\ 'VimspectorCode',
|
||||||
|
\ 6,
|
||||||
|
\ 'vimspectorPCBP',
|
||||||
|
\ 200 )
|
||||||
|
|
||||||
|
call vimspector#Continue()
|
||||||
|
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( cow, 2, 1 )
|
||||||
|
call vimspector#test#signs#AssertPCIsAtLineInBuffer( cow, 2 )
|
||||||
|
|
||||||
|
call vimspector#test#signs#AssertSignGroupEmptyAtLine( 'VimspectorCode', 6 )
|
||||||
|
call vimspector#test#signs#AssertSignAtLine(
|
||||||
|
\ 'VimspectorCode',
|
||||||
|
\ 2,
|
||||||
|
\ 'vimspectorBP',
|
||||||
|
\ 9 )
|
||||||
|
call vimspector#test#signs#AssertSignAtLine(
|
||||||
|
\ 'VimspectorCode',
|
||||||
|
\ 2,
|
||||||
|
\ 'vimspectorPCBP',
|
||||||
|
\ 200 )
|
||||||
|
|
||||||
|
lcd -
|
||||||
|
call vimspector#test#setup#Reset()
|
||||||
|
%bwipe!
|
||||||
|
endfunction
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,11 @@ function! vimspector#test#signs#AssertSignGroupSingletonAtLine( group,
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
function! vimspector#test#signs#AssertSignAtLine( group, line, sign_name, priority ) abort
|
function! vimspector#test#signs#AssertSignAtLine(
|
||||||
|
\ group,
|
||||||
|
\ line,
|
||||||
|
\ sign_name,
|
||||||
|
\ priority ) abort
|
||||||
|
|
||||||
let signs = sign_getplaced( '%', {
|
let signs = sign_getplaced( '%', {
|
||||||
\ 'group': a:group,
|
\ 'group': a:group,
|
||||||
|
|
@ -106,7 +110,7 @@ endfunction
|
||||||
function! vimspector#test#signs#AssertSignGroupEmptyAtLine( group, line ) abort
|
function! vimspector#test#signs#AssertSignGroupEmptyAtLine( group, line ) abort
|
||||||
let signs = sign_getplaced( '%', {
|
let signs = sign_getplaced( '%', {
|
||||||
\ 'group': a:group,
|
\ 'group': a:group,
|
||||||
\ 'lnum': line( '.' )
|
\ 'lnum': a:line,
|
||||||
\ } )
|
\ } )
|
||||||
|
|
||||||
return assert_equal( 1,
|
return assert_equal( 1,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue