1 /* MI Command Set - breakpoint and watchpoint commands.
2 Copyright (C) 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
3 Contributed by Cygnus Solutions (a Red Hat company).
5 This file is part of GDB.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
24 #include "breakpoint.h"
25 #include "gdb_string.h"
26 #include "mi-getopt.h"
27 #include "gdb-events.h"
35 /* Output a single breakpoint. */
38 breakpoint_notify (int b
)
40 gdb_breakpoint_query (uiout
, b
, NULL
);
44 struct gdb_events breakpoint_hooks
=
59 /* Implements the -break-insert command.
60 See the MI manual for the list of possible options. */
63 mi_cmd_break_insert (char *command
, char **argv
, int argc
)
66 enum bp_type type
= REG_BP
;
70 char *condition
= NULL
;
73 struct gdb_events
*old_hooks
;
76 HARDWARE_OPT
, TEMP_OPT
/*, REGEXP_OPT */ , CONDITION_OPT
,
77 IGNORE_COUNT_OPT
, THREAD_OPT
, PENDING_OPT
79 static struct mi_opt opts
[] =
81 {"h", HARDWARE_OPT
, 0},
83 {"c", CONDITION_OPT
, 1},
84 {"i", IGNORE_COUNT_OPT
, 1},
86 {"f", PENDING_OPT
, 0},
90 /* Parse arguments. It could be -r or -h or -t, <location> or ``--''
91 to denote the end of the option list. */
96 int opt
= mi_getopt ("mi_cmd_break_insert", argc
, argv
, opts
, &optind
, &optarg
);
99 switch ((enum opt
) opt
)
115 case IGNORE_COUNT_OPT
:
116 ignore_count
= atol (optarg
);
119 thread
= atol (optarg
);
128 error (_("mi_cmd_break_insert: Missing <location>"));
129 if (optind
< argc
- 1)
130 error (_("mi_cmd_break_insert: Garbage following <location>"));
131 address
= argv
[optind
];
133 /* Now we have what we need, let's insert the breakpoint! */
134 old_hooks
= deprecated_set_gdb_event_hooks (&breakpoint_hooks
);
138 rc
= gdb_breakpoint (address
, condition
,
139 0 /*hardwareflag */ , temp_p
,
140 thread
, ignore_count
,
145 rc
= gdb_breakpoint (address
, condition
,
146 1 /*hardwareflag */ , temp_p
,
147 thread
, ignore_count
,
154 error (_("mi_cmd_break_insert: Unsupported tempoary regexp breakpoint"));
156 rbreak_command_wrapper (address
, FROM_TTY
);
161 internal_error (__FILE__
, __LINE__
,
162 _("mi_cmd_break_insert: Bad switch."));
164 deprecated_set_gdb_event_hooks (old_hooks
);
166 if (rc
== GDB_RC_FAIL
)
179 /* Insert a watchpoint. The type of watchpoint is specified by the
181 -break-watch <expr> --> insert a regular wp.
182 -break-watch -r <expr> --> insert a read watchpoint.
183 -break-watch -a <expr> --> insert an access wp. */
186 mi_cmd_break_watch (char *command
, char **argv
, int argc
)
189 enum wp_type type
= REG_WP
;
194 static struct mi_opt opts
[] =
197 {"a", ACCESS_OPT
, 0},
201 /* Parse arguments. */
206 int opt
= mi_getopt ("mi_cmd_break_watch", argc
, argv
, opts
, &optind
, &optarg
);
209 switch ((enum opt
) opt
)
220 error (_("mi_cmd_break_watch: Missing <expression>"));
221 if (optind
< argc
- 1)
222 error (_("mi_cmd_break_watch: Garbage following <expression>"));
225 /* Now we have what we need, let's insert the watchpoint! */
229 watch_command_wrapper (expr
, FROM_TTY
);
232 rwatch_command_wrapper (expr
, FROM_TTY
);
235 awatch_command_wrapper (expr
, FROM_TTY
);
238 error (_("mi_cmd_break_watch: Unknown watchpoint type."));