From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-f41.google.com (mail-wr1-f41.google.com [209.85.221.41]) by sourceware.org (Postfix) with ESMTPS id 711363856DD3 for ; Mon, 16 May 2022 18:41:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 711363856DD3 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wr1-f41.google.com with SMTP id j25so20684161wrc.9 for ; Mon, 16 May 2022 11:41:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=zRVt2jXl/caSJ3C6JawBLdBtFd04q5U3spHl52AtrW8=; b=7+Ag3yL1CzrsOAtQWnzkDWZy1EnJBwxIWfLM1c1i85n4LxjhosBdCOAUgd022/9iU3 WJfpiJb/UKO5wRWG91UoxxClak/YIvMcCN6RNAGArF39czIezTQvammb2Q1ob615/cQB wP5M/T3iufUSbYykwirqptyXT90nya5RHBygHifm9Os2dMfxZ1iyIGRiTWTqpwj1zUB6 GQwo5mFvqVTGZi4LI2tgRhsIgeUmHUCyluYTNOnDBg0h+lBgxe00Zx1AKIh8mprwpypz 670Gru/NBSHAW2St8rAwBkwhmOMquueB07XPAts1xnI7LnL10+vyXdi5qmVPCOFavR18 RIew== X-Gm-Message-State: AOAM533QQ/Vgw7TxxVlKBQf83gRN/Y0DBJ8xWLKUYSP1n+2STbr1X+CK BhOFd8sUIRIQoUTmeljtJb2b9/tGWxI= X-Google-Smtp-Source: ABdhPJwbeiH/FbsMzf0DLZn3xzDIE27D7Fp98IAHOOk6uvvlj+ejV3B6rM4Bexr2VuLzlNMmXliRGQ== X-Received: by 2002:adf:f252:0:b0:20d:76e:99bb with SMTP id b18-20020adff252000000b0020d076e99bbmr6371372wrp.647.1652726462509; Mon, 16 May 2022 11:41:02 -0700 (PDT) Received: from localhost ([2001:8a0:f924:2600:209d:85e2:409e:8726]) by smtp.gmail.com with ESMTPSA id l31-20020a05600c1d1f00b003942a244ecesm57171wms.19.2022.05.16.11.41.01 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 16 May 2022 11:41:01 -0700 (PDT) From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH 14/23] Make exception_catchpoint inherit base_breakpoint instead of catchpoint Date: Mon, 16 May 2022 19:40:21 +0100 Message-Id: <20220516184030.665489-15-pedro@palves.net> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220516184030.665489-1-pedro@palves.net> References: <20220516184030.665489-1-pedro@palves.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 May 2022 18:41:04 -0000 exception_catchpoint is really a code breakpoint, with locations set by sals, re-set like other code breakpoints, etc., so make it inherit base_breakpoint. This adds a bit of duplicated code to exception_catchpoint's ctor (copied from struct catchpoint's ctor), but it will be eliminated in a following patch. Change-Id: I9fbb2927491120e9744a4f5e5cb5e6870ca07009 --- gdb/break-catch-throw.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/gdb/break-catch-throw.c b/gdb/break-catch-throw.c index f15fa531519..90fc3e6d325 100644 --- a/gdb/break-catch-throw.c +++ b/gdb/break-catch-throw.c @@ -63,15 +63,17 @@ static const struct exception_names exception_functions[] = { "-probe-stap libstdcxx:catch", "__cxa_begin_catch" } }; -/* The type of an exception catchpoint. */ +/* The type of an exception catchpoint. Unlike most catchpoints, this + one is implemented with code breakpoints, so it inherits struct + base_breakpoint, not struct catchpoint. */ -struct exception_catchpoint : public catchpoint +struct exception_catchpoint : public base_breakpoint { exception_catchpoint (struct gdbarch *gdbarch, - bool temp, const char *cond_string, + bool temp, const char *cond_string_, enum exception_event_kind kind_, std::string &&except_rx) - : catchpoint (gdbarch, temp, cond_string), + : base_breakpoint (gdbarch, bp_catchpoint), kind (kind_), exception_rx (std::move (except_rx)), pattern (exception_rx.empty () @@ -79,6 +81,12 @@ struct exception_catchpoint : public catchpoint : new compiled_regex (exception_rx.c_str (), REG_NOSUB, _("invalid type-matching regexp"))) { + if (cond_string_ != nullptr) + cond_string = make_unique_xstrdup (cond_string_); + disposition = temp ? disp_del : disp_donttouch; + + pspace = current_program_space; + re_set (); } void re_set () override; @@ -375,8 +383,6 @@ handle_gnu_v3_exceptions (int tempflag, std::string &&except_rx, (new exception_catchpoint (gdbarch, tempflag, cond_string, ex_event, std::move (except_rx))); - cp->re_set (); - install_breakpoint (0, std::move (cp), 1); } -- 2.36.0