RE: [PATCH v4 2/2] gdb/breakpoint: add flags to 'condition' and 'break' commands to force condition

Aktemur, Tankut Baris via Gdb-patches
2020-10-13T15:47:02Z

On Tuesday, October 13, 2020 5:09 PM, Eli Zaretskii wrote:
> > Date: Tue, 13 Oct 2020 14:25:03 +0200
> > From: Tankut Baris Aktemur via Gdb-patches <gdb-patches@sourceware.org>
> > Cc: simark@simark.ca
> >
> > gdb/ChangeLog:
> > 2020-07-31 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.
> >
> > gdb/testsuite/ChangeLog:
> > 2020-08-20 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-07-31 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.
>
> OK for the documentation part.
>
> What about the NEWS?

I forgot about it. Thanks for reminding. How about the change below?

diff --git a/gdb/NEWS b/gdb/NEWS
index 1789cf31356..c99d3181a8b 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"

Thanks,
-Baris

Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Gary Kershaw
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928