From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1551) id AF5693830881; Fri, 20 May 2022 19:42:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AF5693830881 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Pedro Alves To: gdb-cvs@sourceware.org Subject: [binutils-gdb] ranged_breakpoint: move initialization to ctor X-Act-Checkin: binutils-gdb X-Git-Author: Pedro Alves X-Git-Refname: refs/heads/master X-Git-Oldrev: 27a62b4359a2718012eaf86bbeedb8662ec9f41b X-Git-Newrev: b925bf21e073f0d9531385e8cfc3a825887c0778 Message-Id: <20220520194248.AF5693830881@sourceware.org> Date: Fri, 20 May 2022 19:42:48 +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, 20 May 2022 19:42:48 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Db925bf21e073= f0d9531385e8cfc3a825887c0778 commit b925bf21e073f0d9531385e8cfc3a825887c0778 Author: Pedro Alves Date: Fri May 6 22:48:11 2022 +0100 ranged_breakpoint: move initialization to ctor =20 Move initialization of ranged_breakpoint's fields to its ctor. =20 Change-Id: If7b842861f3cc6a429ea329d45598b5852283ba3 Diff: --- gdb/breakpoint.c | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index ced976ca39d..1c1dbfb3ad7 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -317,9 +317,20 @@ struct dprintf_breakpoint : public ordinary_breakpoint /* Ranged breakpoints. */ struct ranged_breakpoint : public ordinary_breakpoint { - explicit ranged_breakpoint (struct gdbarch *gdbarch) + explicit ranged_breakpoint (struct gdbarch *gdbarch, + const symtab_and_line &sal_start, + int length, + event_location_up start_location, + event_location_up end_location) : ordinary_breakpoint (gdbarch, bp_hardware_breakpoint) { + bp_location *bl =3D add_location (sal_start); + bl->length =3D length; + + disposition =3D disp_donttouch; + + location =3D std::move (start_location); + location_range_end =3D std::move (end_location); } =20 int breakpoint_hit (const struct bp_location *bl, @@ -9436,13 +9447,13 @@ break_range_command (const char *arg, int from_tty) return; } =20 - /* Now set up the breakpoint. */ - std::unique_ptr br (new ranged_breakpoint (get_current_arch = ())); - br->add_location (sal_start); - br->disposition =3D disp_donttouch; - br->location =3D std::move (start_location); - br->location_range_end =3D std::move (end_location); - br->loc->length =3D length; + /* Now set up the breakpoint and install it. */ + + std::unique_ptr br + (new ranged_breakpoint (get_current_arch (), + sal_start, length, + std::move (start_location), + std::move (end_location))); =20 install_breakpoint (false, std::move (br), true); }