To: vim_dev@googlegroups.com Subject: Patch 8.1.1191 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.1191 Problem: Not all debug commands are covered by a test. Solution: Add more tests. (Yegappan Lakshmanan, closes #4282) Files: src/testdir/test_debugger.vim *** ../vim-8.1.1190/src/testdir/test_debugger.vim 2019-04-17 16:53:44.925357857 +0200 --- src/testdir/test_debugger.vim 2019-04-20 22:24:23.270833430 +0200 *************** *** 38,47 **** \ ' return var2', \ 'endfunc', \ 'func Bazz(var)', ! \ ' let var1 = 3 + a:var', ! \ ' let var3 = "another var"', ! \ ' let var3 = "value2"', ! \ ' let var3 = "value3"', \ ' return var1', \ 'endfunc'], 'Xtest.vim') --- 38,50 ---- \ ' return var2', \ 'endfunc', \ 'func Bazz(var)', ! \ ' try', ! \ ' let var1 = 3 + a:var', ! \ ' let var3 = "another var"', ! \ ' let var3 = "value2"', ! \ ' catch', ! \ ' let var4 = "exception"', ! \ ' endtry', \ ' return var1', \ 'endfunc'], 'Xtest.vim') *************** *** 58,70 **** call RunDbgCmd(buf, 'step') call RunDbgCmd(buf, 'step') call RunDbgCmd(buf, 'step') " check backtrace call RunDbgCmd(buf, 'backtrace', [ \ ' 2 function Foo[2]', \ ' 1 Bar[2]', \ '->0 Bazz', ! \ 'line 2: let var3 = "another var"']) " Check variables in different stack frames call RunDbgCmd(buf, 'echo var1', ['6']) --- 61,74 ---- call RunDbgCmd(buf, 'step') call RunDbgCmd(buf, 'step') call RunDbgCmd(buf, 'step') + call RunDbgCmd(buf, 'step') " check backtrace call RunDbgCmd(buf, 'backtrace', [ \ ' 2 function Foo[2]', \ ' 1 Bar[2]', \ '->0 Bazz', ! \ 'line 3: let var3 = "another var"']) " Check variables in different stack frames call RunDbgCmd(buf, 'echo var1', ['6']) *************** *** 74,80 **** \ ' 2 function Foo[2]', \ '->1 Bar[2]', \ ' 0 Bazz', ! \ 'line 2: let var3 = "another var"']) call RunDbgCmd(buf, 'echo var1', ['3']) call RunDbgCmd(buf, 'u') --- 78,84 ---- \ ' 2 function Foo[2]', \ '->1 Bar[2]', \ ' 0 Bazz', ! \ 'line 3: let var3 = "another var"']) call RunDbgCmd(buf, 'echo var1', ['3']) call RunDbgCmd(buf, 'u') *************** *** 82,88 **** \ '->2 function Foo[2]', \ ' 1 Bar[2]', \ ' 0 Bazz', ! \ 'line 2: let var3 = "another var"']) call RunDbgCmd(buf, 'echo var1', ['1']) " Undefined variables --- 86,92 ---- \ '->2 function Foo[2]', \ ' 1 Bar[2]', \ ' 0 Bazz', ! \ 'line 3: let var3 = "another var"']) call RunDbgCmd(buf, 'echo var1', ['1']) " Undefined variables *************** *** 90,96 **** call RunDbgCmd(buf, 'frame 2') call RunDbgCmd(buf, 'echo var3', [ \ 'Error detected while processing function Foo[2]..Bar[2]..Bazz:', ! \ 'line 3:', \ 'E121: Undefined variable: var3']) " var3 is defined in this level with some other value --- 94,100 ---- call RunDbgCmd(buf, 'frame 2') call RunDbgCmd(buf, 'echo var3', [ \ 'Error detected while processing function Foo[2]..Bar[2]..Bazz:', ! \ 'line 4:', \ 'E121: Undefined variable: var3']) " var3 is defined in this level with some other value *************** *** 98,106 **** call RunDbgCmd(buf, 'echo var3', ['another var']) call RunDbgCmd(buf, 'step') ! call RunDbgCmd(buf, 'step') ! call RunDbgCmd(buf, 'step') ! call RunDbgCmd(buf, 'step') call RunDbgCmd(buf, 'step', [ \ 'function Foo[2]..Bar', \ 'line 3: End of function']) --- 102,111 ---- call RunDbgCmd(buf, 'echo var3', ['another var']) call RunDbgCmd(buf, 'step') ! call RunDbgCmd(buf, '') ! call RunDbgCmd(buf, '') ! call RunDbgCmd(buf, '') ! call RunDbgCmd(buf, '') call RunDbgCmd(buf, 'step', [ \ 'function Foo[2]..Bar', \ 'line 3: End of function']) *************** *** 189,195 **** call RunDbgCmd(buf, 'cont', [ \ 'Breakpoint in "Bazz" line 3', \ 'function Foo[2]..Bar[2]..Bazz', ! \ 'line 3: let var3 = "value2"']) " Delete the breakpoints call RunDbgCmd(buf, 'breakd 1') --- 194,200 ---- call RunDbgCmd(buf, 'cont', [ \ 'Breakpoint in "Bazz" line 3', \ 'function Foo[2]..Bar[2]..Bazz', ! \ 'line 3: let var3 = "another var"']) " Delete the breakpoints call RunDbgCmd(buf, 'breakd 1') *************** *** 207,229 **** " Expression breakpoint call RunDbgCmd(buf, ':breakadd func 2 Bazz') ! call RunDbgCmd(buf, ':echo Bazz(1)') call RunDbgCmd(buf, 'step') call RunDbgCmd(buf, 'breaka expr var3') ! call RunDbgCmd(buf, 'breakl', [' 4 expr var3']) ! call RunDbgCmd(buf, 'cont', ['Breakpoint in "Bazz" line 4', \ 'Oldval = "''another var''"', \ 'Newval = "''value2''"', \ 'function Bazz', ! \ 'line 4: let var3 = "value3"']) call RunDbgCmd(buf, 'breakdel *') call RunDbgCmd(buf, 'breakl', ['No breakpoints defined']) " finish the current function call RunDbgCmd(buf, 'finish', [ \ 'function Bazz', ! \ 'line 5: End of function']) call RunDbgCmd(buf, 'cont') call StopVimInTerminal(buf) --- 212,311 ---- " Expression breakpoint call RunDbgCmd(buf, ':breakadd func 2 Bazz') ! call RunDbgCmd(buf, ':echo Bazz(1)', [ ! \ 'Entering Debug mode. Type "cont" to continue.', ! \ 'function Bazz', ! \ 'line 2: let var1 = 3 + a:var']) ! call RunDbgCmd(buf, 'step') call RunDbgCmd(buf, 'step') call RunDbgCmd(buf, 'breaka expr var3') ! call RunDbgCmd(buf, 'breakl', [' 3 func Bazz line 2', ! \ ' 4 expr var3']) ! call RunDbgCmd(buf, 'cont', ['Breakpoint in "Bazz" line 5', \ 'Oldval = "''another var''"', \ 'Newval = "''value2''"', \ 'function Bazz', ! \ 'line 5: catch']) call RunDbgCmd(buf, 'breakdel *') call RunDbgCmd(buf, 'breakl', ['No breakpoints defined']) + " Check for error cases + call RunDbgCmd(buf, 'breakadd abcd', [ + \ 'Error detected while processing function Bazz:', + \ 'line 5:', + \ 'E475: Invalid argument: abcd']) + call RunDbgCmd(buf, 'breakadd func', ['E475: Invalid argument: func']) + call RunDbgCmd(buf, 'breakadd func 2', ['E475: Invalid argument: func 2']) + call RunDbgCmd(buf, 'breaka func a()', ['E475: Invalid argument: func a()']) + call RunDbgCmd(buf, 'breakd abcd', ['E475: Invalid argument: abcd']) + call RunDbgCmd(buf, 'breakd func', ['E475: Invalid argument: func']) + call RunDbgCmd(buf, 'breakd func a()', ['E475: Invalid argument: func a()']) + call RunDbgCmd(buf, 'breakd func a', ['E161: Breakpoint not found: func a']) + call RunDbgCmd(buf, 'breakd expr', ['E475: Invalid argument: expr']) + call RunDbgCmd(buf, 'breakd expr x', [ + \ 'E121: Undefined variable: x', + \ 'E161: Breakpoint not found: expr x']) + " finish the current function call RunDbgCmd(buf, 'finish', [ \ 'function Bazz', ! \ 'line 8: End of function']) ! call RunDbgCmd(buf, 'cont') ! ! " Test for :next ! call RunDbgCmd(buf, ':debug echo Bar(1)') ! call RunDbgCmd(buf, 'step') ! call RunDbgCmd(buf, 'next') ! call RunDbgCmd(buf, '', [ ! \ 'function Bar', ! \ 'line 3: return var2']) ! call RunDbgCmd(buf, 'c') ! ! " Test for :interrupt ! call RunDbgCmd(buf, ':debug echo Bazz(1)') ! call RunDbgCmd(buf, 'step') ! call RunDbgCmd(buf, 'step') ! call RunDbgCmd(buf, 'interrupt', [ ! \ 'Exception thrown: Vim:Interrupt', ! \ 'function Bazz', ! \ 'line 5: catch']) ! call RunDbgCmd(buf, 'c') ! ! " Test for :quit ! call RunDbgCmd(buf, ':debug echo Foo()') ! call RunDbgCmd(buf, 'breakdel *') ! call RunDbgCmd(buf, 'breakadd func 3 Foo') ! call RunDbgCmd(buf, 'breakadd func 3 Bazz') ! call RunDbgCmd(buf, 'cont', [ ! \ 'Breakpoint in "Bazz" line 3', ! \ 'function Foo[2]..Bar[2]..Bazz', ! \ 'line 3: let var3 = "another var"']) ! call RunDbgCmd(buf, 'quit', [ ! \ 'Breakpoint in "Foo" line 3', ! \ 'function Foo', ! \ 'line 3: return var2']) ! call RunDbgCmd(buf, 'breakdel *') ! call RunDbgCmd(buf, 'quit') ! call RunDbgCmd(buf, 'enew! | only!') ! ! call StopVimInTerminal(buf) ! ! " Tests for :breakadd file and :breakadd here ! " Breakpoints should be set before sourcing the file ! ! call writefile([ ! \ 'let var1 = 10', ! \ 'let var2 = 20', ! \ 'let var3 = 30', ! \ 'let var4 = 40'], 'Xtest.vim') ! ! " Start Vim in a terminal ! let buf = RunVimInTerminal('Xtest.vim', {}) ! call RunDbgCmd(buf, ':breakadd file 2 Xtest.vim') ! call RunDbgCmd(buf, ':4 | breakadd here') ! call RunDbgCmd(buf, ':source Xtest.vim', ['line 2: let var2 = 20']) ! call RunDbgCmd(buf, 'cont', ['line 4: let var4 = 40']) call RunDbgCmd(buf, 'cont') call StopVimInTerminal(buf) *** ../vim-8.1.1190/src/version.c 2019-04-20 21:54:04.180499034 +0200 --- src/version.c 2019-04-20 22:27:32.445788446 +0200 *************** *** 773,774 **** --- 773,776 ---- { /* Add new patch number below this line */ + /**/ + 1191, /**/ -- "Never be afraid to tell the world who you are." -- Anonymous /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///