aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nvim/debugger.c2
-rw-r--r--test/old/testdir/test_debugger.vim26
2 files changed, 27 insertions, 1 deletions
diff --git a/src/nvim/debugger.c b/src/nvim/debugger.c
index 9bd2238c25..2ed8beaafb 100644
--- a/src/nvim/debugger.c
+++ b/src/nvim/debugger.c
@@ -550,7 +550,7 @@ static int dbg_parsearg(char *arg, garray_T *gap)
}
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) {
bp->dbg_name = xstrdup(curbuf->b_ffname);
} else if (bp->dbg_type == DBG_EXPR) {
diff --git a/test/old/testdir/test_debugger.vim b/test/old/testdir/test_debugger.vim
index bda40e0459..f98b718c32 100644
--- a/test/old/testdir/test_debugger.vim
+++ b/test/old/testdir/test_debugger.vim
@@ -971,6 +971,32 @@ func Test_Backtrace_DefFunction()
call delete('Xtest2.vim')
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()
CheckRunVimInTerminal
CheckCWD