patch 8.2.3039: Vim9: breakpoint at a comment line does not work
Problem: Vim9: breakpoint at a comment line does not work.
Solution: Add the comment line number to the debug instruction.
(closes #8429)
diff --git a/src/testdir/test_debugger.vim b/src/testdir/test_debugger.vim
index 81e8658..4601319 100644
--- a/src/testdir/test_debugger.vim
+++ b/src/testdir/test_debugger.vim
@@ -947,7 +947,7 @@
def LocalFunc()
echo "first"
echo "second"
- breakadd func 1 LegacyFunc
+ breakadd func LegacyFunc
LegacyFunc()
enddef
@@ -1010,6 +1010,13 @@
eval 1
enddef
enddef
+ def g:FuncComment()
+ # comment
+ echo "first"
+ .. "one"
+ # comment
+ echo "second"
+ enddef
END
call writefile(file, 'Xtest.vim')
@@ -1049,6 +1056,12 @@
\ ['cmd: call FuncWithDict()'])
call RunDbgCmd(buf, 'step', ['line 1: var d = { a: 1, b: 2, }'])
call RunDbgCmd(buf, 'step', ['line 6: def Inner()'])
+ call RunDbgCmd(buf, 'cont')
+
+ call RunDbgCmd(buf, ':breakadd func 1 FuncComment')
+ call RunDbgCmd(buf, ':call FuncComment()', ['function FuncComment', 'line 2: echo "first" .. "one"'])
+ call RunDbgCmd(buf, ':breakadd func 3 FuncComment')
+ call RunDbgCmd(buf, 'cont', ['function FuncComment', 'line 5: echo "second"'])
call RunDbgCmd(buf, 'cont')
call StopVimInTerminal(buf)
diff --git a/src/testdir/test_vim9_disassemble.vim b/src/testdir/test_vim9_disassemble.vim
index 7938d91..1d100e0 100644
--- a/src/testdir/test_vim9_disassemble.vim
+++ b/src/testdir/test_vim9_disassemble.vim
@@ -2176,7 +2176,9 @@
enddef
def s:Profiled(): string
+ # comment
echo "profiled"
+ # comment
var some = "some text"
return "done"
enddef
@@ -2187,18 +2189,20 @@
endif
var res = execute('disass profile s:Profiled')
assert_match('<SNR>\d*_Profiled\_s*' ..
+ '# comment\_s*' ..
'echo "profiled"\_s*' ..
- '\d PROFILE START line 1\_s*' ..
+ '\d PROFILE START line 2\_s*' ..
'\d PUSHS "profiled"\_s*' ..
'\d ECHO 1\_s*' ..
+ '# comment\_s*' ..
'var some = "some text"\_s*' ..
'\d PROFILE END\_s*' ..
- '\d PROFILE START line 2\_s*' ..
+ '\d PROFILE START line 4\_s*' ..
'\d PUSHS "some text"\_s*' ..
'\d STORE $0\_s*' ..
'return "done"\_s*' ..
'\d PROFILE END\_s*' ..
- '\d PROFILE START line 3\_s*' ..
+ '\d PROFILE START line 5\_s*' ..
'\d PUSHS "done"\_s*' ..
'\d\+ RETURN\_s*' ..
'\d\+ PROFILE END',
@@ -2208,16 +2212,18 @@
def Test_debugged()
var res = execute('disass debug s:Profiled')
assert_match('<SNR>\d*_Profiled\_s*' ..
+ '# comment\_s*' ..
'echo "profiled"\_s*' ..
- '\d DEBUG line 1 varcount 0\_s*' ..
+ '\d DEBUG line 1-2 varcount 0\_s*' ..
'\d PUSHS "profiled"\_s*' ..
'\d ECHO 1\_s*' ..
+ '# comment\_s*' ..
'var some = "some text"\_s*' ..
- '\d DEBUG line 2 varcount 0\_s*' ..
+ '\d DEBUG line 3-4 varcount 0\_s*' ..
'\d PUSHS "some text"\_s*' ..
'\d STORE $0\_s*' ..
'return "done"\_s*' ..
- '\d DEBUG line 3 varcount 1\_s*' ..
+ '\d DEBUG line 5-5 varcount 1\_s*' ..
'\d PUSHS "done"\_s*' ..
'\d RETURN\_s*',
res)