summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-11-23 22:16:34 +0000
committerBram Moolenaar <Bram@vim.org>2021-11-23 22:16:34 +0000
commit112bed0cbeac84f73dca2682c5c2d74fabe1114d (patch)
treeeb4d564d98070788bdf351e7fc026224f6d5dbfc
parent65259b5c6a8ad4edaf6eeb8dbb7b50342c64d403 (diff)
downloadvim-git-112bed0cbeac84f73dca2682c5c2d74fabe1114d.tar.gz
patch 8.2.3657: Vim9: debug text misses one line of return statementv8.2.3657
Problem: Vim9: debug text misses one line of return statement. Solution: Add a line when not at a debug instruction. (closes #9137)
-rw-r--r--src/testdir/test_debugger.vim23
-rw-r--r--src/version.c2
-rw-r--r--src/vim9execute.c2
3 files changed, 26 insertions, 1 deletions
diff --git a/src/testdir/test_debugger.vim b/src/testdir/test_debugger.vim
index 86d0b4ccc..6f01917ed 100644
--- a/src/testdir/test_debugger.vim
+++ b/src/testdir/test_debugger.vim
@@ -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
diff --git a/src/version.c b/src/version.c
index e47963041..baca0af7e 100644
--- a/src/version.c
+++ b/src/version.c
@@ -758,6 +758,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 3657,
+/**/
3656,
/**/
3655,
diff --git a/src/vim9execute.c b/src/vim9execute.c
index 8a14a856b..5593f582a 100644
--- a/src/vim9execute.c
+++ b/src/vim9execute.c
@@ -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;
}