]> granicus.if.org Git - vim/commitdiff
patch 8.2.3657: Vim9: debug text misses one line of return statement v8.2.3657
authorBram Moolenaar <Bram@vim.org>
Tue, 23 Nov 2021 22:16:34 +0000 (22:16 +0000)
committerBram Moolenaar <Bram@vim.org>
Tue, 23 Nov 2021 22:16:34 +0000 (22:16 +0000)
Problem:    Vim9: debug text misses one line of return statement.
Solution:   Add a line when not at a debug instruction. (closes #9137)

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

index 86d0b4ccc1517cab247a61a2a268ccbdca4b62dd..6f01917ed4483da385629a4ea8fc5f4dbb876865 100644 (file)
@@ -373,6 +373,29 @@ def Test_Debugger_breakadd_expr()
   call delete('Xtest.vim')
 enddef
 
+def Test_Debugger_break_at_return()
+  var lines =<< trim END
+      vim9script
+      def g:GetNum(): number
+        return 1
+          + 2
+          + 3
+      enddef
+      breakadd func GetNum
+  END
+  writefile(lines, 'Xtest.vim')
+
+  # Start Vim in a terminal
+  var buf = RunVimInTerminal('-S Xtest.vim', {wait_for_ruler: 0})
+  call TermWait(buf)
+
+  RunDbgCmd(buf, ':call GetNum()',
+     ['line 1: return 1  + 2  + 3'], {match: 'pattern'})
+
+  call StopVimInTerminal(buf)
+  call delete('Xtest.vim')
+enddef
+
 func Test_Backtrace_Through_Source()
   CheckCWD
   let file1 =<< trim END
index e47963041b43f18ca12eab003107a91ca0fa825a..baca0af7e6e91c153287fb3468edcf8d76e88a42 100644 (file)
@@ -757,6 +757,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    3657,
 /**/
     3656,
 /**/
index 8a14a856b155a8f6d09ec3a59e96e5de74602ec3..5593f582ad1c2b1f691a5e36226df98f1b9af7c7 100644 (file)
@@ -1602,7 +1602,7 @@ handle_debug(isn_T *iptr, ectx_T *ectx)
                  || ni->isn_type == ISN_RETURN
                  || ni->isn_type == ISN_RETURN_VOID)
        {
-           end_lnum = ni->isn_lnum;
+           end_lnum = ni->isn_lnum + (ni->isn_type == ISN_DEBUG ? 0 : 1);
            break;
        }