0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

patch 8.2.3395: Vim9: expression breakpoint not checked in :def function

Problem:    Vim9: expression breakpoint not checked in :def function.
Solution:   Always compile a function for debugging if there is an expression
            breakpoint. (closes #8803)
This commit is contained in:
Bram Moolenaar
2021-09-02 18:49:06 +02:00
parent 04626c243c
commit 26a4484da2
8 changed files with 75 additions and 5 deletions

View File

@@ -518,6 +518,7 @@ static garray_T dbg_breakp = {0, 0, sizeof(struct debuggy), 4, NULL};
#define BREAKP(idx) (((struct debuggy *)dbg_breakp.ga_data)[idx])
#define DEBUGGY(gap, idx) (((struct debuggy *)gap->ga_data)[idx])
static int last_breakp = 0; // nr of last defined breakpoint
static int has_expr_breakpoint = FALSE;
#ifdef FEAT_PROFILE
// Profiling uses file and func names similar to breakpoints.
@@ -691,6 +692,8 @@ ex_breakadd(exarg_T *eap)
// DBG_EXPR
DEBUGGY(gap, gap->ga_len++).dbg_nr = ++last_breakp;
++debug_tick;
if (gap == &dbg_breakp)
has_expr_breakpoint = TRUE;
}
}
}
@@ -707,6 +710,29 @@ ex_debuggreedy(exarg_T *eap)
debug_greedy = FALSE;
}
static void
update_has_expr_breakpoint()
{
int i;
has_expr_breakpoint = FALSE;
for (i = 0; i < dbg_breakp.ga_len; ++i)
if (BREAKP(i).dbg_type == DBG_EXPR)
{
has_expr_breakpoint = TRUE;
break;
}
}
/*
* Return TRUE if there is any expression breakpoint.
*/
int
debug_has_expr_breakpoint()
{
return has_expr_breakpoint;
}
/*
* ":breakdel" and ":profdel".
*/
@@ -799,6 +825,8 @@ ex_breakdel(exarg_T *eap)
// If all breakpoints were removed clear the array.
if (gap->ga_len == 0)
ga_clear(gap);
if (gap == &dbg_breakp)
update_has_expr_breakpoint();
}
}