vim-patch:8.2.3026: Vim9: cannot set breakpoint in compiled function

Problem:    Vim9: cannot set breakpoint in compiled function.
Solution:   Check for breakpoint when calling a function.

4f8f54280f

Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
zeertzjq 2023-11-13 06:42:09 +08:00
parent 940d9c59a7
commit 0bca5bff53
2 changed files with 27 additions and 1 deletions

View File

@ -550,7 +550,7 @@ static int dbg_parsearg(char *arg, garray_T *gap)
} }
if (bp->dbg_type == DBG_FUNC) { if (bp->dbg_type == DBG_FUNC) {
bp->dbg_name = xstrdup(p); bp->dbg_name = xstrdup(strncmp(p, "g:", 2) == 0 ? p + 2 : p);
} else if (here) { } else if (here) {
bp->dbg_name = xstrdup(curbuf->b_ffname); bp->dbg_name = xstrdup(curbuf->b_ffname);
} else if (bp->dbg_type == DBG_EXPR) { } else if (bp->dbg_type == DBG_EXPR) {

View File

@ -971,6 +971,32 @@ func Test_Backtrace_DefFunction()
call delete('Xtest2.vim') call delete('Xtest2.vim')
endfunc endfunc
func Test_debug_DefFunction()
CheckRunVimInTerminal
CheckCWD
let file =<< trim END
vim9script
def g:SomeFunc()
echo "here"
echo "and"
echo "there"
enddef
breakadd func 2 g:SomeFunc
END
call writefile(file, 'XtestDebug.vim')
let buf = RunVimInTerminal('-S XtestDebug.vim', {})
call RunDbgCmd(buf,':call SomeFunc()', ['line 2: echo "and"'])
call RunDbgCmd(buf,'next', ['line 3: echo "there"'])
call RunDbgCmd(buf, 'cont')
call StopVimInTerminal(buf)
call delete('Xtest1.vim')
call delete('Xtest2.vim')
endfunc
func Test_debug_def_function() func Test_debug_def_function()
CheckRunVimInTerminal CheckRunVimInTerminal
CheckCWD CheckCWD