From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-io1-xd35.google.com (mail-io1-xd35.google.com [IPv6:2607:f8b0:4864:20::d35]) by sourceware.org (Postfix) with ESMTPS id 325DF385840F for ; Wed, 24 May 2023 16:37:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 325DF385840F Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com Received: by mail-io1-xd35.google.com with SMTP id ca18e2360f4ac-774942ddfe0so62212739f.2 for ; Wed, 24 May 2023 09:37:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1684946246; x=1687538246; h=to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=n56hcQykSY8IKEACSTY/0nG3sNW6ci7UrUhuQCg675M=; b=Veofq4Rd89HE166KxyJDIXVMiuZzlDDweT34q9bjfcfU8RjpoalHQKOE4V7phWhtZY XZ4u5lkvKLb/kDAjJPIqkMnCz6jyGEvWkr5QQHGoqjslGXJsmsmkDc7p5tfCj24FE2y0 C33A4ldR6CrqKo99+g/dRP0Hqi7/q9dkr/dVcYkEHajj/7ngwaLzYoqezpIUlhbFAuSC DQFXMR8qbUOco0UNjPvVRPxNtIJ9Y/+fqL2Z+JAEwDaPNvYhHLGwmkVNwBoOIVwXM8M4 t15l0LszKZpKsC0bJ5yoN5zZfov8sLZTIMTc7p0NScURYLhOSzL0AHgyG21Wjdf7/8Gi NaOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684946246; x=1687538246; h=to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=n56hcQykSY8IKEACSTY/0nG3sNW6ci7UrUhuQCg675M=; b=RO/xKCt3s8Diu1DsXbSuBqoF/ixLHFV3fUMLG30ADyFpwDz/76HfmDFPD14/HmlPHQ 64sNjJdwet/BF/fCv1JjtZXLznN7Tewrt/yguc1/S9X/GD2radSoWgz+yc7dlqD7qV9Y 4M9OgQVHY1TfrV79NE7O6SKfxSG28YyeyMr8MSz6rFg1B0tiZPncfjkoPNuT1HMHtka0 2w/BGBkPFbpWp87O8YekitLUCExijn2VYLANqK7tXPsTD1bbWOEA+LlClTtNa7DGOeXF xd7b/A84oVEU/7B4CCameJj91TmFCWE8ZrIYalapSPHZTy3Htw/MEqWfsvKvMwwoFRTh EWVA== X-Gm-Message-State: AC+VfDzncLUIplcR3NQCm5OWxnfmjINIspNFkWGx4WpL5VU/7/epLS20 x0guVdxSDshEMPNMOLczAac0WIap/ayXO3FyYToyBA== X-Google-Smtp-Source: ACHHUZ7mZIdbtVq9abQymkwAkg7a2y9pYQfgyPFLFW+lma9yoVetqpmRFK0kYww8wycuBSVWxmo9Gg== X-Received: by 2002:a5d:8ac2:0:b0:766:5445:2690 with SMTP id e2-20020a5d8ac2000000b0076654452690mr12355737iot.14.1684946246419; Wed, 24 May 2023 09:37:26 -0700 (PDT) Received: from localhost.localdomain (71-211-130-244.hlrn.qwest.net. [71.211.130.244]) by smtp.gmail.com with ESMTPSA id o22-20020a6bcf16000000b0076c81bf2731sm3397266ioa.20.2023.05.24.09.37.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 May 2023 09:37:26 -0700 (PDT) From: Tom Tromey Date: Wed, 24 May 2023 10:36:55 -0600 Subject: [PATCH 04/25] Transfer ownership of exception string to ada_catchpoint MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20230427-ada-catch-exception-v1-4-947caa9905e3@adacore.com> References: <20230427-ada-catch-exception-v1-0-947caa9905e3@adacore.com> In-Reply-To: <20230427-ada-catch-exception-v1-0-947caa9905e3@adacore.com> To: gdb-patches@sourceware.org X-Mailer: b4 0.12.2 X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,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 List-Id: This changes the ada_catchpoint to require an rvalue ref, so that ownership of the exception string can be transferred to the catchpoint object. --- gdb/ada-lang.c | 16 +++++++++------- gdb/ada-lang.h | 2 +- gdb/mi/mi-cmd-catch.c | 4 ++-- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 50eea4860ba..374cec57090 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -12139,8 +12139,10 @@ struct ada_catchpoint : public code_breakpoint const char *addr_string_, bool tempflag, bool enabled, - bool from_tty) + bool from_tty, + std::string &&excep_string_) : code_breakpoint (gdbarch_, bp_catchpoint, tempflag), + excep_string (std::move (excep_string_)), m_kind (kind) { add_location (sal); @@ -12807,7 +12809,7 @@ ada_exception_sal (enum ada_exception_catchpoint_kind ex, void create_ada_exception_catchpoint (struct gdbarch *gdbarch, enum ada_exception_catchpoint_kind ex_kind, - const std::string &excep_string, + std::string &&excep_string, const std::string &cond_string, int tempflag, int enabled, @@ -12818,8 +12820,8 @@ create_ada_exception_catchpoint (struct gdbarch *gdbarch, std::unique_ptr c (new ada_catchpoint (gdbarch, ex_kind, sal, addr_string.c_str (), - tempflag, enabled, from_tty)); - c->excep_string = excep_string; + tempflag, enabled, from_tty, + std::move (excep_string))); create_excep_cond_exprs (c.get (), ex_kind); if (!cond_string.empty ()) set_breakpoint_condition (c.get (), cond_string.c_str (), from_tty, false); @@ -12846,7 +12848,7 @@ catch_ada_exception_command (const char *arg_entry, int from_tty, catch_ada_exception_command_split (arg, false, &ex_kind, &excep_string, &cond_string); create_ada_exception_catchpoint (gdbarch, ex_kind, - excep_string, cond_string, + std::move (excep_string), cond_string, tempflag, 1 /* enabled */, from_tty); } @@ -12871,7 +12873,7 @@ catch_ada_handlers_command (const char *arg_entry, int from_tty, catch_ada_exception_command_split (arg, true, &ex_kind, &excep_string, &cond_string); create_ada_exception_catchpoint (gdbarch, ex_kind, - excep_string, cond_string, + std::move (excep_string), cond_string, tempflag, 1 /* enabled */, from_tty); } @@ -12938,7 +12940,7 @@ catch_assert_command (const char *arg_entry, int from_tty, arg = ""; catch_ada_assert_command_split (arg, cond_string); create_ada_exception_catchpoint (gdbarch, ada_catch_assert, - "", cond_string, + {}, cond_string, tempflag, 1 /* enabled */, from_tty); } diff --git a/gdb/ada-lang.h b/gdb/ada-lang.h index f5bb54c7d36..08620d7ed7c 100644 --- a/gdb/ada-lang.h +++ b/gdb/ada-lang.h @@ -341,7 +341,7 @@ extern const char *ada_main_name (); extern void create_ada_exception_catchpoint (struct gdbarch *gdbarch, enum ada_exception_catchpoint_kind ex_kind, - const std::string &excep_string, const std::string &cond_string, int tempflag, + std::string &&excep_string, const std::string &cond_string, int tempflag, int enabled, int from_tty); /* Return true if BP is an Ada catchpoint. */ diff --git a/gdb/mi/mi-cmd-catch.c b/gdb/mi/mi-cmd-catch.c index 082703740af..dcd48a84a5d 100644 --- a/gdb/mi/mi-cmd-catch.c +++ b/gdb/mi/mi-cmd-catch.c @@ -153,7 +153,7 @@ mi_cmd_catch_exception (const char *cmd, char *argv[], int argc) scoped_restore restore_breakpoint_reporting = setup_breakpoint_reporting (); create_ada_exception_catchpoint (gdbarch, ex_kind, - exception_name, + std::move (exception_name), condition, temp, enabled, 0); } @@ -217,7 +217,7 @@ mi_cmd_catch_handlers (const char *cmd, char *argv[], int argc) scoped_restore restore_breakpoint_reporting = setup_breakpoint_reporting (); create_ada_exception_catchpoint (gdbarch, ada_catch_handlers, - exception_name, + std::move (exception_name), condition, temp, enabled, 0); } -- 2.40.0