mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
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 #8848)
This commit is contained in:
@@ -532,23 +532,17 @@ static linenr_T debuggy_find(int file,char_u *fname, linenr_T after, garray_T *g
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Evaluate the "bp->dbg_name" expression and return the result.
|
* Evaluate the "bp->dbg_name" expression and return the result.
|
||||||
* Restore the got_int and called_emsg flags.
|
* Disables error messages.
|
||||||
*/
|
*/
|
||||||
static typval_T *
|
static typval_T *
|
||||||
eval_expr_restore(struct debuggy *bp)
|
eval_expr_no_emsg(struct debuggy *bp)
|
||||||
{
|
{
|
||||||
typval_T *tv;
|
typval_T *tv;
|
||||||
int prev_called_emsg = called_emsg;
|
|
||||||
int prev_did_emsg = did_emsg;
|
|
||||||
|
|
||||||
got_int = FALSE;
|
// Disable error messages, a bad expression would make Vim unusable.
|
||||||
|
++emsg_off;
|
||||||
tv = eval_expr(bp->dbg_name, NULL);
|
tv = eval_expr(bp->dbg_name, NULL);
|
||||||
|
--emsg_off;
|
||||||
// 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;
|
|
||||||
|
|
||||||
return tv;
|
return tv;
|
||||||
}
|
}
|
||||||
@@ -637,7 +631,7 @@ dbg_parsearg(
|
|||||||
{
|
{
|
||||||
bp->dbg_name = vim_strsave(p);
|
bp->dbg_name = vim_strsave(p);
|
||||||
if (bp->dbg_name != NULL)
|
if (bp->dbg_name != NULL)
|
||||||
bp->dbg_val = eval_expr_restore(bp);
|
bp->dbg_val = eval_expr_no_emsg(bp);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -983,7 +977,7 @@ debuggy_find(
|
|||||||
typval_T *tv;
|
typval_T *tv;
|
||||||
int line = FALSE;
|
int line = FALSE;
|
||||||
|
|
||||||
tv = eval_expr_restore(bp);
|
tv = eval_expr_no_emsg(bp);
|
||||||
if (tv != NULL)
|
if (tv != NULL)
|
||||||
{
|
{
|
||||||
if (bp->dbg_val == NULL)
|
if (bp->dbg_val == NULL)
|
||||||
@@ -1004,7 +998,7 @@ debuggy_find(
|
|||||||
debug_oldval = typval_tostring(bp->dbg_val, TRUE);
|
debug_oldval = typval_tostring(bp->dbg_val, TRUE);
|
||||||
// Need to evaluate again, typval_compare() overwrites
|
// Need to evaluate again, typval_compare() overwrites
|
||||||
// "tv".
|
// "tv".
|
||||||
v = eval_expr_restore(bp);
|
v = eval_expr_no_emsg(bp);
|
||||||
debug_newval = typval_tostring(v, TRUE);
|
debug_newval = typval_tostring(v, TRUE);
|
||||||
free_tv(bp->dbg_val);
|
free_tv(bp->dbg_val);
|
||||||
bp->dbg_val = v;
|
bp->dbg_val = v;
|
||||||
|
@@ -271,9 +271,7 @@ func Test_Debugger()
|
|||||||
call RunDbgCmd(buf, 'breakd func a()', ['E475: Invalid argument: func a()'])
|
call RunDbgCmd(buf, 'breakd func a()', ['E475: Invalid argument: func a()'])
|
||||||
call RunDbgCmd(buf, 'breakd func a', ['E161: Breakpoint not found: func a'])
|
call RunDbgCmd(buf, 'breakd func a', ['E161: Breakpoint not found: func a'])
|
||||||
call RunDbgCmd(buf, 'breakd expr', ['E475: Invalid argument: expr'])
|
call RunDbgCmd(buf, 'breakd expr', ['E475: Invalid argument: expr'])
|
||||||
call RunDbgCmd(buf, 'breakd expr x', [
|
call RunDbgCmd(buf, 'breakd expr x', ['E161: Breakpoint not found: expr x'])
|
||||||
\ 'E121: Undefined variable: x',
|
|
||||||
\ 'E161: Breakpoint not found: expr x'])
|
|
||||||
|
|
||||||
" finish the current function
|
" finish the current function
|
||||||
call RunDbgCmd(buf, 'finish', [
|
call RunDbgCmd(buf, 'finish', [
|
||||||
|
@@ -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 */
|
||||||
|
/**/
|
||||||
|
3419,
|
||||||
/**/
|
/**/
|
||||||
3418,
|
3418,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user