From patchwork Thu Nov 2 22:36:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 24054 Received: (qmail 7965 invoked by alias); 2 Nov 2017 22:36:24 -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 7373 invoked by uid 89); 2 Nov 2017 22:36:21 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No 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=longest, Hx-languages-length:1649, rfa X-HELO: gateway31.websitewelcome.com Received: from gateway31.websitewelcome.com (HELO gateway31.websitewelcome.com) (192.185.144.95) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 02 Nov 2017 22:36:19 +0000 Received: from cm14.websitewelcome.com (cm14.websitewelcome.com [100.42.49.7]) by gateway31.websitewelcome.com (Postfix) with ESMTP id C913B197A2F for ; Thu, 2 Nov 2017 17:36:17 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id AO5xeT2VTHEImAO5xeYsFa; Thu, 02 Nov 2017 17:36:17 -0500 Received: from 71-218-90-63.hlrn.qwest.net ([71.218.90.63]:58978 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89) (envelope-from ) id 1eAO5x-003CfJ-JK; Thu, 02 Nov 2017 17:36:17 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFA 09/13] Use gdb::def_vector in ppc-linux-tdep.c Date: Thu, 2 Nov 2017 16:36:08 -0600 Message-Id: <20171102223612.3642-10-tom@tromey.com> In-Reply-To: <20171102223612.3642-1-tom@tromey.com> References: <20171102223612.3642-1-tom@tromey.com> X-BWhitelist: no X-Source-L: No X-Exim-ID: 1eAO5x-003CfJ-JK X-Source-Sender: 71-218-90-63.hlrn.qwest.net (bapiya.Home) [71.218.90.63]:58978 X-Source-Auth: tom+tromey.com X-Email-Count: 10 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes This removes a cleanup from ppc-linux-tdep.c, replacing it with gdb::def_vector. gdb/ChangeLog 2017-11-02 Tom Tromey * ppc-linux-tdep.c (ppc_linux_get_syscall_number): Use gdb::def_vector. --- gdb/ChangeLog | 5 +++++ gdb/ppc-linux-tdep.c | 13 ++++--------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c index 847908a6da..4d10a24ca9 100644 --- a/gdb/ppc-linux-tdep.c +++ b/gdb/ppc-linux-tdep.c @@ -725,26 +725,21 @@ ppc_linux_get_syscall_number (struct gdbarch *gdbarch, struct regcache *regcache = get_thread_regcache (ptid); struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); - struct cleanup *cleanbuf; - /* The content of a register */ - gdb_byte *buf; /* The result */ LONGEST ret; /* Make sure we're in a 32- or 64-bit machine */ gdb_assert (tdep->wordsize == 4 || tdep->wordsize == 8); - buf = (gdb_byte *) xmalloc (tdep->wordsize * sizeof (gdb_byte)); - - cleanbuf = make_cleanup (xfree, buf); + /* The content of a register */ + gdb::def_vector buf (tdep->wordsize); /* Getting the system call number from the register. When dealing with PowerPC architecture, this information is stored at 0th register. */ - regcache_cooked_read (regcache, tdep->ppc_gp0_regnum, buf); + regcache_cooked_read (regcache, tdep->ppc_gp0_regnum, buf.data ()); - ret = extract_signed_integer (buf, tdep->wordsize, byte_order); - do_cleanups (cleanbuf); + ret = extract_signed_integer (buf.data (), tdep->wordsize, byte_order); return ret; }