diff options
author | Sean Dewar <seandewar@users.noreply.github.com> | 2021-09-13 17:09:15 +0100 |
---|---|---|
committer | Sean Dewar <seandewar@users.noreply.github.com> | 2021-09-13 17:24:07 +0100 |
commit | 31ac33bf772b17d6a0553b97889aeaf3a5227419 (patch) | |
tree | e64d3cc65318671b80bea152371a9eb910e30bde /src/nvim/debugger.c | |
parent | 936c4ae1519c6d30a02d328214f8b797bfbd7738 (diff) | |
download | rneovim-31ac33bf772b17d6a0553b97889aeaf3a5227419.tar.gz rneovim-31ac33bf772b17d6a0553b97889aeaf3a5227419.tar.bz2 rneovim-31ac33bf772b17d6a0553b97889aeaf3a5227419.zip |
vim-patch:8.2.3419: a failing debug expression may make Vim unusable
Problem: A failing debug expression may make Vim unusable.
Solution: Suppress error messages. (closes vim/vim#8848)
https://github.com/vim/vim/commit/0325d3967ce7d0fd35bc1472fd476b911b895b76
Diffstat (limited to 'src/nvim/debugger.c')
-rw-r--r-- | src/nvim/debugger.c | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/src/nvim/debugger.c b/src/nvim/debugger.c index 778facb0f5..73665009ff 100644 --- a/src/nvim/debugger.c +++ b/src/nvim/debugger.c @@ -454,22 +454,14 @@ static garray_T prof_ga = { 0, 0, sizeof(struct debuggy), 4, NULL }; #define DBG_EXPR 3 /// Evaluate the "bp->dbg_name" expression and return the result. -/// Restore the got_int and called_emsg flags. -static typval_T *eval_expr_restore(struct debuggy *const bp) +/// Disables error messages. +static typval_T *eval_expr_no_emsg(struct debuggy *const bp) FUNC_ATTR_NONNULL_ALL { - const int prev_called_emsg = called_emsg; - const int prev_did_emsg = did_emsg; - - got_int = false; + // Disable error messages, a bad expression would make Vim unusable. + emsg_off++; typval_T *const tv = eval_expr(bp->dbg_name); - - // Evaluating the expression should not result in breaking the sequence of - // commands. - got_int = false; - called_emsg = prev_called_emsg; - did_emsg = prev_did_emsg; - + emsg_off--; return tv; } @@ -535,7 +527,7 @@ static int dbg_parsearg(char_u *arg, garray_T *gap) bp->dbg_name = vim_strsave(curbuf->b_ffname); } else if (bp->dbg_type == DBG_EXPR) { bp->dbg_name = vim_strsave(p); - bp->dbg_val = eval_expr_restore(bp); + bp->dbg_val = eval_expr_no_emsg(bp); } else { // Expand the file name in the same way as do_source(). This means // doing it twice, so that $DIR/file gets expanded when $DIR is @@ -791,7 +783,7 @@ debuggy_find( } else if (bp->dbg_type == DBG_EXPR) { bool line = false; - typval_T *const tv = eval_expr_restore(bp); + typval_T *const tv = eval_expr_no_emsg(bp); if (tv != NULL) { if (bp->dbg_val == NULL) { debug_oldval = typval_tostring(NULL); @@ -804,7 +796,7 @@ debuggy_find( line = true; debug_oldval = typval_tostring(bp->dbg_val); // Need to evaluate again, typval_compare() overwrites "tv". - typval_T *const v = eval_expr_restore(bp); + typval_T *const v = eval_expr_no_emsg(bp); debug_newval = typval_tostring(v); tv_free(bp->dbg_val); bp->dbg_val = v; |