mirror of
https://github.com/vim/vim.git
synced 2025-09-25 03:54:15 -04:00
patch 8.2.3116: Vim9: crash when debugging a function with line continuation
Problem: Vim9: crash when debugging a function with line continuation. Solution: Check for a NULL pointer. (closes #8521)
This commit is contained in:
@@ -1009,6 +1009,7 @@ func Test_debug_def_function()
|
|||||||
eval 1
|
eval 1
|
||||||
enddef
|
enddef
|
||||||
enddef
|
enddef
|
||||||
|
|
||||||
def g:FuncComment()
|
def g:FuncComment()
|
||||||
# comment
|
# comment
|
||||||
echo "first"
|
echo "first"
|
||||||
@@ -1016,6 +1017,7 @@ func Test_debug_def_function()
|
|||||||
# comment
|
# comment
|
||||||
echo "second"
|
echo "second"
|
||||||
enddef
|
enddef
|
||||||
|
|
||||||
def g:FuncForLoop()
|
def g:FuncForLoop()
|
||||||
eval 1
|
eval 1
|
||||||
for i in [11, 22, 33]
|
for i in [11, 22, 33]
|
||||||
@@ -1023,6 +1025,11 @@ func Test_debug_def_function()
|
|||||||
endfor
|
endfor
|
||||||
echo "done"
|
echo "done"
|
||||||
enddef
|
enddef
|
||||||
|
|
||||||
|
def g:FuncWithSplitLine()
|
||||||
|
eval 1
|
||||||
|
| eval 2
|
||||||
|
enddef
|
||||||
END
|
END
|
||||||
call writefile(file, 'Xtest.vim')
|
call writefile(file, 'Xtest.vim')
|
||||||
|
|
||||||
@@ -1078,6 +1085,12 @@ func Test_debug_def_function()
|
|||||||
call RunDbgCmd(buf, 'next', ['function FuncForLoop', 'line 2: for i in [11, 22, 33]'])
|
call RunDbgCmd(buf, 'next', ['function FuncForLoop', 'line 2: for i in [11, 22, 33]'])
|
||||||
call RunDbgCmd(buf, 'echo i', ['22'])
|
call RunDbgCmd(buf, 'echo i', ['22'])
|
||||||
|
|
||||||
|
call RunDbgCmd(buf, 'breakdel *')
|
||||||
|
call RunDbgCmd(buf, 'cont')
|
||||||
|
|
||||||
|
call RunDbgCmd(buf, ':breakadd func FuncWithSplitLine')
|
||||||
|
call RunDbgCmd(buf, ':call FuncWithSplitLine()', ['function FuncWithSplitLine', 'line 1: eval 1 | eval 2'])
|
||||||
|
|
||||||
call RunDbgCmd(buf, 'cont')
|
call RunDbgCmd(buf, 'cont')
|
||||||
call StopVimInTerminal(buf)
|
call StopVimInTerminal(buf)
|
||||||
call delete('Xtest.vim')
|
call delete('Xtest.vim')
|
||||||
|
@@ -755,6 +755,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 */
|
||||||
|
/**/
|
||||||
|
3116,
|
||||||
/**/
|
/**/
|
||||||
3115,
|
3115,
|
||||||
/**/
|
/**/
|
||||||
|
@@ -1497,9 +1497,11 @@ handle_debug(isn_T *iptr, ectx_T *ectx)
|
|||||||
ga_init2(&ga, sizeof(char_u *), 10);
|
ga_init2(&ga, sizeof(char_u *), 10);
|
||||||
for (lnum = iptr->isn_lnum; lnum < end_lnum; ++lnum)
|
for (lnum = iptr->isn_lnum; lnum < end_lnum; ++lnum)
|
||||||
{
|
{
|
||||||
char_u *p = skipwhite(
|
char_u *p = ((char_u **)ufunc->uf_lines.ga_data)[lnum - 1];
|
||||||
((char_u **)ufunc->uf_lines.ga_data)[lnum - 1]);
|
|
||||||
|
|
||||||
|
if (p == NULL)
|
||||||
|
continue; // left over from continuation line
|
||||||
|
p = skipwhite(p);
|
||||||
if (*p == '#')
|
if (*p == '#')
|
||||||
break;
|
break;
|
||||||
if (ga_grow(&ga, 1) == OK)
|
if (ga_grow(&ga, 1) == OK)
|
||||||
|
Reference in New Issue
Block a user