1 /**[txh]********************************************************************
3 Copyright (c) 2004 by Salvador E. Tropea.
4 Covered by the GPL license.
6 Module: Breakpoint table commands.
8 GDB/MI commands for the "Breakpoint Table Commands" section.
11 gdb command: Implemented?
18 -break-info N.A. (info break NUMBER) (*)
24 (*) I think the program should keep track of the breakpoints, so it will
25 be implemented when I have more time. @<p>
27 ***************************************************************************/
31 /* Low level versions. */
33 void mi_break_insert_fl(mi_h *h, const char *file, int line)
35 mi_send(h,"-break-insert %s:%d\n",file,line);
38 void mi_break_insert(mi_h *h, int temporary, int hard_assist,
39 const char *cond, int count, int thread,
46 snprintf(s_count,32,"%d",count);
48 snprintf(s_thread,32,"%d",thread);
50 // Conditions may contain spaces, in fact, if they don't gdb will add
51 // them after parsing. Enclosing the expression with "" solves the
53 mi_send(h,"-break-insert %s %s -c \"%s\" %s %s %s %s %s\n",
54 temporary ? "-t" : "",
55 hard_assist ? "-h" : "",
57 count>=0 ? "-i" : "", count>=0 ? s_count : "",
58 thread>=0 ? "-p" : "", thread>=0 ? s_thread : "",
61 mi_send(h,"-break-insert %s %s %s %s %s %s %s\n",
62 temporary ? "-t" : "",
63 hard_assist ? "-h" : "",
64 count>=0 ? "-i" : "", count>=0 ? s_count : "",
65 thread>=0 ? "-p" : "", thread>=0 ? s_thread : "",
69 void mi_break_insert_flf(mi_h *h, const char *file, int line, int temporary,
70 int hard_assist, const char *cond, int count,
77 snprintf(s_count,32,"%d",count);
79 snprintf(s_thread,32,"%d",thread);
80 mi_send(h,"-break-insert %s %s %s %s %s %s %s %s %s:%d\n",
81 temporary ? "-t" : "",
82 hard_assist ? "-h" : "",
83 cond ? "-c" : "", cond ? cond : "",
84 count>=0 ? "-i" : "", count>=0 ? s_count : "",
85 thread>=0 ? "-p" : "", thread>=0 ? s_thread : "",
89 void mi_break_delete(mi_h *h, int number)
91 mi_send(h,"-break-delete %d\n",number);
94 void mi_break_after(mi_h *h, int number, int count)
96 mi_send(h,"-break-after %d %d\n",number,count);
99 void mi_break_condition(mi_h *h, int number, const char *condition)
101 mi_send(h,"-break-condition %d %s\n",number,condition);
104 void mi_break_enable(mi_h *h, int number)
106 mi_send(h,"-break-enable %d\n",number);
109 void mi_break_disable(mi_h *h, int number)
111 mi_send(h,"-break-disable %d\n",number);
114 void mi_break_watch(mi_h *h, enum mi_wp_mode mode, const char *exp)
117 mi_send(h,"-break-watch \"%s\"\n",exp);
119 mi_send(h,"-break-watch -%c \"%s\"\n",mode==wm_rw ? 'a' : 'r',exp);
122 /* High level versions. */
124 /**[txh]********************************************************************
127 Insert a breakpoint at file:line.
129 Command: -break-insert file:line
130 Return: A new mi_bkpt structure with info about the breakpoint. NULL on
133 ***************************************************************************/
135 mi_bkpt *gmi_break_insert(mi_h *h, const char *file, int line)
137 mi_break_insert_fl(h,file,line);
138 return mi_res_bkpt(h);
141 /**[txh]********************************************************************
144 Insert a breakpoint, all available options.
146 Command: -break-insert
147 Return: A new mi_bkpt structure with info about the breakpoint. NULL on
150 ***************************************************************************/
152 mi_bkpt *gmi_break_insert_full(mi_h *h, int temporary, int hard_assist,
153 const char *cond, int count, int thread,
156 mi_break_insert(h,temporary,hard_assist,cond,count,thread,where);
157 return mi_res_bkpt(h);
160 /**[txh]********************************************************************
163 Insert a breakpoint, all available options.
165 Command: -break-insert [ops] file:line
166 Return: A new mi_bkpt structure with info about the breakpoint. NULL on
169 ***************************************************************************/
171 mi_bkpt *gmi_break_insert_full_fl(mi_h *h, const char *file, int line,
172 int temporary, int hard_assist,
173 const char *cond, int count, int thread)
175 mi_break_insert_flf(h,file,line,temporary,hard_assist,cond,count,thread);
176 return mi_res_bkpt(h);
179 /**[txh]********************************************************************
184 Command: -break-delete
185 Return: !=0 OK. Note that gdb always says OK, but errors can be sent to the
188 ***************************************************************************/
190 int gmi_break_delete(mi_h *h, int number)
192 mi_break_delete(h,number);
193 return mi_res_simple_done(h);
196 /**[txh]********************************************************************
199 Modify the "ignore" count for a breakpoint.
201 Command: -break-after
202 Return: !=0 OK. Note that gdb always says OK, but errors can be sent to the
205 ***************************************************************************/
207 int gmi_break_set_times(mi_h *h, int number, int count)
209 mi_break_after(h,number,count);
210 return mi_res_simple_done(h);
213 /**[txh]********************************************************************
216 Associate a condition with the breakpoint.
218 Command: -break-condition
221 ***************************************************************************/
223 int gmi_break_set_condition(mi_h *h, int number, const char *condition)
225 mi_break_condition(h,number,condition);
226 return mi_res_simple_done(h);
229 /**[txh]********************************************************************
232 Enable or disable a breakpoint.
234 Command: -break-enable + -break-disable
235 Return: !=0 OK. Note that gdb always says OK, but errors can be sent to the
238 ***************************************************************************/
240 int gmi_break_state(mi_h *h, int number, int enable)
243 mi_break_enable(h,number);
245 mi_break_disable(h,number);
246 return mi_res_simple_done(h);
249 /**[txh]********************************************************************
252 Set a watchpoint. It doesn't work for remote targets!
254 Command: -break-watch
255 Return: A new mi_wp structure with info about the watchpoint. NULL on
258 ***************************************************************************/
260 mi_wp *gmi_break_watch(mi_h *h, enum mi_wp_mode mode, const char *exp)
262 mi_break_watch(h,mode,exp);