From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2126) id 3375F3857034; Fri, 6 May 2022 18:11:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3375F3857034 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] Add constructor to exception_catchpoint X-Act-Checkin: binutils-gdb X-Git-Author: Tom Tromey X-Git-Refname: refs/heads/master X-Git-Oldrev: 6c91c7de2007ca0d6f0285fa62e755507359a177 X-Git-Newrev: 1ae43feabb90a534d2a58638fd18aded7d3758dd Message-Id: <20220506181107.3375F3857034@sourceware.org> Date: Fri, 6 May 2022 18:11:07 +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:11:07 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D1ae43feabb90= a534d2a58638fd18aded7d3758dd commit 1ae43feabb90a534d2a58638fd18aded7d3758dd Author: Tom Tromey Date: Sat Apr 30 14:24:21 2022 -0600 Add constructor to exception_catchpoint =20 This adds a constructor to exception_catchpoint and simplifies the caller. Diff: --- gdb/break-catch-throw.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/gdb/break-catch-throw.c b/gdb/break-catch-throw.c index a10334e9ae0..59e73da2c28 100644 --- a/gdb/break-catch-throw.c +++ b/gdb/break-catch-throw.c @@ -67,6 +67,17 @@ static const struct exception_names exception_functions[= ] =3D =20 struct exception_catchpoint : public base_breakpoint { + exception_catchpoint (enum exception_event_kind kind_, + std::string &&except_rx) + : kind (kind_), + exception_rx (std::move (except_rx)), + pattern (exception_rx.empty () + ? nullptr + : new compiled_regex (exception_rx.c_str (), REG_NOSUB, + _("invalid type-matching regexp"))) + { + } + void re_set () override; enum print_stop_action print_it (const bpstat *bs) const override; bool print_one (bp_location **) const override; @@ -355,20 +366,10 @@ handle_gnu_v3_exceptions (int tempflag, std::string &= &except_rx, const char *cond_string, enum exception_event_kind ex_event, int from_tty) { - std::unique_ptr pattern; - - if (!except_rx.empty ()) - { - pattern.reset (new compiled_regex (except_rx.c_str (), REG_NOSUB, - _("invalid type-matching regexp"))); - } - - std::unique_ptr cp (new exception_catchpoint ()); + std::unique_ptr cp + (new exception_catchpoint (ex_event, std::move (except_rx))); =20 init_catchpoint (cp.get (), get_current_arch (), tempflag, cond_string); - cp->kind =3D ex_event; - cp->exception_rx =3D std::move (except_rx); - cp->pattern =3D std::move (pattern); =20 cp->re_set ();