33#include "gdbsupport/gdb_obstack.h"
61 catch (
const gdb_exception_error &ex)
82scoped_restore_tmpl<int>
107 for (i = 0; argv[0][i] !=
'\0'; i++)
139 if (isprint (argv[0][i]))
140 result += argv[0][i];
145 xsnprintf (tmp,
sizeof (tmp),
"\\%o",
146 (
unsigned char) argv[0][i]);
155 for (i = 1; i < argc; i++)
170 const char *
const *argv,
int argc)
172 const char *address = NULL;
176 int thread_group = -1;
178 const char *condition = NULL;
187 std::unique_ptr<explicit_location_spec> explicit_loc
189 std::string extra_string;
190 bool force_condition =
false;
194 HARDWARE_OPT, TEMP_OPT, CONDITION_OPT,
195 IGNORE_COUNT_OPT, THREAD_OPT, THREAD_GROUP_OPT,
196 PENDING_OPT, DISABLE_OPT,
200 EXPLICIT_SOURCE_OPT, EXPLICIT_FUNC_OPT,
201 EXPLICIT_LABEL_OPT, EXPLICIT_LINE_OPT
203 static const struct mi_opt opts[] =
205 {
"h", HARDWARE_OPT, 0},
207 {
"c", CONDITION_OPT, 1},
208 {
"i", IGNORE_COUNT_OPT, 1},
209 {
"p", THREAD_OPT, 1},
210 {
"g", THREAD_GROUP_OPT, 1},
211 {
"f", PENDING_OPT, 0},
212 {
"d", DISABLE_OPT, 0},
213 {
"a", TRACEPOINT_OPT, 0},
214 {
"-force-condition", FORCE_CONDITION_OPT, 0},
215 {
"-qualified", QUALIFIED_OPT, 0},
216 {
"-source" , EXPLICIT_SOURCE_OPT, 1},
217 {
"-function", EXPLICIT_FUNC_OPT, 1},
218 {
"-label", EXPLICIT_LABEL_OPT, 1},
219 {
"-line", EXPLICIT_LINE_OPT, 1},
230 int opt =
mi_getopt (
"-break-insert", argc, argv,
234 switch ((
enum opt) opt)
245 case IGNORE_COUNT_OPT:
246 ignore_count = atol (oarg);
249 thread = atol (oarg);
251 error (_(
"Unknown thread %d."), thread);
253 case THREAD_GROUP_OPT:
268 case EXPLICIT_SOURCE_OPT:
270 explicit_loc->source_filename = xstrdup (oarg);
272 case EXPLICIT_FUNC_OPT:
274 explicit_loc->function_name = xstrdup (oarg);
276 case EXPLICIT_LABEL_OPT:
278 explicit_loc->label_name = xstrdup (oarg);
280 case EXPLICIT_LINE_OPT:
284 case FORCE_CONDITION_OPT:
285 force_condition =
true;
290 if (oind >= argc && !is_explicit)
291 error (_(
"-%s-insert: Missing <location>"),
292 dprintf ?
"dprintf" :
"break");
295 int format_num = is_explicit ? oind : oind + 1;
298 error (_(
"-dprintf-insert: does not support -h or -a"));
299 if (format_num >= argc)
300 error (_(
"-dprintf-insert: Missing <format>"));
303 address = argv[oind];
310 error (_(
"-break-insert: Garbage following explicit location"));
315 error (_(
"-break-insert: Garbage following <location>"));
316 address = argv[oind];
350 if (explicit_loc->source_filename != NULL
351 && explicit_loc->function_name == NULL
352 && explicit_loc->label_name == NULL
354 error (_(
"-%s-insert: --source option requires --function, --label,"
355 " or --line"), dprintf ?
"dprintf" :
"break");
357 explicit_loc->func_name_match_type = match_type;
359 locspec = std::move (explicit_loc);
366 error (_(
"Garbage '%s' at end of location"), address);
370 thread, thread_group,
371 extra_string.c_str (),
377 ops, 0, enabled, 0, 0);
410 static const struct mi_opt opts[] =
412 {
"-force", FORCE_CONDITION_OPT, 0},
419 bool force_condition =
false;
423 int opt =
mi_getopt (
"-break-condition", argc, argv,
430 case FORCE_CONDITION_OPT:
431 force_condition =
true;
438 error (_(
"-break-condition: Missing the <number> argument"));
440 int bpnum = atoi (argv[oind]);
443 std::string
expr =
"";
444 for (
int i = oind + 1; i < argc; ++i)
471 error (_(
"Usage: tracepoint-number passcount"));
484 error (_(
"Could not find tracepoint %d"), n);
497 const char *
expr = NULL;
503 static const struct mi_opt opts[] =
506 {
"a", ACCESS_OPT, 0},
516 int opt =
mi_getopt (
"-break-watch", argc, argv,
521 switch ((
enum opt) opt)
532 error (_(
"-break-watch: Missing <expression>"));
534 error (_(
"-break-watch: Garbage following <expression>"));
550 error (_(
"-break-watch: Unknown watchpoint type."));
563 error (_(
"USAGE: %s <BKPT> [<COMMAND> [<COMMAND>...]]"), command);
565 bnum = strtol (argv[0], &endptr, 0);
566 if (endptr == argv[0])
567 error (_(
"breakpoint number argument \"%s\" is not a number."),
569 else if (*endptr !=
'\0')
570 error (_(
"junk at the end of breakpoint number argument \"%s\"."),
575 error (_(
"breakpoint %d not found."), bnum);
579 = [&] (std::string &buffer)
581 const char *result =
nullptr;
583 result = argv[count++];
589 tracepoint *t = gdb::checked_static_cast<tracepoint *> (b);
591 [=] (
const char *line)
struct gdbarch * get_current_arch(void)
struct breakpoint * get_breakpoint(int num)
void watch_command_wrapper(const char *arg, int from_tty, bool internal)
void rwatch_command_wrapper(const char *arg, int from_tty, bool internal)
int create_breakpoint(struct gdbarch *gdbarch, location_spec *locspec, const char *cond_string, int thread, int inferior, const char *extra_string, bool force_condition, int parse_extra, int tempflag, enum bptype type_wanted, int ignore_count, enum auto_boolean pending_break_support, const struct breakpoint_ops *ops, int from_tty, int enabled, int internal, unsigned flags)
const struct breakpoint_ops code_breakpoint_ops
void break_command(const char *arg, int from_tty)
void awatch_command_wrapper(const char *arg, int from_tty, bool internal)
void breakpoint_set_commands(struct breakpoint *b, counted_command_line &&commands)
void notify_breakpoint_modified(breakpoint *b)
struct tracepoint * get_tracepoint(int num)
void set_breakpoint_condition(struct breakpoint *b, const char *exp, int from_tty, bool force)
void print_breakpoint(breakpoint *b)
bool is_tracepoint(const struct breakpoint *b)
const struct breakpoint_ops * breakpoint_ops_for_location_spec(const location_spec *locspec, bool is_tracepoint)
counted_command_line read_command_lines_1(read_next_line_ftype read_next_line_func, int parse_commands, gdb::function_view< void(const char *)> validator)
std::shared_ptr< command_line > counted_command_line
void exception_print(struct ui_file *file, const struct gdb_exception &e)
int valid_global_thread_id(int global_id)
const struct language_defn * current_language
struct line_offset linespec_parse_line_offset(const char *string)
location_spec_up string_to_location_spec_basic(const char **stringp, const struct language_defn *language, symbol_name_match_type match_type)
std::unique_ptr< location_spec > location_spec_up
static int mi_can_breakpoint_notify
static std::string mi_argv_to_format(const char *const *argv, int argc)
static int mi_breakpoint_observers_installed
scoped_restore_tmpl< int > setup_breakpoint_reporting(void)
static void breakpoint_notify(struct breakpoint *b)
static void mi_cmd_break_insert_1(int dprintf, const char *command, const char *const *argv, int argc)
mi_cmd_argv_ftype mi_cmd_break_condition
mi_cmd_argv_ftype mi_cmd_break_commands
mi_cmd_argv_ftype mi_cmd_dprintf_insert
mi_cmd_argv_ftype mi_cmd_break_insert
mi_cmd_argv_ftype mi_cmd_break_passcount
mi_cmd_argv_ftype mi_cmd_break_watch
int mi_getopt(const char *prefix, int argc, const char *const *argv, const struct mi_opt *opts, int *oind, const char **oarg)
int mi_parse_thread_group_id(const char *id)
observable< struct breakpoint * > breakpoint_created
void validate_actionline(const char *line, tracepoint *t)