aboutsummaryrefslogtreecommitdiff
path: root/gdb/breakpoint.c
diff options
context:
space:
mode:
authorTankut Baris Aktemur <tankut.baris.aktemur@intel.com>2021-05-06 10:13:06 +0200
committerTankut Baris Aktemur <tankut.baris.aktemur@intel.com>2021-05-06 10:46:40 +0200
commit79aabb7308cd572fff21da5c93952a1bb0dc5b26 (patch)
tree9d210659cd58e30967e664791578974a06c64625 /gdb/breakpoint.c
parent10e578d7e00d74033ded0443422ffc509390a912 (diff)
downloadgdb-79aabb7308cd572fff21da5c93952a1bb0dc5b26.zip
gdb-79aabb7308cd572fff21da5c93952a1bb0dc5b26.tar.gz
gdb-79aabb7308cd572fff21da5c93952a1bb0dc5b26.tar.bz2
gdb/mi: add a '--force' flag to the '-break-condition' command
Add a '--force' flag to the '-break-condition' command to be able to force conditions. gdb/ChangeLog: 2021-05-06 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> * mi/mi-cmd-break.c (mi_cmd_break_condition): New function. * mi/mi-cmds.c: Change the binding of "-break-condition" to mi_cmd_break_condition. * mi/mi-cmds.h (mi_cmd_break_condition): Declare. * breakpoint.h (set_breakpoint_condition): Declare a new overload. * breakpoint.c (set_breakpoint_condition): New overloaded function extracted out from ... (condition_command): ... this. * NEWS: Mention the change. gdb/testsuite/ChangeLog: 2021-05-06 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> * gdb.mi/mi-break.exp (test_forced_conditions): Add a test for the -break-condition command's "--force" flag. gdb/doc/ChangeLog: 2021-05-06 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> * gdb.texinfo (GDB/MI Breakpoint Commands): Mention the '--force' flag of the '-break-condition' command.
Diffstat (limited to 'gdb/breakpoint.c')
-rw-r--r--gdb/breakpoint.c59
1 files changed, 34 insertions, 25 deletions
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 9cc53f8..35a891b 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -973,6 +973,39 @@ set_breakpoint_condition (struct breakpoint *b, const char *exp,
gdb::observers::breakpoint_modified.notify (b);
}
+/* See breakpoint.h. */
+
+void
+set_breakpoint_condition (int bpnum, const char *exp, int from_tty,
+ bool force)
+{
+ struct breakpoint *b;
+ ALL_BREAKPOINTS (b)
+ if (b->number == bpnum)
+ {
+ /* Check if this breakpoint has a "stop" method implemented in an
+ extension language. This method and conditions entered into GDB
+ from the CLI are mutually exclusive. */
+ const struct extension_language_defn *extlang
+ = get_breakpoint_cond_ext_lang (b, EXT_LANG_NONE);
+
+ if (extlang != NULL)
+ {
+ error (_("Only one stop condition allowed. There is currently"
+ " a %s stop condition defined for this breakpoint."),
+ ext_lang_capitalized_name (extlang));
+ }
+ set_breakpoint_condition (b, exp, from_tty, force);
+
+ if (is_breakpoint (b))
+ update_global_location_list (UGLL_MAY_INSERT);
+
+ return;
+ }
+
+ error (_("No breakpoint number %d."), bpnum);
+}
+
/* The options for the "condition" command. */
struct condition_command_opts
@@ -1066,7 +1099,6 @@ condition_completer (struct cmd_list_element *cmd,
static void
condition_command (const char *arg, int from_tty)
{
- struct breakpoint *b;
const char *p;
int bnum;
@@ -1085,30 +1117,7 @@ condition_command (const char *arg, int from_tty)
if (bnum == 0)
error (_("Bad breakpoint argument: '%s'"), arg);
- ALL_BREAKPOINTS (b)
- if (b->number == bnum)
- {
- /* Check if this breakpoint has a "stop" method implemented in an
- extension language. This method and conditions entered into GDB
- from the CLI are mutually exclusive. */
- const struct extension_language_defn *extlang
- = get_breakpoint_cond_ext_lang (b, EXT_LANG_NONE);
-
- if (extlang != NULL)
- {
- error (_("Only one stop condition allowed. There is currently"
- " a %s stop condition defined for this breakpoint."),
- ext_lang_capitalized_name (extlang));
- }
- set_breakpoint_condition (b, p, from_tty, cc_opts.force_condition);
-
- if (is_breakpoint (b))
- update_global_location_list (UGLL_MAY_INSERT);
-
- return;
- }
-
- error (_("No breakpoint number %d."), bnum);
+ set_breakpoint_condition (bnum, p, from_tty, cc_opts.force_condition);
}
/* Check that COMMAND do not contain commands that are suitable