Patch 8.2.4541

7 views
Skip to first unread message

Bram Moolenaar

unread,
Mar 10, 2022, 3:48:32 PM3/10/22
to vim...@googlegroups.com

Patch 8.2.4541
Problem: Crash in debugger when a variable is not available in the current
block.
Solution: Check for a NULL name. (closes #9926)
Files: src/vim9execute.c, src/testdir/test_debugger.vim


*** ../vim-8.2.4540/src/vim9execute.c 2022-03-10 12:20:48.542552970 +0000
--- src/vim9execute.c 2022-03-10 20:46:06.929331411 +0000
***************
*** 1622,1628 ****
// Go through the local variable names, from last to first.
for (idx = debug_var_count - 1; idx >= 0; --idx)
{
! if (STRCMP(((char_u **)dfunc->df_var_names.ga_data)[idx], name) == 0)
return STACK_TV_VAR(idx);
}

--- 1622,1631 ----
// Go through the local variable names, from last to first.
for (idx = debug_var_count - 1; idx >= 0; --idx)
{
! char_u *varname = ((char_u **)dfunc->df_var_names.ga_data)[idx];
!
! // the variable name may be NULL when not available in this block
! if (varname != NULL && STRCMP(varname, name) == 0)
return STACK_TV_VAR(idx);
}

*** ../vim-8.2.4540/src/testdir/test_debugger.vim 2022-01-29 21:45:30.485921485 +0000
--- src/testdir/test_debugger.vim 2022-03-10 20:45:14.841176127 +0000
***************
*** 73,78 ****
--- 73,85 ----
endtry
return var1
endfunc
+ def Vim9Func()
+ for cmd in ['confirm', 'xxxxxxx']
+ for _ in [1, 2]
+ echo cmd
+ endfor
+ endfor
+ enddef
END
call writefile(lines, 'Xtest.vim')

***************
*** 298,303 ****
--- 305,318 ----
\ 'line 5: catch'])
call RunDbgCmd(buf, 'c')

+ " Test showing local variable in :def function
+ call RunDbgCmd(buf, ':breakadd func 2 Vim9Func')
+ call RunDbgCmd(buf, ':call Vim9Func()', ['line 2: for _ in [1, 2]'])
+ call RunDbgCmd(buf, 'next', ['line 2: for _ in [1, 2]'])
+ call RunDbgCmd(buf, 'echo cmd', ['confirm'])
+ call RunDbgCmd(buf, 'breakdel *')
+ call RunDbgCmd(buf, 'cont')
+
" Test for :quit
call RunDbgCmd(buf, ':debug echo Foo()')
call RunDbgCmd(buf, 'breakdel *')
*** ../vim-8.2.4540/src/version.c 2022-03-10 20:01:47.119865247 +0000
--- src/version.c 2022-03-10 20:28:02.678797446 +0000
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 4541,
/**/

--
hundred-and-one symptoms of being an internet addict:
227. You sleep next to your monitor. Or on top of it.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages