public inbox for gdb-cvs@sourceware.org help / color / mirror / Atom feed
From: Tom Tromey <tromey@sourceware.org> To: gdb-cvs@sourceware.org Subject: [binutils-gdb] Add constructor to exception_catchpoint Date: Fri, 6 May 2022 18:11:07 +0000 (GMT) [thread overview] Message-ID: <20220506181107.3375F3857034@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=1ae43feabb90a534d2a58638fd18aded7d3758dd commit 1ae43feabb90a534d2a58638fd18aded7d3758dd Author: Tom Tromey <tom@tromey.com> Date: Sat Apr 30 14:24:21 2022 -0600 Add constructor to exception_catchpoint 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[] = 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<compiled_regex> pattern; - - if (!except_rx.empty ()) - { - pattern.reset (new compiled_regex (except_rx.c_str (), REG_NOSUB, - _("invalid type-matching regexp"))); - } - - std::unique_ptr<exception_catchpoint> cp (new exception_catchpoint ()); + std::unique_ptr<exception_catchpoint> cp + (new exception_catchpoint (ex_event, std::move (except_rx))); init_catchpoint (cp.get (), get_current_arch (), tempflag, cond_string); - cp->kind = ex_event; - cp->exception_rx = std::move (except_rx); - cp->pattern = std::move (pattern); cp->re_set ();
reply other threads:[~2022-05-06 18:11 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220506181107.3375F3857034@sourceware.org \ --to=tromey@sourceware.org \ --cc=gdb-cvs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).