From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) by sourceware.org (Postfix) with ESMTPS id EC37C3856DE8 for ; Mon, 16 May 2022 18:40:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org EC37C3856DE8 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-wm1-f42.google.com with SMTP id o12-20020a1c4d0c000000b00393fbe2973dso102126wmh.2 for ; Mon, 16 May 2022 11:40:44 -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=dmnl+zIXSSzIrsUFkl5fZmhjLC3M2watQkdUeSGUtxQ=; b=V8U6jkiMnaBD5wj+DeiJAey6Pif44Nj1yXgCFgMdRf2cwvXsYu0xlXl4ML3qf/8CPP 0tF46bWcqrPk4pTU5u9BVAWgKjGhQexpuOwXW4Ku0EO6XWS25Z+WqoV8BFW8oB7zPE9X qDoHX6RP6C8m0gz0uthhnWg4wynSJ97EcFYHNj4qnhM54OV4klqwWAzrrpTT1mHdtLJQ JgB+0JeGftYkqLcSgzinnNL20ac2KvlkZnChoYhC4LSA08ytlJslsZ5aooD7AHiQ5qF8 ytb80tGIwy58oKqBjd06Ce4u37r/SsOERQhCMAQ2QZ2rB4YhRzew53fqMVjSNU9Iu/Ui UPUQ== X-Gm-Message-State: AOAM532O/CWIv7oV7LcOzjANalCYml8yqRf8VgvAznvojAW363H/Lxz4 UY/ZuClj6vs/m5A6sbdqMhcvzr1b7FQ= X-Google-Smtp-Source: ABdhPJxzVUR4uQ1B3udDizkcmTRtaYqsLJQ+pk8IEjFbbPE7WxEcjpLeYyP//rwZ1N9tPwcUwZf9SQ== X-Received: by 2002:a05:600c:6005:b0:394:7ba4:5e62 with SMTP id az5-20020a05600c600500b003947ba45e62mr28851992wmb.25.1652726443538; Mon, 16 May 2022 11:40:43 -0700 (PDT) Received: from localhost ([2001:8a0:f924:2600:209d:85e2:409e:8726]) by smtp.gmail.com with ESMTPSA id d7-20020adfc807000000b0020c5253d8e4sm10023651wrh.48.2022.05.16.11.40.42 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 16 May 2022 11:40:42 -0700 (PDT) From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH 05/23] ranged_breakpoint - move initialization to ctor Date: Mon, 16 May 2022 19:40:12 +0100 Message-Id: <20220516184030.665489-6-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:40:46 -0000 Move initialization of ranged_breakpoint's fields to its ctor. Change-Id: If7b842861f3cc6a429ea329d45598b5852283ba3 --- 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 = add_location (sal_start); + bl->length = length; + + disposition = disp_donttouch; + + location = std::move (start_location); + location_range_end = std::move (end_location); } int breakpoint_hit (const struct bp_location *bl, @@ -9436,13 +9447,13 @@ break_range_command (const char *arg, int from_tty) return; } - /* Now set up the breakpoint. */ - std::unique_ptr br (new ranged_breakpoint (get_current_arch ())); - br->add_location (sal_start); - br->disposition = disp_donttouch; - br->location = std::move (start_location); - br->location_range_end = std::move (end_location); - br->loc->length = 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))); install_breakpoint (false, std::move (br), true); } -- 2.36.0