Patch 8.2.3419
Problem:    A failing debug expression may make Vim unusable.
Solution:   Suppress error messages. (closes #8848)
Files:      src/debugger.c, src/testdir/test_debugger.vim


*** ../vim-8.2.3418/src/debugger.c      2021-09-08 20:40:30.357145256 +0200
--- src/debugger.c      2021-09-09 12:28:11.314031677 +0200
***************
*** 532,554 ****
  
  /*
   * 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 *bp)
  {
      typval_T  *tv;
-     int               prev_called_emsg = called_emsg;
-     int               prev_did_emsg = did_emsg;
  
!     got_int = FALSE;
      tv = eval_expr(bp->dbg_name, NULL);
! 
!     // 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;
  }
--- 532,548 ----
  
  /*
   * Evaluate the "bp->dbg_name" expression and return the result.
!  * Disables error messages.
   */
      static typval_T *
! eval_expr_no_emsg(struct debuggy *bp)
  {
      typval_T  *tv;
  
!     // Disable error messages, a bad expression would make Vim unusable.
!     ++emsg_off;
      tv = eval_expr(bp->dbg_name, NULL);
!     --emsg_off;
  
      return tv;
  }
***************
*** 637,643 ****
      {
        bp->dbg_name = vim_strsave(p);
        if (bp->dbg_name != NULL)
!           bp->dbg_val = eval_expr_restore(bp);
      }
      else
      {
--- 631,637 ----
      {
        bp->dbg_name = vim_strsave(p);
        if (bp->dbg_name != NULL)
!           bp->dbg_val = eval_expr_no_emsg(bp);
      }
      else
      {
***************
*** 983,989 ****
            typval_T *tv;
            int       line = FALSE;
  
!           tv = eval_expr_restore(bp);
            if (tv != NULL)
            {
                if (bp->dbg_val == NULL)
--- 977,983 ----
            typval_T *tv;
            int       line = FALSE;
  
!           tv = eval_expr_no_emsg(bp);
            if (tv != NULL)
            {
                if (bp->dbg_val == NULL)
***************
*** 1004,1010 ****
                        debug_oldval = typval_tostring(bp->dbg_val, TRUE);
                        // Need to evaluate again, typval_compare() overwrites
                        // "tv".
!                       v = eval_expr_restore(bp);
                        debug_newval = typval_tostring(v, TRUE);
                        free_tv(bp->dbg_val);
                        bp->dbg_val = v;
--- 998,1004 ----
                        debug_oldval = typval_tostring(bp->dbg_val, TRUE);
                        // Need to evaluate again, typval_compare() overwrites
                        // "tv".
!                       v = eval_expr_no_emsg(bp);
                        debug_newval = typval_tostring(v, TRUE);
                        free_tv(bp->dbg_val);
                        bp->dbg_val = v;
*** ../vim-8.2.3418/src/testdir/test_debugger.vim       2021-09-08 
20:40:30.357145256 +0200
--- src/testdir/test_debugger.vim       2021-09-09 12:32:28.393677799 +0200
***************
*** 271,279 ****
    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 expr', ['E475: Invalid argument: expr'])
!   call RunDbgCmd(buf, 'breakd expr x', [
!             \ 'E121: Undefined variable: x',
!             \ 'E161: Breakpoint not found: expr x'])
  
    " finish the current function
    call RunDbgCmd(buf, 'finish', [
--- 271,277 ----
    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 expr', ['E475: Invalid argument: expr'])
!   call RunDbgCmd(buf, 'breakd expr x', ['E161: Breakpoint not found: expr x'])
  
    " finish the current function
    call RunDbgCmd(buf, 'finish', [
*** ../vim-8.2.3418/src/version.c       2021-09-09 12:11:58.875602021 +0200
--- src/version.c       2021-09-09 12:25:51.954242276 +0200
***************
*** 757,758 ****
--- 757,760 ----
  {   /* Add new patch number below this line */
+ /**/
+     3419,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
12. You turn off your Wifi and get this awful empty feeling, like you just
    pulled the plug on a loved one.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202109091035.189AZ02A022851%40masaka.moolenaar.net.

Raspunde prin e-mail lui