Add "run to cursor" support

We add a 'temporary' option to line breakpionts and try and clear any
temporary breakpionts on the line we end up stopping on. This might not
be art, but _probably_ works in almost all cases that matter.

it's a bit hacky the way we have to push the reason around, but we don't
know where we stopped until we actually get the stack trace response and
SetCurrentFrame

Move temporary breakpionts to match server response

Also delete any existing ones when adding a new one and add tests for
run-to-cursor.

Only continue after we successfully set the breakpoints. This makes it
work in go
This commit is contained in:
Ben Jackson 2020-10-13 22:43:52 +01:00
commit 80985148e7
18 changed files with 693 additions and 205 deletions

View file

@ -6,38 +6,6 @@ function! ClearDown()
call vimspector#test#setup#ClearDown()
endfunction
function! SetUp_Test_Mappings_Are_Added_HUMAN()
let g:vimspector_enable_mappings = 'HUMAN'
endfunction
function! Test_Mappings_Are_Added_HUMAN()
call assert_true( hasmapto( 'vimspector#Continue()' ) )
call assert_false( hasmapto( 'vimspector#Launch()' ) )
call assert_true( hasmapto( 'vimspector#Stop()' ) )
call assert_true( hasmapto( 'vimspector#Restart()' ) )
call assert_true( hasmapto( 'vimspector#ToggleBreakpoint()' ) )
call assert_true( hasmapto( 'vimspector#AddFunctionBreakpoint' ) )
call assert_true( hasmapto( 'vimspector#StepOver()' ) )
call assert_true( hasmapto( 'vimspector#StepInto()' ) )
call assert_true( hasmapto( 'vimspector#StepOut()' ) )
endfunction
function! SetUp_Test_Mappings_Are_Added_VISUAL_STUDIO()
let g:vimspector_enable_mappings = 'VISUAL_STUDIO'
endfunction
function! Test_Mappings_Are_Added_VISUAL_STUDIO()
call assert_true( hasmapto( 'vimspector#Continue()' ) )
call assert_false( hasmapto( 'vimspector#Launch()' ) )
call assert_true( hasmapto( 'vimspector#Stop()' ) )
call assert_true( hasmapto( 'vimspector#Restart()' ) )
call assert_true( hasmapto( 'vimspector#ToggleBreakpoint()' ) )
call assert_true( hasmapto( 'vimspector#AddFunctionBreakpoint' ) )
call assert_true( hasmapto( 'vimspector#StepOver()' ) )
call assert_true( hasmapto( 'vimspector#StepInto()' ) )
call assert_true( hasmapto( 'vimspector#StepOut()' ) )
endfunction
function! SetUp_Test_Signs_Placed_Using_API_Are_Shown()
let g:vimspector_enable_mappings = 'VISUAL_STUDIO'
endfunction
@ -78,68 +46,6 @@ function! Test_Signs_Placed_Using_API_Are_Shown()
%bwipeout!
endfunction
function! SetUp_Test_Use_Mappings_HUMAN()
let g:vimspector_enable_mappings = 'HUMAN'
endfunction
function! Test_Use_Mappings_HUMAN()
lcd testdata/cpp/simple
edit simple.cpp
call setpos( '.', [ 0, 15, 1 ] )
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( 'simple.cpp', 15, 1 )
call vimspector#test#signs#AssertSignGroupEmptyAtLine( 'VimspectorBP', 15 )
" Add the breakpoint
call feedkeys( "\<F9>", 'xt' )
call vimspector#test#signs#AssertSignGroupSingletonAtLine( 'VimspectorBP',
\ 15,
\ 'vimspectorBP',
\ 9 )
" Disable the breakpoint
call feedkeys( "\<F9>", 'xt' )
call vimspector#test#signs#AssertSignGroupSingletonAtLine(
\ 'VimspectorBP',
\ 15,
\ 'vimspectorBPDisabled',
\ 9 )
" Delete the breakpoint
call feedkeys( "\<F9>", 'xt' )
call vimspector#test#signs#AssertSignGroupEmptyAtLine( 'VimspectorBP', 15 )
" Add it again
call feedkeys( "\<F9>", 'xt' )
call vimspector#test#signs#AssertSignGroupSingletonAtLine(
\ 'VimspectorBP',
\ 15,
\ 'vimspectorBP',
\ 9 )
" Here we go. Start Debugging
call feedkeys( "\<F5>", 'xt' )
call assert_equal( 2, len( gettabinfo() ) )
let cur_tabnr = tabpagenr()
call assert_equal( 5, len( gettabinfo( cur_tabnr )[ 0 ].windows ) )
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( 'simple.cpp', 15, 1 )
" Step
call feedkeys( "\<F10>", 'xt' )
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( 'simple.cpp', 16, 1 )
call WaitForAssert( {->
\ vimspector#test#signs#AssertPCIsAtLineInBuffer( 'simple.cp', 16 )
\ } )
call vimspector#test#setup#Reset()
lcd -
%bwipeout!
endfunction
function! SetUp_Test_StopAtEntry()
let g:vimspector_enable_mappings = 'HUMAN'
endfunction
@ -200,8 +106,8 @@ function Test_DisableBreakpointWhileDebugging()
\ 16 )
\ } )
" Add the breakpoint
call feedkeys( "\<F9>", 'xt' )
call setpos( '.', [ 0, 1, 1 ] )
call vimspector#SetLineBreakpoint( 'simple.cpp', 16 )
call WaitForAssert( {->
\ vimspector#test#signs#AssertSignGroupSingletonAtLine(
\ 'VimspectorCode',
@ -211,7 +117,6 @@ function Test_DisableBreakpointWhileDebugging()
\ } )
" Run to breakpoint
call setpos( '.', [ 0, 15, 1 ] )
call feedkeys( "\<F5>", 'xt' )
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( 'simple.cpp', 16, 1 )
call WaitForAssert( {->
@ -258,6 +163,58 @@ function Test_DisableBreakpointWhileDebugging()
%bwipeout!
endfunction
function! Test_Add_Breakpoints_In_File_Then_Open()
lcd testdata/cpp/simple
" Set and clear without file open
call vimspector#SetLineBreakpoint( 'simple.cpp', 16 )
call vimspector#ClearLineBreakpoint( 'simple.cpp', 16 )
" Clear non-set breakpoint
call vimspector#ClearLineBreakpoint( 'simple.cpp', 1 )
" Re-add
call vimspector#SetLineBreakpoint( 'simple.cpp', 16 )
" Open and expect sign to be added
edit simple.cpp
call vimspector#test#signs#AssertSignGroupSingletonAtLine( 'VimspectorBP',
\ 16,
\ 'vimspectorBP',
\ 9 )
call vimspector#LaunchWithSettings( { 'configuration': 'run-to-breakpoint' } )
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( 'simple.cpp', 16, 1 )
call vimspector#test#setup#Reset()
lcd -
%bwipeout!
endfunction
function! Test_Add_Breakpoints_In_NonOpenedFile_RunToBreak()
lcd testdata/cpp/simple
" add
call vimspector#SetLineBreakpoint( 'simple.cpp', 16 )
call vimspector#LaunchWithSettings( {
\ 'configuration': 'run-to-breakpoint-specify-file',
\ 'prog': 'simple'
\ } )
call WaitFor( {-> bufexists( 'simple.cpp' ) } )
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( 'simple.cpp', 16, 1 )
call vimspector#test#signs#AssertPCIsAtLineInBuffer( 'simple.cpp', 16 )
call vimspector#test#signs#AssertSignAtLine(
\ 'VimspectorCode',
\ 16,
\ 'vimspectorPCBP',
\ 200 )
call vimspector#test#setup#Reset()
lcd -
%bwipeout!
endfunction
function! SetUp_Test_Insert_Code_Above_Breakpoint()
let g:vimspector_enable_mappings = 'HUMAN'
endfunction
@ -308,7 +265,6 @@ function! Test_Insert_Code_Above_Breakpoint()
" Delete it
call feedkeys( "\<F9>", 'xt' )
call vimspector#test#signs#AssertSignGroupEmptyAtLine( 'VimspectorBP', 26 )
endfunction
function! SetUp_Test_Conditional_Line_Breakpoint()
@ -360,8 +316,11 @@ function! Test_Conditional_Line_Breakpoint()
\ 'vimspectorBP',
\ 9 )
call setpos( '.', [ 0, 17, 1 ] )
call vimspector#ToggleBreakpoint( { 'condition': 'argc == 1' } )
call setpos( '.', [ 0, 1, 1 ] )
call vimspector#SetLineBreakpoint(
\ 'simple.cpp',
\ 17,
\ { 'condition': 'argc == 1' } )
call vimspector#test#signs#AssertSignGroupSingletonAtLine(
\ 'VimspectorBP',
\ 17,
@ -724,7 +683,6 @@ function! Test_Custom_Breakpoint_Priority_Partial()
unlet! g:vimspector_sign_priority
endfunction
function! Test_Add_Line_BP_In_Other_File_While_Debugging()
let moo = 'moo.py'
let cow = 'cow.py'

