From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2126) id 7EB9A3952005; Fri, 6 May 2022 18:10:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7EB9A3952005 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Tom Tromey To: gdb-cvs@sourceware.org Subject: [binutils-gdb] Move works_in_software_mode to watchpoint X-Act-Checkin: binutils-gdb X-Git-Author: Tom Tromey X-Git-Refname: refs/heads/master X-Git-Oldrev: a6860f3ad2d0ee89ee8b4a7f257b7fdcac84b5c4 X-Git-Newrev: 5a61e176877b17a0fdca25a298d296800353af10 Message-Id: <20220506181016.7EB9A3952005@sourceware.org> Date: Fri, 6 May 2022 18:10:16 +0000 (GMT) X-BeenThere: gdb-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 May 2022 18:10:16 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D5a61e176877b= 17a0fdca25a298d296800353af10 commit 5a61e176877b17a0fdca25a298d296800353af10 Author: Tom Tromey Date: Sat Apr 30 08:06:39 2022 -0600 Move works_in_software_mode to watchpoint =20 works_in_software_mode is only useful for watchpoints. This patch moves it from breakpoint to watchpoint, and changes it to return bool. Diff: --- gdb/breakpoint.c | 16 +++++----------- gdb/breakpoint.h | 12 ++++++------ 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 2521e95ce70..41e827bfca7 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -2144,7 +2144,7 @@ update_watchpoint (struct watchpoint *b, int reparse) =3D target_can_use_hardware_watchpoint (type, i, other_type_used); if (target_resources_ok <=3D 0) { - int sw_mode =3D b->works_in_software_mode (); + bool sw_mode =3D b->works_in_software_mode (); =20 if (target_resources_ok =3D=3D 0 && !sw_mode) error (_("Target does not support this type of " @@ -9558,7 +9558,7 @@ watchpoint::resources_needed (const struct bp_locatio= n *bl) /* Implement the "works_in_software_mode" method for hardware watchpoints. */ =20 -int +bool watchpoint::works_in_software_mode () const { /* Read and access watchpoints only work with hardware support. */ @@ -9733,7 +9733,7 @@ struct masked_watchpoint : public watchpoint int remove_location (struct bp_location *, enum remove_bp_reason reason) override; int resources_needed (const struct bp_location *) override; - int works_in_software_mode () const override; + bool works_in_software_mode () const override; enum print_stop_action print_it (struct bpstat *bs) override; void print_one_detail (struct ui_out *) const override; void print_mention () override; @@ -9771,10 +9771,10 @@ masked_watchpoint::resources_needed (const struct b= p_location *bl) /* Implement the "works_in_software_mode" method for masked hardware watchpoints. */ =20 -int +bool masked_watchpoint::works_in_software_mode () const { - return 0; + return false; } =20 /* Implement the "print_it" method for masked hardware @@ -11550,12 +11550,6 @@ breakpoint::breakpoint_hit (const struct bp_locati= on *bl, internal_error_pure_virtual_called (); } =20 -int -breakpoint::works_in_software_mode () const -{ - internal_error_pure_virtual_called (); -} - int breakpoint::resources_needed (const struct bp_location *bl) { diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h index ec3a8309b51..bbacbca15fb 100644 --- a/gdb/breakpoint.h +++ b/gdb/breakpoint.h @@ -668,11 +668,6 @@ struct breakpoint the breakpoint or watchpoint needs one debug register. */ virtual int resources_needed (const struct bp_location *); =20 - /* Tell whether we can downgrade from a hardware watchpoint to a software - one. If not, the user will not be able to enable the watchpoint when - there are not enough hardware resources available. */ - virtual int works_in_software_mode () const; - /* The normal print routine for this breakpoint, called when we hit it. */ virtual enum print_stop_action print_it (struct bpstat *bs); @@ -878,7 +873,12 @@ struct watchpoint : public breakpoint const target_waitstatus &ws) override; void check_status (struct bpstat *bs) override; int resources_needed (const struct bp_location *) override; - int works_in_software_mode () const override; + + /* Tell whether we can downgrade from a hardware watchpoint to a software + one. If not, the user will not be able to enable the watchpoint when + there are not enough hardware resources available. */ + virtual bool works_in_software_mode () const; + enum print_stop_action print_it (struct bpstat *bs) override; void print_mention () override; void print_recreate (struct ui_file *fp) override;