]> granicus.if.org Git - vim/commitdiff
patch 8.2.3027: Vim9: breakpoint in compiled function not always checked v8.2.3027
authorBram Moolenaar <Bram@vim.org>
Sun, 20 Jun 2021 18:09:42 +0000 (20:09 +0200)
committerBram Moolenaar <Bram@vim.org>
Sun, 20 Jun 2021 18:09:42 +0000 (20:09 +0200)
Problem:    Vim9: breakpoint in compiled function not always checked.
Solution:   Check for breakpoint when calling compiled function from compiled
            function.

src/testdir/test_debugger.vim
src/version.c
src/vim9execute.c

index a576a8c929c4bcedb9702656678cb20f75d54b4c..81e86588cce71315eee34000cb020aa8d4a821c1 100644 (file)
@@ -940,7 +940,22 @@ func Test_debug_DefFunction()
       echo "here"
       echo "and"
       echo "there"
+      breakadd func 2 LocalFunc
+      LocalFunc()
     enddef
+
+    def LocalFunc()
+      echo "first"
+      echo "second"
+      breakadd func 1 LegacyFunc
+      LegacyFunc()
+    enddef
+
+    func LegacyFunc()
+      echo "legone"
+      echo "legtwo"
+    endfunc
+
     breakadd func 2 g:SomeFunc
   END
   call writefile(file, 'XtestDebug.vim')
@@ -949,6 +964,13 @@ func Test_debug_DefFunction()
 
   call RunDbgCmd(buf,':call SomeFunc()', ['line 2: echo "and"'])
   call RunDbgCmd(buf,'next', ['line 3: echo "there"'])
+  call RunDbgCmd(buf,'next', ['line 4: breakadd func 2 LocalFunc'])
+
+  " continue, next breakpoint is in LocalFunc()
+  call RunDbgCmd(buf,'cont', ['line 2: echo "second"'])
+
+  " continue, next breakpoint is in LegacyFunc()
+  call RunDbgCmd(buf,'cont', ['line 1: echo "legone"'])
 
   call RunDbgCmd(buf, 'cont')
 
index 6fe8fa4988ec35d3c41a81b87499b6efbcd3a163..58d99e8af1c4b7a927a2eef47311da4b77641581 100644 (file)
@@ -755,6 +755,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    3027,
 /**/
     3026,
 /**/
index 8b817e4505f4d4fdd48d807abc3fe29556b90ba2..dfceb27d000863cd7fe8890644bb47cd69c02b8a 100644 (file)
@@ -229,6 +229,9 @@ call_dfunc(
     }
 #endif
 
+    // Update uf_has_breakpoint if needed.
+    update_has_breakpoint(ufunc);
+
     // When debugging and using "cont" switches to the not-debugged
     // instructions, may need to still compile them.
     if ((func_needs_compiling(ufunc, COMPILE_TYPE(ufunc))