View file

@ -7,38 +7,6 @@ function! ClearDown()
call vimspector#test#setup#ClearDown()
endfunction
function! SetUp_Test_Mappings_Are_Added_HUMAN()
let g:vimspector_enable_mappings = 'HUMAN'
endfunction
function! Test_Mappings_Are_Added_HUMAN()
call assert_true( hasmapto( 'vimspector#Continue()' ) )
call assert_false( hasmapto( 'vimspector#Launch()' ) )
call assert_true( hasmapto( 'vimspector#Stop()' ) )
call assert_true( hasmapto( 'vimspector#Restart()' ) )
call assert_true( hasmapto( 'vimspector#ToggleBreakpoint()' ) )
call assert_true( hasmapto( 'vimspector#AddFunctionBreakpoint' ) )
call assert_true( hasmapto( 'vimspector#StepOver()' ) )
call assert_true( hasmapto( 'vimspector#StepInto()' ) )
call assert_true( hasmapto( 'vimspector#StepOut()' ) )
endfunction
function! SetUp_Test_Mappings_Are_Added_VISUAL_STUDIO()
let g:vimspector_enable_mappings = 'VISUAL_STUDIO'
endfunction
function! Test_Mappings_Are_Added_VISUAL_STUDIO()
call assert_true( hasmapto( 'vimspector#Continue()' ) )
call assert_false( hasmapto( 'vimspector#Launch()' ) )
call assert_true( hasmapto( 'vimspector#Stop()' ) )
call assert_true( hasmapto( 'vimspector#Restart()' ) )
call assert_true( hasmapto( 'vimspector#ToggleBreakpoint()' ) )
call assert_true( hasmapto( 'vimspector#AddFunctionBreakpoint' ) )
call assert_true( hasmapto( 'vimspector#StepOver()' ) )
call assert_true( hasmapto( 'vimspector#StepInto()' ) )
call assert_true( hasmapto( 'vimspector#StepOut()' ) )
endfunction
function! SetUp_Test_Signs_Placed_Using_API_Are_Shown()
let g:vimspector_enable_mappings = 'VISUAL_STUDIO'
endfunction
@ -132,7 +100,7 @@ function! Test_Use_Mappings_HUMAN()
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( 'simple.cpp', 16, 1 )
call WaitForAssert( {->
\ vimspector#test#signs#AssertPCIsAtLineInBuffer( 'simple.cp', 16 )
\ vimspector#test#signs#AssertPCIsAtLineInBuffer( 'simple.cpp', 16 )
\ } )
call vimspector#test#setup#Reset()

View file

@ -45,3 +45,28 @@ function! Test_Go_Simple()
lcd -
%bwipeout!
endfunction
function! Test_Run_To_Cursor()
let fn='hello-world.go'
lcd ../support/test/go/hello_world
exe 'edit ' . fn
call vimspector#SetLineBreakpoint( fn, 4 )
call vimspector#Launch()
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( fn, 4, 1 )
call WaitForAssert( {->
\ vimspector#test#signs#AssertPCIsAtLineInBuffer( fn, 4 )
\ } )
call cursor( 5, 1 )
call vimspector#RunToCursor()
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( fn, 5, 1 )
call WaitForAssert( {->
\ vimspector#test#signs#AssertPCIsAtLineInBuffer( fn, 5 )
\ } )
call vimspector#test#setup#Reset()
lcd -
%bwipeout!
endfunction

View file

@ -1,6 +1,7 @@
function! vimspector#test#signs#AssertCursorIsAtLineInBuffer( buffer,
\ line,
\ column ) abort
call WaitFor( {-> bufexists( a:buffer ) } )
call WaitForAssert( {->
\ assert_equal( fnamemodify( a:buffer, ':p' ),
\ fnamemodify( bufname( '%' ), ':p' ),
@ -15,6 +16,7 @@ function! vimspector#test#signs#AssertCursorIsAtLineInBuffer( buffer,
endfunction
function! vimspector#test#signs#AssertPCIsAtLineInBuffer( buffer, line ) abort
call WaitFor( {-> bufexists( a:buffer ) } )
let signs = sign_getplaced( a:buffer, {
\ 'group': 'VimspectorCode',
\ } )

123
tests/mappings.test.vim Normal file
View file

@ -0,0 +1,123 @@
function! SetUp()
call vimspector#test#setup#SetUpWithMappings( v:none )
endfunction
function! ClearDown()
call vimspector#test#setup#ClearDown()
endfunction
function! SetUp_Test_Mappings_Are_Added_HUMAN()
let g:vimspector_enable_mappings = 'HUMAN'
endfunction
function! Test_Mappings_Are_Added_HUMAN()
call assert_true( hasmapto( 'vimspector#Continue()' ) )
call assert_false( hasmapto( 'vimspector#Launch()' ) )
call assert_true( hasmapto( 'vimspector#Stop()' ) )
call assert_true( hasmapto( 'vimspector#Restart()' ) )
call assert_true( hasmapto( 'vimspector#ToggleBreakpoint()' ) )
call assert_true( hasmapto( 'vimspector#AddFunctionBreakpoint' ) )
call assert_true( hasmapto( 'vimspector#StepOver()' ) )
call assert_true( hasmapto( 'vimspector#StepInto()' ) )
call assert_true( hasmapto( 'vimspector#StepOut()' ) )
call assert_true( hasmapto( 'vimspector#RunToCursor()' ) )
endfunction
function! SetUp_Test_Mappings_Are_Added_VISUAL_STUDIO()
let g:vimspector_enable_mappings = 'VISUAL_STUDIO'
endfunction
function! Test_Mappings_Are_Added_VISUAL_STUDIO()
call assert_true( hasmapto( 'vimspector#Continue()' ) )
call assert_false( hasmapto( 'vimspector#Launch()' ) )
call assert_true( hasmapto( 'vimspector#Stop()' ) )
call assert_true( hasmapto( 'vimspector#Restart()' ) )
call assert_true( hasmapto( 'vimspector#ToggleBreakpoint()' ) )
call assert_true( hasmapto( 'vimspector#AddFunctionBreakpoint' ) )
call assert_true( hasmapto( 'vimspector#StepOver()' ) )
call assert_true( hasmapto( 'vimspector#StepInto()' ) )
call assert_true( hasmapto( 'vimspector#StepOut()' ) )
endfunction
function! SetUp_Test_Use_Mappings_HUMAN()
let g:vimspector_enable_mappings = 'HUMAN'
endfunction
function! Test_Use_Mappings_HUMAN()
call ThisTestIsFlaky()
lcd testdata/cpp/simple
edit simple.cpp
call setpos( '.', [ 0, 15, 1 ] )
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( 'simple.cpp', 15, 1 )
call vimspector#test#signs#AssertSignGroupEmptyAtLine( 'VimspectorBP', 15 )
" Add the breakpoint
call feedkeys( "\<F9>", 'xt' )
call vimspector#test#signs#AssertSignGroupSingletonAtLine( 'VimspectorBP',
\ 15,
\ 'vimspectorBP',
\ 9 )
" Disable the breakpoint
call feedkeys( "\<F9>", 'xt' )
call vimspector#test#signs#AssertSignGroupSingletonAtLine(
\ 'VimspectorBP',
\ 15,
\ 'vimspectorBPDisabled',
\ 9 )
" Delete the breakpoint
call feedkeys( "\<F9>", 'xt' )
call vimspector#test#signs#AssertSignGroupEmptyAtLine( 'VimspectorBP', 15 )
" Add and clear using API
call vimspector#SetLineBreakpoint( 'simple.cpp', 15 )
call vimspector#test#signs#AssertSignGroupSingletonAtLine( 'VimspectorBP',
\ 15,
\ 'vimspectorBP',
\ 9 )
call vimspector#ClearLineBreakpoint( 'simple.cpp', 15 )
call vimspector#test#signs#AssertSignGroupEmptyAtLine( 'VimspectorBP', 15 )
" Add it again
call feedkeys( "\<F9>", 'xt' )
call vimspector#test#signs#AssertSignGroupSingletonAtLine(
\ 'VimspectorBP',
\ 15,
\ 'vimspectorBP',
\ 9 )
" Here we go. Start Debugging
call feedkeys( "\<F5>", 'xt' )
call assert_equal( 2, len( gettabinfo() ) )
let cur_tabnr = tabpagenr()
call assert_equal( 5, len( gettabinfo( cur_tabnr )[ 0 ].windows ) )
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( 'simple.cpp', 15, 1 )
" Step
call feedkeys( "\<F10>", 'xt' )
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( 'simple.cpp', 16, 1 )
call WaitForAssert( {->
\ vimspector#test#signs#AssertPCIsAtLineInBuffer( 'simple.cpp', 16 )
\ } )
" Run to cursor
call cursor( 9, 1 )
call feedkeys( "\\\<F8>", 'xt' )
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( 'simple.cpp', 9, 1 )
call WaitForAssert( {->
\ vimspector#test#signs#AssertPCIsAtLineInBuffer( 'simple.cpp', 9 )
\ } )
call vimspector#test#setup#Reset()
lcd -
%bwipeout!
endfunction

