aboutsummaryrefslogtreecommitdiff
path: root/gdb/NEWS
diff options
context:
space:
mode:
authorTankut Baris Aktemur <tankut.baris.aktemur@intel.com>2020-10-27 10:56:03 +0100
committerTankut Baris Aktemur <tankut.baris.aktemur@intel.com>2020-10-27 11:00:57 +0100
commit733d554a4625db4ffb89b7a20e1cf27ab071ef4d (patch)
treed80ff024b78e88d2eba1c53d91766761a0ee92e8 /gdb/NEWS
parentb5fa468fef441528147c3a47b085612d5305f181 (diff)
downloadgdb-733d554a4625db4ffb89b7a20e1cf27ab071ef4d.zip
gdb-733d554a4625db4ffb89b7a20e1cf27ab071ef4d.tar.gz
gdb-733d554a4625db4ffb89b7a20e1cf27ab071ef4d.tar.bz2
gdb/breakpoint: add flags to 'condition' and 'break' commands to force condition
The previous patch made it possible to define a condition if it's valid at some locations. If the condition is invalid at all of the locations, it's rejected. However, there may be cases where the user knows the condition *will* be valid at a location in the future, e.g. due to a shared library load. To make it possible that such condition can be defined, this patch adds an optional '-force' flag to the 'condition' command, and, respectively, a '-force-condition' flag to the 'break'command. When the force flag is passed, the condition is not rejected even when it is invalid for all the current locations (note that all the locations would be internally disabled in this case). For instance: (gdb) break test.c:5 Breakpoint 1 at 0x1155: file test.c, line 5. (gdb) cond 1 foo == 42 No symbol "foo" in current context. Defining the condition was not possible because 'foo' is not available. The user can override this behavior with the '-force' flag: (gdb) cond -force 1 foo == 42 warning: failed to validate condition at location 1.1, disabling: No symbol "foo" in current context. (gdb) info breakpoints Num Type Disp Enb Address What 1 breakpoint keep y <MULTIPLE> stop only if foo == 42 1.1 N 0x0000000000001155 in main at test.c:5 Now the condition is accepted, but the location is automatically disabled. If a future location has a context in which 'foo' is available, that location would be enabled. For the 'break' command, -force-condition has the same result: (gdb) break test.c:5 -force-condition if foo == 42 warning: failed to validate condition at location 0x1169, disabling: No symbol "foo" in current context. Breakpoint 1 at 0x1169: file test.c, line 5. gdb/ChangeLog: 2020-10-27 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> * breakpoint.h (set_breakpoint_condition): Add a new bool parameter. * breakpoint.c: Update the help text of the 'condition' and 'break' commands. (set_breakpoint_condition): Take a new bool parameter to control whether condition definition should be forced even when the condition expression is invalid in all of the current locations. (condition_command): Update the call to 'set_breakpoint_condition'. (find_condition_and_thread): Take the "-force-condition" flag into account. * linespec.c (linespec_keywords): Add "-force-condition" as an element. (FORCE_KEYWORD_INDEX): New #define. (linespec_lexer_lex_keyword): Update to consider "-force-condition" as a keyword. * ada-lang.c (create_ada_exception_catchpoint): Ditto. * guile/scm-breakpoint.c (gdbscm_set_breakpoint_condition_x): Ditto. * python/py-breakpoint.c (bppy_set_condition): Ditto. * NEWS: Mention the changes to the 'break' and 'condition' commands. gdb/testsuite/ChangeLog: 2020-10-27 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> * gdb.base/condbreak-multi-context.exp: Expand to test forcing the condition. * gdb.linespec/cpcompletion.exp: Update to consider the '-force-condition' keyword. * gdb.linespec/explicit.exp: Ditto. * lib/completion-support.exp: Ditto. gdb/doc/ChangeLog: 2020-10-27 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> * gdb.texinfo (Set Breaks): Document the '-force-condition' flag of the 'break'command. * gdb.texinfo (Conditions): Document the '-force' flag of the 'condition' command.
Diffstat (limited to 'gdb/NEWS')
-rw-r--r--gdb/NEWS22
1 files changed, 22 insertions, 0 deletions
diff --git a/gdb/NEWS b/gdb/NEWS
index 1789cf3..c99d318 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -21,6 +21,28 @@ set debug event-loop
show debug event-loop
Control the display of debug output about GDB's event loop.
+* Changed commands
+
+break [PROBE_MODIFIER] [LOCATION] [thread THREADNUM]
+ [-force-condition] [if CONDITION]
+ This command would previously refuse setting a breakpoint if the
+ CONDITION expression is invalid at a location. It now accepts and
+ defines the breakpoint if there is at least one location at which
+ the CONDITION is valid. The locations for which the CONDITION is
+ invalid, are automatically disabled. If CONDITION is invalid at all
+ of the locations, setting the breakpoint is still rejected. However,
+ the '-force-condition' flag can be used in this case for forcing GDB to
+ define the breakpoint, making all the current locations automatically
+ disabled. This may be useful if the user knows the condition will
+ become meaningful at a future location, e.g. due to a shared library
+ load.
+
+condition [-force] N COND
+ The behavior of this command is changed the same way for the 'break'
+ command as explained above. The '-force' flag can be used to force
+ GDB into defining the condition even when COND is invalid for all the
+ current locations of breakpoint N.
+
*** Changes in GDB 10
* There are new feature names for ARC targets: "org.gnu.gdb.arc.core"