4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=ISO-8859-1
7 Content-Transfer-Encoding: 8bit
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.
15 Files: src/eval.c, src/ex_cmds2.c, src/ex_docmd.c, src/proto/eval.pro,
16 src/proto/ex_cmds2.pro
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
27 + * Return the name of the executed function.
33 + return ((struct funccall *)cookie)->func->name;
37 + * Return the address holding the next breakpoint line for a funccall cookie.
40 + func_breakpoint(cookie)
43 + return &((struct funccall *)cookie)->breakpoint;
47 + * Return the address holding the debug tick for a funccall cookie.
50 + func_dbg_tick(cookie)
53 + return &((struct funccall *)cookie)->dbg_tick;
57 * Return the nesting level for a funccall cookie.
60 *** ../vim-6.2.116/src/ex_cmds2.c Sat Sep 27 19:36:46 2003
61 --- src/ex_cmds2.c Sun Oct 12 20:04:45 2003
69 + * Return the address holding the next breakpoint line for a source cookie.
72 + source_breakpoint(cookie)
75 + return &((struct source_cookie *)cookie)->breakpoint;
79 + * Return the address holding the debug tick for a source cookie.
82 + source_dbg_tick(cookie)
85 + return &((struct source_cookie *)cookie)->dbg_tick;
89 * Return the nesting level for a source cookie.
91 *** ../vim-6.2.116/src/ex_docmd.c Sun Oct 12 17:10:47 2003
92 --- src/ex_docmd.c Sun Oct 12 20:14:08 2003
96 struct condstack cstack; /* conditional stack */
97 garray_T lines_ga; /* keep lines for ":while" */
98 int current_line = 0; /* active line in lines_ga */
99 + char_u *fname = NULL; /* function or script name */
100 + linenr_T *breakpoint = NULL; /* ptr to breakpoint field in cookie */
101 + int *dbg_tick = NULL; /* ptr to dbg_tick field in cookie */
102 int saved_trylevel = 0;
103 int saved_force_abort = 0;
104 except_T *saved_caught_stack = NULL;
108 if (getline == get_func_line && ex_nesting_level == func_level(cookie))
111 + /* Get the function or script name and the address where the next breakpoint
112 + * line and the debug tick for a function or script are stored. */
113 + if (getline == get_func_line)
115 + fname = func_name(cookie);
116 + breakpoint = func_breakpoint(cookie);
117 + dbg_tick = func_dbg_tick(cookie);
119 + else if (getline == getsourceline)
121 + fname = sourcing_name;
122 + breakpoint = source_breakpoint(cookie);
123 + dbg_tick = source_dbg_tick(cookie);
127 * Initialize "force_abort" and "suppress_errthrow" at the top level.
135 + /* If breakpoints have been added/deleted need to check for it. */
136 + if (breakpoint != NULL && dbg_tick != NULL
137 + && *dbg_tick != debug_tick)
139 + *breakpoint = dbg_find_breakpoint((getline == getsourceline),
140 + fname, sourcing_lnum);
141 + *dbg_tick = debug_tick;
144 next_cmdline = ((wcmd_T *)(lines_ga.ga_data))[current_line].line;
145 sourcing_lnum = ((wcmd_T *)(lines_ga.ga_data))[current_line].lnum;
147 + /* Did we encounter a breakpoint? */
148 + if (breakpoint != NULL && *breakpoint != 0
149 + && *breakpoint <= sourcing_lnum)
151 + dbg_breakpoint(fname, sourcing_lnum);
152 + /* Find next breakpoint. */
153 + *breakpoint = dbg_find_breakpoint((getline == getsourceline),
154 + fname, sourcing_lnum);
155 + *dbg_tick = debug_tick;
163 current_line = cstack.cs_line[cstack.cs_idx];
164 cstack.cs_had_while = TRUE; /* note we jumped there */
165 line_breakcheck(); /* check if CTRL-C typed */
167 + /* Check for the next breakpoint at or after the ":while".*/
168 + if (breakpoint != NULL)
170 + *breakpoint = dbg_find_breakpoint(
171 + (getline == getsourceline), fname,
172 + ((wcmd_T *)lines_ga.ga_data)[current_line].lnum-1);
173 + *dbg_tick = debug_tick;
176 else /* can only get here with ":endwhile" */
178 *** ../vim-6.2.116/src/proto/eval.pro Sun Jun 1 12:26:07 2003
179 --- src/proto/eval.pro Sun Oct 12 20:04:45 2003
184 + char_u *func_name __ARGS((void *cookie));
185 + linenr_T *func_breakpoint __ARGS((void *cookie));
186 + int *func_dbg_tick __ARGS((void *cookie));
187 int func_level __ARGS((void *cookie));
188 int current_func_returned __ARGS((void));
189 void set_internal_string_var __ARGS((char_u *name, char_u *value));
190 *** ../vim-6.2.116/src/proto/ex_cmds2.pro Sun Jun 1 12:26:08 2003
191 --- src/proto/ex_cmds2.pro Sun Oct 12 20:04:45 2003
195 int do_in_runtimepath __ARGS((char_u *name, int all, void (*callback)(char_u *fname)));
196 void ex_options __ARGS((exarg_T *eap));
197 void ex_source __ARGS((exarg_T *eap));
198 + linenr_T *source_breakpoint __ARGS((void *cookie));
199 + int *source_dbg_tick __ARGS((void *cookie));
200 int source_level __ARGS((void *cookie));
201 int do_source __ARGS((char_u *fname, int check_other, int is_vimrc));
202 void ex_scriptnames __ARGS((exarg_T *eap));
203 *** ../vim-6.2.116/src/version.c Sun Oct 12 17:28:22 2003
204 --- src/version.c Sun Oct 12 20:19:24 2003
208 { /* Add new patch number below this line */
214 Wizards had always known that the act of observation changed the thing that
215 was observed, and sometimes forgot that it also changed the observer too.
216 Terry Pratchett - Interesting times
218 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
219 /// Creator of Vim - Vi IMproved -- http://www.Vim.org \\\
220 \\\ Project leader for A-A-P -- http://www.A-A-P.org ///
221 \\\ Help AIDS victims, buy here: http://ICCF-Holland.org/click1.html ///