From patchwork Wed Jul 11 14:15:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 28312 Received: (qmail 23004 invoked by alias); 11 Jul 2018 14:15:59 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 22983 invoked by uid 89); 11 Jul 2018 14:15:58 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.6 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=Format, UD:infrun.c, infrun.c, infrunc X-HELO: gateway22.websitewelcome.com Received: from gateway22.websitewelcome.com (HELO gateway22.websitewelcome.com) (192.185.46.187) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 11 Jul 2018 14:15:56 +0000 Received: from cm15.websitewelcome.com (cm15.websitewelcome.com [100.42.49.9]) by gateway22.websitewelcome.com (Postfix) with ESMTP id C17608ACE for ; Wed, 11 Jul 2018 09:15:54 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id dFuMfuIk2bXuJdFuMf3K75; Wed, 11 Jul 2018 09:15:54 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=52r86wPhBNBPrFfZFngwNabhAHWVI5CEadqz6EPfDlY=; b=NiP7IxoPYygDsMXhfv+u3YbGdj tReUqWqRTxg0rIcFejS0P5ykomtjK3tLcEf9RWO8ZjZOCjt/KqRXG8ZrCOGxNle044NxytaSp6b8W /0dtddJfeEFCqTF7yQ4Y0ax2T; Received: from 75-166-85-72.hlrn.qwest.net ([75.166.85.72]:49352 helo=pokyo.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91) (envelope-from ) id 1fdFuM-000rOq-JF; Wed, 11 Jul 2018 09:15:54 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFA 1/5] Use new and delete for struct infcall_suspend_state Date: Wed, 11 Jul 2018 08:15:48 -0600 Message-Id: <20180711141552.10136-2-tom@tromey.com> In-Reply-To: <20180711141552.10136-1-tom@tromey.com> References: <20180711141552.10136-1-tom@tromey.com> This changes infrun.c to use new and delete for infcall_suspend_state. This enables the coming cleanups. gdb/ChangeLog 2018-07-11 Tom Tromey * infrun.c (struct infcall_suspend_state): Add initializers. (save_infcall_suspend_state): Use new. (discard_infcall_suspend_state): Use delete. --- gdb/ChangeLog | 6 ++++++ gdb/infrun.c | 12 ++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 7c74c87d8c5..8c0d7b5f6a9 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2018-07-11 Tom Tromey + + * infrun.c (struct infcall_suspend_state): Add initializers. + (save_infcall_suspend_state): Use new. + (discard_infcall_suspend_state): Use delete. + 2018-07-11 Alan Hayward * target-descriptions.c (tdesc_register_bitsize): Rename. diff --git a/gdb/infrun.c b/gdb/infrun.c index dd7e69e718e..da71f3132a0 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -8810,18 +8810,18 @@ siginfo_make_value (struct gdbarch *gdbarch, struct internalvar *var, struct infcall_suspend_state { - struct thread_suspend_state thread_suspend; + struct thread_suspend_state thread_suspend {}; /* Other fields: */ - readonly_detached_regcache *registers; + readonly_detached_regcache *registers = nullptr; /* Format of SIGINFO_DATA or NULL if it is not present. */ - struct gdbarch *siginfo_gdbarch; + struct gdbarch *siginfo_gdbarch = nullptr; /* The inferior format depends on SIGINFO_GDBARCH and it has a length of TYPE_LENGTH (gdbarch_get_siginfo_type ()). For different gdbarch the content would be invalid. */ - gdb_byte *siginfo_data; + gdb_byte *siginfo_data = nullptr; }; struct infcall_suspend_state * @@ -8853,7 +8853,7 @@ save_infcall_suspend_state (void) } } - inf_state = XCNEW (struct infcall_suspend_state); + inf_state = new struct infcall_suspend_state; if (siginfo_data) { @@ -8919,7 +8919,7 @@ discard_infcall_suspend_state (struct infcall_suspend_state *inf_state) { delete inf_state->registers; xfree (inf_state->siginfo_data); - xfree (inf_state); + delete inf_state; } readonly_detached_regcache *