mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 8.2.4541: Crash in debugger when a variable is not available
Problem: Crash in debugger when a variable is not available in the current block. Solution: Check for a NULL name. (closes #9926)
This commit is contained in:
parent
1b1df95f1a
commit
e406ff87c8
@ -73,6 +73,13 @@ func Test_Debugger()
|
|||||||
endtry
|
endtry
|
||||||
return var1
|
return var1
|
||||||
endfunc
|
endfunc
|
||||||
|
def Vim9Func()
|
||||||
|
for cmd in ['confirm', 'xxxxxxx']
|
||||||
|
for _ in [1, 2]
|
||||||
|
echo cmd
|
||||||
|
endfor
|
||||||
|
endfor
|
||||||
|
enddef
|
||||||
END
|
END
|
||||||
call writefile(lines, 'Xtest.vim')
|
call writefile(lines, 'Xtest.vim')
|
||||||
|
|
||||||
@ -298,6 +305,14 @@ func Test_Debugger()
|
|||||||
\ 'line 5: catch'])
|
\ 'line 5: catch'])
|
||||||
call RunDbgCmd(buf, 'c')
|
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
|
" Test for :quit
|
||||||
call RunDbgCmd(buf, ':debug echo Foo()')
|
call RunDbgCmd(buf, ':debug echo Foo()')
|
||||||
call RunDbgCmd(buf, 'breakdel *')
|
call RunDbgCmd(buf, 'breakdel *')
|
||||||
|
@ -750,6 +750,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
4541,
|
||||||
/**/
|
/**/
|
||||||
4540,
|
4540,
|
||||||
/**/
|
/**/
|
||||||
|
@ -1622,7 +1622,10 @@ lookup_debug_var(char_u *name)
|
|||||||
// Go through the local variable names, from last to first.
|
// Go through the local variable names, from last to first.
|
||||||
for (idx = debug_var_count - 1; idx >= 0; --idx)
|
for (idx = debug_var_count - 1; idx >= 0; --idx)
|
||||||
{
|
{
|
||||||
if (STRCMP(((char_u **)dfunc->df_var_names.ga_data)[idx], name) == 0)
|
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);
|
return STACK_TV_VAR(idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user