View file

@ -0,0 +1,200 @@
function! SetUp()
call vimspector#test#setup#SetUpWithMappings( v:none )
endfunction
function! ClearDown()
call vimspector#test#setup#ClearDown()
endfunction
function s:Start()
call vimspector#SetLineBreakpoint( 'moo.py', 13 )
call vimspector#Launch()
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( 'moo.py', 1, 1 )
call vimspector#test#signs#AssertPCIsAtLineInBuffer( 'moo.py', 1 )
call vimspector#Continue()
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( 'moo.py', 13, 1 )
call vimspector#test#signs#AssertPCIsAtLineInBuffer( 'moo.py', 13 )
endfunction
function Test_Run_To_Cursor_Simple()
" Run to a position that will certainly be executed
lcd ../support/test/python/multiple_files
call vimspector#SetLineBreakpoint( 'moo.py', 13 )
call s:Start()
call cursor( 8, 27 )
call vimspector#RunToCursor()
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( 'moo.py', 8, 27 )
call WaitForAssert( {->
\ vimspector#test#signs#AssertPCIsAtLineInBuffer( 'moo.py', 8 )
\ } )
call vimspector#StepOver()
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( 'moo.py', 9, 1 )
call vimspector#test#signs#AssertPCIsAtLineInBuffer( 'moo.py', 9 )
" Check there is no breakpoint set on line 8
call WaitForAssert( {->
\ vimspector#test#signs#AssertSignGroupEmptyAtLine( 'VimspectorCode', 8 )
\ } )
call vimspector#test#setup#Reset()
lcd -
%bwipe!
endfunction
function Test_Run_To_Cursor_On_NonBreaking_Line()
" Run to a position that will certainly be executed, but is not a real line
lcd ../support/test/python/multiple_files
call vimspector#SetLineBreakpoint( 'moo.py', 13 )
call s:Start()
call cursor( 7, 1 )
" Interestingly, debugpy moves the breakpoint to the previous line, which is
" kinda annoying
call vimspector#RunToCursor()
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( 'moo.py', 6, 1 )
call WaitForAssert( {->
\ vimspector#test#signs#AssertPCIsAtLineInBuffer( 'moo.py', 6 )
\ } )
call vimspector#StepOver()
" It's a loop, so we go up a line
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( 'moo.py', 5, 1 )
call vimspector#test#signs#AssertPCIsAtLineInBuffer( 'moo.py', 5 )
" Check there is no breakpoint set on lines 7 and 6:
" 7 - where we put the 'temporary' breakpoint
" 6 - where it got placed
"
" FIXME: This is broken, we don't _know_ that the breakpoint that was hit was
" the temporary one, and there's no way to know.
"
" I wonder if the relocated breakpoint can be matched with the _original_
" breakpoint
call WaitForAssert( {->
\ vimspector#test#signs#AssertSignGroupEmptyAtLine( 'VimspectorCode', 7 )
\ } )
call WaitForAssert( {->
\ vimspector#test#signs#AssertSignGroupEmptyAtLine( 'VimspectorCode', 6 )
\ } )
call vimspector#test#setup#Reset()
lcd -
%bwipe!
endfunction
function Test_Run_To_Cursor_Different_File()
" Run into a different file
" Run to a position that will certainly be executed, but is not a real line
lcd ../support/test/python/multiple_files
call vimspector#SetLineBreakpoint( 'moo.py', 13 )
call s:Start()
edit cow.py
call cursor( 2, 1 )
call vimspector#RunToCursor()
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( 'cow.py', 2, 1 )
call WaitForAssert( {->
\ vimspector#test#signs#AssertPCIsAtLineInBuffer( 'cow.py', 2 )
\ } )
bu moo.py
call cursor( 9, 12 )
call vimspector#RunToCursor()
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( 'moo.py', 9, 12 )
call WaitForAssert( {->
\ vimspector#test#signs#AssertPCIsAtLineInBuffer( 'moo.py', 9 )
\ } )
call vimspector#test#setup#Reset()
lcd -
%bwipe!
endfunction
function Test_Run_To_Cursor_Hit_Another_Breakpoint()
" Run to cursor, but hit a non-temporary breakpoint
lcd ../support/test/python/multiple_files
call vimspector#SetLineBreakpoint( 'moo.py', 13 )
call s:Start()
call vimspector#SetLineBreakpoint( 'moo.py', 5 )
call cursor( 6, 1 )
call vimspector#RunToCursor()
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( 'moo.py', 5, 1 )
call WaitForAssert( {->
\ vimspector#test#signs#AssertPCIsAtLineInBuffer( 'moo.py', 5 )
\ } )
" The temporary breakpoint is still there
call vimspector#test#signs#AssertSignGroupSingletonAtLine(
\ 'VimspectorCode',
\ 6,
\ 'vimspectorBP',
\ 9 )
call vimspector#ClearLineBreakpoint( 'moo.py', 5 )
call cursor( 8, 1 )
call vimspector#RunToCursor()
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( 'moo.py', 8, 1 )
call WaitForAssert( {->
\ vimspector#test#signs#AssertPCIsAtLineInBuffer( 'moo.py', 8 )
\ } )
call WaitForAssert( {->
\ vimspector#test#signs#AssertSignGroupEmptyAtLine( 'VimspectorCode', 6 )
\ } )
call vimspector#test#setup#Reset()
lcd -
%bwipe!
endfunction
function! Test_InvalidBreakpoint()
" Run to cursor, but hit a non-temporary breakpoint
lcd ../support/test/python/multiple_files
call vimspector#SetLineBreakpoint( 'moo.py', 13 )
call s:Start()
call vimspector#SetLineBreakpoint( 'moo.py', 9 )
edit .vimspector.json
call cursor( 1, 1 )
call vimspector#RunToCursor()
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( 'moo.py', 9, 1 )
call WaitForAssert( {->
\ vimspector#test#signs#AssertPCIsAtLineInBuffer( 'moo.py', 9 )
\ } )
call vimspector#test#setup#Reset()
lcd -
%bwipe!
endfunction
function! Test_StartDebuggingWithRunToCursor()
lcd ../support/test/python/multiple_files
edit moo.py
call cursor( 9, 1 )
call vimspector#RunToCursor()
" Stop on entry is still hit
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( 'moo.py', 1, 1 )
call vimspector#test#signs#AssertPCIsAtLineInBuffer( 'moo.py', 1 )
call vimspector#test#signs#AssertSignGroupSingletonAtLine(
\ 'VimspectorCode',
\ 9,
\ 'vimspectorBP',
\ 9 )
call vimspector#Continue()
" Runs to cursor
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( 'moo.py', 9, 1 )
call vimspector#test#signs#AssertPCIsAtLineInBuffer( 'moo.py', 9 )
call vimspector#StepOver()
" And claers the temp breakpoint
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( 'moo.py', 8, 1 )
call vimspector#test#signs#AssertPCIsAtLineInBuffer( 'moo.py', 8 )
call WaitForAssert( {->
\ vimspector#test#signs#AssertSignGroupEmptyAtLine( 'VimspectorCode', 9 )
\ } )
lcd -
endfunction

View file

@ -46,6 +46,28 @@
}
}
},
"run-to-breakpoint-specify-file": {
"adapter": "vscode-cpptools",
"configuration": {
"request": "launch",
"program": "${workspaceRoot}/${prog}",
"cwd": "${workspaceRoot}",
"externalConsole": false,
"stopAtEntry": false,
"stopOnEntry": false,
"MImode": "${VIMSPECTOR_MIMODE}"
},
"breakpoints": {
"exception": {
"cpp_catch": "",
"cpp_throw": "",
"objc_catch": "",
"objc_throw": "",
"swift_catch": "",
"swift_throw": ""
}
}
},
"calculate-some-variable": {
"adapter": "vscode-cpptools",
"variables": {