@@ -530,6 +530,29 @@ static garray_T prof_ga = {0, 0, sizeof(struct debuggy), 4, NULL};
530530
531531static linenr_T debuggy_find (int file ,char_u * fname , linenr_T after , garray_T * gap , int * fp );
532532
533+ /*
534+ * Evaluate the "bp->dbg_name" expression and return the result.
535+ * Restore the got_int and called_emsg flags.
536+ */
537+ static typval_T *
538+ eval_expr_restore (struct debuggy * bp )
539+ {
540+ typval_T * tv ;
541+ int prev_called_emsg = called_emsg ;
542+ int prev_did_emsg = did_emsg ;
543+
544+ got_int = FALSE;
545+ tv = eval_expr (bp -> dbg_name , NULL );
546+
547+ // Evaluating the expression should not result in breaking the sequence of
548+ // commands.
549+ got_int = FALSE;
550+ called_emsg = prev_called_emsg ;
551+ did_emsg = prev_did_emsg ;
552+
553+ return tv ;
554+ }
555+
533556/*
534557 * Parse the arguments of ":profile", ":breakadd" or ":breakdel" and put them
535558 * in the entry just after the last one in dbg_breakp. Note that "dbg_name"
@@ -614,7 +637,7 @@ dbg_parsearg(
614637 {
615638 bp -> dbg_name = vim_strsave (p );
616639 if (bp -> dbg_name != NULL )
617- bp -> dbg_val = eval_expr (bp -> dbg_name , NULL );
640+ bp -> dbg_val = eval_expr_restore (bp );
618641 }
619642 else
620643 {
@@ -960,10 +983,7 @@ debuggy_find(
960983 typval_T * tv ;
961984 int line = FALSE;
962985
963- prev_got_int = got_int ;
964- got_int = FALSE;
965-
966- tv = eval_expr (bp -> dbg_name , NULL );
986+ tv = eval_expr_restore (bp );
967987 if (tv != NULL )
968988 {
969989 if (bp -> dbg_val == NULL )
@@ -984,7 +1004,7 @@ debuggy_find(
9841004 debug_oldval = typval_tostring (bp -> dbg_val , TRUE);
9851005 // Need to evaluate again, typval_compare() overwrites
9861006 // "tv".
987- v = eval_expr (bp -> dbg_name , NULL );
1007+ v = eval_expr_restore (bp );
9881008 debug_newval = typval_tostring (v , TRUE);
9891009 free_tv (bp -> dbg_val );
9901010 bp -> dbg_val = v ;
@@ -1006,8 +1026,6 @@ debuggy_find(
10061026 lnum = after > 0 ? after : 1 ;
10071027 break ;
10081028 }
1009-
1010- got_int |= prev_got_int ;
10111029 }
10121030#endif
10131031 }
0 commit comments