RE: [PATCH v4 1/2] gdb/breakpoint: disable a bp location if condition is invalid at that location

Aktemur, Tankut Baris via Gdb-patches
2020-10-13T15:17:21Z

On Tuesday, October 13, 2020 5:07 PM, Eli Zaretskii wrote:
> > Date: Tue, 13 Oct 2020 14:25:02 +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 (class bp_location) <disabled_by_cond>: New field.
> > * breakpoint.c (set_breakpoint_location_condition): New function.
> > (set_breakpoint_condition): Disable a breakpoint
> > location if parsing the condition string gives an error.
> > (should_be_inserted): Update to consider the 'disabled_by_cond' field.
> > (build_target_condition_list): Ditto.
> > (build_target_command_list): Ditto.
> > (build_bpstat_chain): Ditto.
> > (print_one_breakpoint_location): Ditto.
> > (print_one_breakpoint): Ditto.
> > (breakpoint_1): Ditto.
> > (bp_location::bp_location): Ditto.
> > (locations_are_equal): Ditto.
> > (update_breakpoint_locations): Ditto.
> > (enable_disable_bp_num_loc): Ditto.
> > (init_breakpoint_sal): Use set_breakpoint_location_condition.
> > (find_condition_and_thread_for_sals): New static function.
> > (create_breakpoint): Call find_condition_and_thread_for_sals.
> > (location_to_sals): Call find_condition_and_thread_for_sals instead
> > of find_condition_and_thread.
> >
> > gdb/testsuite/ChangeLog:
> > 2020-07-31 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
> >
> > * gdb.base/condbreak-multi-context.cc: New file.
> > * gdb.base/condbreak-multi-context.exp: New file.
> >
> > gdb/doc/ChangeLog:
> > 2020-09-25 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
> >
> > * gdb.texinfo (Set Breaks): Document disabling of breakpoint
> > locations for which the breakpoint condition is invalid.
>
> OK for the documentation part.
>
> But I have to wonder: GDB can automatically disable some conditional
> breakpoints, but it leaves enabling them to the user?

If the condition is invalid at a location, GDB will disable that location.
The user cannot enable it manually, unless they change the condition and
the new condition is validated at the location. In that case the location
automatically becomes enabled again.

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