home *** CD-ROM | disk | FTP | other *** search
/ vim.ftp.fu-berlin.de / 2015-02-03.vim.ftp.fu-berlin.de.tar / vim.ftp.fu-berlin.de / patches / 6.2.117 < prev    next >
Encoding:
Internet Message Format  |  2003-10-13  |  6.5 KB

  1. To: vim-dev@vim.org
  2. Subject: Patch 6.2.117
  3. Fcc: outbox
  4. From: Bram Moolenaar <Bram@moolenaar.net>
  5. Mime-Version: 1.0
  6. Content-Type: text/plain; charset=ISO-8859-1
  7. Content-Transfer-Encoding: 8bit
  8. ------------
  9.  
  10. Patch 6.2.117
  11. Problem:    Breakpoints in loops of sourced files and functions are not
  12.         detected. (Hari Krishna Dara)
  13. Solution:   Check for breakpoints when using lines that were previously read.
  14.         (Servatius Brandt)
  15. Files:        src/eval.c, src/ex_cmds2.c, src/ex_docmd.c, src/proto/eval.pro,
  16.         src/proto/ex_cmds2.pro
  17.  
  18.  
  19. *** ../vim-6.2.116/src/eval.c    Sun Oct 12 16:56:43 2003
  20. --- src/eval.c    Sun Oct 12 20:04:45 2003
  21. ***************
  22. *** 126,131 ****
  23. --- 126,161 ----
  24.   };
  25.   
  26.   /*
  27. +  * Return the name of the executed function.
  28. +  */
  29. +     char_u *
  30. + func_name(cookie)
  31. +     void *cookie;
  32. + {
  33. +     return ((struct funccall *)cookie)->func->name;
  34. + }
  35. + /*
  36. +  * Return the address holding the next breakpoint line for a funccall cookie.
  37. +  */
  38. +     linenr_T *
  39. + func_breakpoint(cookie)
  40. +     void *cookie;
  41. + {
  42. +     return &((struct funccall *)cookie)->breakpoint;
  43. + }
  44. + /*
  45. +  * Return the address holding the debug tick for a funccall cookie.
  46. +  */
  47. +     int *
  48. + func_dbg_tick(cookie)
  49. +     void *cookie;
  50. + {
  51. +     return &((struct funccall *)cookie)->dbg_tick;
  52. + }
  53. + /*
  54.    * Return the nesting level for a funccall cookie.
  55.    */
  56.       int
  57. *** ../vim-6.2.116/src/ex_cmds2.c    Sat Sep 27 19:36:46 2003
  58. --- src/ex_cmds2.c    Sun Oct 12 20:04:45 2003
  59. ***************
  60. *** 1995,2000 ****
  61. --- 1995,2020 ----
  62.   };
  63.   
  64.   #ifdef FEAT_EVAL
  65. + /*
  66. +  * Return the address holding the next breakpoint line for a source cookie.
  67. +  */
  68. +     linenr_T *
  69. + source_breakpoint(cookie)
  70. +     void *cookie;
  71. + {
  72. +     return &((struct source_cookie *)cookie)->breakpoint;
  73. + }
  74. + /*
  75. +  * Return the address holding the debug tick for a source cookie.
  76. +  */
  77. +     int *
  78. + source_dbg_tick(cookie)
  79. +     void *cookie;
  80. + {
  81. +     return &((struct source_cookie *)cookie)->dbg_tick;
  82. + }
  83.   /*
  84.    * Return the nesting level for a source cookie.
  85.    */
  86. *** ../vim-6.2.116/src/ex_docmd.c    Sun Oct 12 17:10:47 2003
  87. --- src/ex_docmd.c    Sun Oct 12 20:14:08 2003
  88. ***************
  89. *** 591,596 ****
  90. --- 591,599 ----
  91.       struct condstack cstack;        /* conditional stack */
  92.       garray_T    lines_ga;        /* keep lines for ":while" */
  93.       int        current_line = 0;    /* active line in lines_ga */
  94. +     char_u    *fname = NULL;        /* function or script name */
  95. +     linenr_T    *breakpoint = NULL;    /* ptr to breakpoint field in cookie */
  96. +     int        *dbg_tick = NULL;    /* ptr to dbg_tick field in cookie */
  97.       int        saved_trylevel = 0;
  98.       int        saved_force_abort = 0;
  99.       except_T    *saved_caught_stack = NULL;
  100. ***************
  101. *** 649,654 ****
  102. --- 652,672 ----
  103.       if (getline == get_func_line && ex_nesting_level == func_level(cookie))
  104.       ++ex_nesting_level;
  105.   
  106. +     /* Get the function or script name and the address where the next breakpoint
  107. +      * line and the debug tick for a function or script are stored. */
  108. +     if (getline == get_func_line)
  109. +     {
  110. +     fname = func_name(cookie);
  111. +     breakpoint = func_breakpoint(cookie);
  112. +     dbg_tick = func_dbg_tick(cookie);
  113. +     }
  114. +     else if (getline == getsourceline)
  115. +     {
  116. +     fname = sourcing_name;
  117. +     breakpoint = source_breakpoint(cookie);
  118. +     dbg_tick = source_dbg_tick(cookie);
  119. +     }
  120.       /*
  121.        * Initialize "force_abort"  and "suppress_errthrow" at the top level.
  122.        */
  123. ***************
  124. *** 749,756 ****
  125. --- 767,794 ----
  126.           break;
  127.           }
  128.   
  129. +         /* If breakpoints have been added/deleted need to check for it. */
  130. +         if (breakpoint != NULL && dbg_tick != NULL
  131. +                            && *dbg_tick != debug_tick)
  132. +         {
  133. +         *breakpoint = dbg_find_breakpoint((getline == getsourceline),
  134. +                             fname, sourcing_lnum);
  135. +         *dbg_tick = debug_tick;
  136. +         }
  137.           next_cmdline = ((wcmd_T *)(lines_ga.ga_data))[current_line].line;
  138.           sourcing_lnum = ((wcmd_T *)(lines_ga.ga_data))[current_line].lnum;
  139. +         /* Did we encounter a breakpoint? */
  140. +         if (breakpoint != NULL && *breakpoint != 0
  141. +                           && *breakpoint <= sourcing_lnum)
  142. +         {
  143. +         dbg_breakpoint(fname, sourcing_lnum);
  144. +         /* Find next breakpoint. */
  145. +         *breakpoint = dbg_find_breakpoint((getline == getsourceline),
  146. +                             fname, sourcing_lnum);
  147. +         *dbg_tick = debug_tick;
  148. +         }
  149.       }
  150.   #endif
  151.   
  152. ***************
  153. *** 932,937 ****
  154. --- 970,984 ----
  155.               current_line = cstack.cs_line[cstack.cs_idx];
  156.               cstack.cs_had_while = TRUE;    /* note we jumped there */
  157.               line_breakcheck();        /* check if CTRL-C typed */
  158. +             /* Check for the next breakpoint at or after the ":while".*/
  159. +             if (breakpoint != NULL)
  160. +             {
  161. +             *breakpoint = dbg_find_breakpoint(
  162. +                         (getline == getsourceline), fname,
  163. +                ((wcmd_T *)lines_ga.ga_data)[current_line].lnum-1);
  164. +             *dbg_tick = debug_tick;
  165. +             }
  166.           }
  167.           else /* can only get here with ":endwhile" */
  168.           {
  169. *** ../vim-6.2.116/src/proto/eval.pro    Sun Jun  1 12:26:07 2003
  170. --- src/proto/eval.pro    Sun Oct 12 20:04:45 2003
  171. ***************
  172. *** 1,4 ****
  173. --- 1,7 ----
  174.   /* eval.c */
  175. + char_u *func_name __ARGS((void *cookie));
  176. + linenr_T *func_breakpoint __ARGS((void *cookie));
  177. + int *func_dbg_tick __ARGS((void *cookie));
  178.   int func_level __ARGS((void *cookie));
  179.   int current_func_returned __ARGS((void));
  180.   void set_internal_string_var __ARGS((char_u *name, char_u *value));
  181. *** ../vim-6.2.116/src/proto/ex_cmds2.pro    Sun Jun  1 12:26:08 2003
  182. --- src/proto/ex_cmds2.pro    Sun Oct 12 20:04:45 2003
  183. ***************
  184. *** 37,42 ****
  185. --- 37,44 ----
  186.   int do_in_runtimepath __ARGS((char_u *name, int all, void (*callback)(char_u *fname)));
  187.   void ex_options __ARGS((exarg_T *eap));
  188.   void ex_source __ARGS((exarg_T *eap));
  189. + linenr_T *source_breakpoint __ARGS((void *cookie));
  190. + int *source_dbg_tick __ARGS((void *cookie));
  191.   int source_level __ARGS((void *cookie));
  192.   int do_source __ARGS((char_u *fname, int check_other, int is_vimrc));
  193.   void ex_scriptnames __ARGS((exarg_T *eap));
  194. *** ../vim-6.2.116/src/version.c    Sun Oct 12 17:28:22 2003
  195. --- src/version.c    Sun Oct 12 20:19:24 2003
  196. ***************
  197. *** 639,640 ****
  198. --- 639,642 ----
  199.   {   /* Add new patch number below this line */
  200. + /**/
  201. +     117,
  202.   /**/
  203.  
  204. -- 
  205. Wizards had always known that the act of observation changed the thing that
  206. was observed, and sometimes forgot that it also changed the observer too.
  207.             Terry Pratchett  -  Interesting times
  208.  
  209.  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
  210. ///          Creator of Vim - Vi IMproved -- http://www.Vim.org          \\\
  211. \\\              Project leader for A-A-P -- http://www.A-A-P.org        ///
  212.  \\\  Help AIDS victims, buy here: http://ICCF-Holland.org/click1.html  ///
  213.