mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 8.2.3086: Vim9: breakpoint on "for" does not work
Problem: Vim9: breakpoint on "for" does not work. Solution: Use the right line number in ISN_DEBUG. (closes #8486)
This commit is contained in:
parent
acbb4b5720
commit
6fc0161682
@ -1017,6 +1017,13 @@ func Test_debug_def_function()
|
|||||||
# comment
|
# comment
|
||||||
echo "second"
|
echo "second"
|
||||||
enddef
|
enddef
|
||||||
|
def g:FuncForLoop()
|
||||||
|
eval 1
|
||||||
|
for i in [11, 22, 33]
|
||||||
|
eval i
|
||||||
|
endfor
|
||||||
|
echo "done"
|
||||||
|
enddef
|
||||||
END
|
END
|
||||||
call writefile(file, 'Xtest.vim')
|
call writefile(file, 'Xtest.vim')
|
||||||
|
|
||||||
@ -1062,6 +1069,15 @@ func Test_debug_def_function()
|
|||||||
call RunDbgCmd(buf, ':call FuncComment()', ['function FuncComment', 'line 2: echo "first" .. "one"'])
|
call RunDbgCmd(buf, ':call FuncComment()', ['function FuncComment', 'line 2: echo "first" .. "one"'])
|
||||||
call RunDbgCmd(buf, ':breakadd func 3 FuncComment')
|
call RunDbgCmd(buf, ':breakadd func 3 FuncComment')
|
||||||
call RunDbgCmd(buf, 'cont', ['function FuncComment', 'line 5: echo "second"'])
|
call RunDbgCmd(buf, 'cont', ['function FuncComment', 'line 5: echo "second"'])
|
||||||
|
call RunDbgCmd(buf, 'cont')
|
||||||
|
|
||||||
|
call RunDbgCmd(buf, ':breakadd func 2 FuncForLoop')
|
||||||
|
call RunDbgCmd(buf, ':call FuncForLoop()', ['function FuncForLoop', 'line 2: for i in [11, 22, 33]'])
|
||||||
|
call RunDbgCmd(buf, 'echo i', ['11'])
|
||||||
|
call RunDbgCmd(buf, 'next', ['function FuncForLoop', 'line 3: eval i'])
|
||||||
|
call RunDbgCmd(buf, 'next', ['function FuncForLoop', 'line 4: endfor'])
|
||||||
|
call RunDbgCmd(buf, 'next', ['function FuncForLoop', 'line 2: for i in [11, 22, 33]'])
|
||||||
|
call RunDbgCmd(buf, 'echo i', ['22'])
|
||||||
|
|
||||||
call RunDbgCmd(buf, 'cont')
|
call RunDbgCmd(buf, 'cont')
|
||||||
call StopVimInTerminal(buf)
|
call StopVimInTerminal(buf)
|
||||||
|
@ -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 */
|
||||||
|
/**/
|
||||||
|
3086,
|
||||||
/**/
|
/**/
|
||||||
3085,
|
3085,
|
||||||
/**/
|
/**/
|
||||||
|
@ -7747,6 +7747,7 @@ compile_for(char_u *arg_start, cctx_T *cctx)
|
|||||||
type_T *vartype;
|
type_T *vartype;
|
||||||
type_T *item_type = &t_any;
|
type_T *item_type = &t_any;
|
||||||
int idx;
|
int idx;
|
||||||
|
int prev_lnum = cctx->ctx_prev_lnum;
|
||||||
|
|
||||||
p = skip_var_list(arg_start, TRUE, &var_count, &semicolon, FALSE);
|
p = skip_var_list(arg_start, TRUE, &var_count, &semicolon, FALSE);
|
||||||
if (p == NULL)
|
if (p == NULL)
|
||||||
@ -7774,7 +7775,11 @@ compile_for(char_u *arg_start, cctx_T *cctx)
|
|||||||
if (cctx->ctx_compile_type == CT_DEBUG && instr->ga_len > 0
|
if (cctx->ctx_compile_type == CT_DEBUG && instr->ga_len > 0
|
||||||
&& ((isn_T *)instr->ga_data)[instr->ga_len - 1]
|
&& ((isn_T *)instr->ga_data)[instr->ga_len - 1]
|
||||||
.isn_type == ISN_DEBUG)
|
.isn_type == ISN_DEBUG)
|
||||||
|
{
|
||||||
--instr->ga_len;
|
--instr->ga_len;
|
||||||
|
prev_lnum = ((isn_T *)instr->ga_data)[instr->ga_len]
|
||||||
|
.isn_arg.debug.dbg_break_lnum;
|
||||||
|
}
|
||||||
|
|
||||||
scope = new_scope(cctx, FOR_SCOPE);
|
scope = new_scope(cctx, FOR_SCOPE);
|
||||||
if (scope == NULL)
|
if (scope == NULL)
|
||||||
@ -7934,8 +7939,15 @@ compile_for(char_u *arg_start, cctx_T *cctx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (cctx->ctx_compile_type == CT_DEBUG)
|
if (cctx->ctx_compile_type == CT_DEBUG)
|
||||||
|
{
|
||||||
|
int save_prev_lnum = cctx->ctx_prev_lnum;
|
||||||
|
|
||||||
// Add ISN_DEBUG here, so that the loop variables can be inspected.
|
// Add ISN_DEBUG here, so that the loop variables can be inspected.
|
||||||
|
// Use the prev_lnum from the ISN_DEBUG instruction removed above.
|
||||||
|
cctx->ctx_prev_lnum = prev_lnum;
|
||||||
generate_instr_debug(cctx);
|
generate_instr_debug(cctx);
|
||||||
|
cctx->ctx_prev_lnum = save_prev_lnum;
|
||||||
|
}
|
||||||
|
|
||||||
return arg_end;
|
return arg_end;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user