Skip to content

Commit 2ac4b25

Browse files
committed
patch 8.2.3027: Vim9: breakpoint in compiled function not always checked
Problem: Vim9: breakpoint in compiled function not always checked. Solution: Check for breakpoint when calling compiled function from compiled function.
1 parent 4f8f542 commit 2ac4b25

3 files changed

Lines changed: 27 additions & 0 deletions

File tree

src/testdir/test_debugger.vim

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -940,7 +940,22 @@ func Test_debug_DefFunction()
940940
echo "here"
941941
echo "and"
942942
echo "there"
943+
breakadd func 2 LocalFunc
944+
LocalFunc()
943945
enddef
946+
947+
def LocalFunc()
948+
echo "first"
949+
echo "second"
950+
breakadd func 1 LegacyFunc
951+
LegacyFunc()
952+
enddef
953+
954+
func LegacyFunc()
955+
echo "legone"
956+
echo "legtwo"
957+
endfunc
958+
944959
breakadd func 2 g:SomeFunc
945960
END
946961
call writefile(file, 'XtestDebug.vim')
@@ -949,6 +964,13 @@ func Test_debug_DefFunction()
949964

950965
call RunDbgCmd(buf,':call SomeFunc()', ['line 2: echo "and"'])
951966
call RunDbgCmd(buf,'next', ['line 3: echo "there"'])
967+
call RunDbgCmd(buf,'next', ['line 4: breakadd func 2 LocalFunc'])
968+
969+
" continue, next breakpoint is in LocalFunc()
970+
call RunDbgCmd(buf,'cont', ['line 2: echo "second"'])
971+
972+
" continue, next breakpoint is in LegacyFunc()
973+
call RunDbgCmd(buf,'cont', ['line 1: echo "legone"'])
952974

953975
call RunDbgCmd(buf, 'cont')
954976

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -755,6 +755,8 @@ static char *(features[]) =
755755

756756
static int included_patches[] =
757757
{ /* Add new patch number below this line */
758+
/**/
759+
3027,
758760
/**/
759761
3026,
760762
/**/

src/vim9execute.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,9 @@ call_dfunc(
229229
}
230230
#endif
231231

232+
// Update uf_has_breakpoint if needed.
233+
update_has_breakpoint(ufunc);
234+
232235
// When debugging and using "cont" switches to the not-debugged
233236
// instructions, may need to still compile them.
234237
if ((func_needs_compiling(ufunc, COMPILE_TYPE(ufunc))

0 commit comments

Comments
 (0)