diff options
Diffstat (limited to 'gdb/mi/mi-cmd-break.c')
-rw-r--r-- | gdb/mi/mi-cmd-break.c | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/gdb/mi/mi-cmd-break.c b/gdb/mi/mi-cmd-break.c index c73548c..5439937 100644 --- a/gdb/mi/mi-cmd-break.c +++ b/gdb/mi/mi-cmd-break.c @@ -386,6 +386,63 @@ mi_cmd_dprintf_insert (const char *command, char **argv, int argc) mi_cmd_break_insert_1 (1, command, argv, argc); } +/* Implements the -break-condition command. + See the MI manual for the list of options. */ + +void +mi_cmd_break_condition (const char *command, char **argv, int argc) +{ + enum option + { + FORCE_CONDITION_OPT, + }; + + static const struct mi_opt opts[] = + { + {"-force", FORCE_CONDITION_OPT, 0}, + { 0, 0, 0 } + }; + + /* Parse arguments. */ + int oind = 0; + char *oarg; + bool force_condition = false; + + while (true) + { + int opt = mi_getopt ("-break-condition", argc, argv, + opts, &oind, &oarg); + if (opt < 0) + break; + + switch (opt) + { + case FORCE_CONDITION_OPT: + force_condition = true; + break; + } + } + + /* There must be at least two more args: a bpnum and a condition + expression. */ + if (oind + 1 >= argc) + error (_("-break-condition: Missing the <number> and/or <expr> " + "argument")); + + int bpnum = atoi (argv[oind]); + + /* The rest form the condition expr. */ + std::string expr (argv[oind + 1]); + for (int i = oind + 2; i < argc; ++i) + { + expr += " "; + expr += argv[i]; + } + + set_breakpoint_condition (bpnum, expr.c_str (), 0 /* from_tty */, + force_condition); +} + enum wp_type { REG_WP, |