From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13191 invoked by alias); 3 Nov 2017 01:25:52 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 13045 invoked by uid 89); 3 Nov 2017 01:25:52 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.9 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: smtp.polymtl.ca Received: from smtp.polymtl.ca (HELO smtp.polymtl.ca) (132.207.4.11) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 03 Nov 2017 01:25:51 +0000 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id vA31Pi0u015300 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 2 Nov 2017 21:25:49 -0400 Received: by simark.ca (Postfix, from userid 112) id 875A11E526; Thu, 2 Nov 2017 21:25:44 -0400 (EDT) Received: from simark.ca (localhost [127.0.0.1]) by simark.ca (Postfix) with ESMTP id 334CF1E4C4; Thu, 2 Nov 2017 21:25:34 -0400 (EDT) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Fri, 03 Nov 2017 01:25:00 -0000 From: Simon Marchi To: Tom Tromey Cc: gdb-patches@sourceware.org Subject: Re: [RFA 07/13] Use gdb::def_vector in sparc64-tdep.c In-Reply-To: <20171102223612.3642-8-tom@tromey.com> References: <20171102223612.3642-1-tom@tromey.com> <20171102223612.3642-8-tom@tromey.com> Message-ID: <1cdab7f9cb24473379526465f490770b@polymtl.ca> X-Sender: simon.marchi@polymtl.ca User-Agent: Roundcube Webmail/1.3.2 X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Fri, 3 Nov 2017 01:25:44 +0000 X-IsSubscribed: yes X-SW-Source: 2017-11/txt/msg00059.txt.bz2 On 2017-11-02 18:36, Tom Tromey wrote: > This removes a cleanup from sparc64-tdep.c, replacing it with > gdb::def_vector. > > gdb/ChangeLog > 2017-11-02 Tom Tromey > > * sparc64-tdep.c (do_examine): Use gdb::def_vector. > --- > gdb/ChangeLog | 4 ++++ > gdb/sparc64-tdep.c | 10 +++------- > 2 files changed, 7 insertions(+), 7 deletions(-) > > diff --git a/gdb/sparc64-tdep.c b/gdb/sparc64-tdep.c > index a756834cba..eebfbdf96f 100644 > --- a/gdb/sparc64-tdep.c > +++ b/gdb/sparc64-tdep.c > @@ -415,21 +415,17 @@ static void > do_examine (CORE_ADDR start, int bcnt) > { > CORE_ADDR vaddr = adi_normalize_address (start); > - struct cleanup *cleanup; > > CORE_ADDR vstart = adi_align_address (vaddr); > int cnt = adi_convert_byte_count (vaddr, bcnt, vstart); > - unsigned char *buf = (unsigned char *) xmalloc (cnt); > - cleanup = make_cleanup (xfree, buf); > - int read_cnt = adi_read_versions (vstart, cnt, buf); > + gdb::def_vector buf (cnt); > + int read_cnt = adi_read_versions (vstart, cnt, buf.data ()); > if (read_cnt == -1) > error (_("No ADI information")); > else if (read_cnt < cnt) > error(_("No ADI information at %s"), paddress (target_gdbarch (), > vaddr)); > > - adi_print_versions (vstart, cnt, buf); > - > - do_cleanups (cleanup); > + adi_print_versions (vstart, cnt, buf.data ()); > } > > static void It seems to me like the code doesn't use this as text, but binary data. So it should probably have used gdb_byte in the first place. I would then suggest using gdb::byte_vector (if you agree that gdb_byte should be used here). Simon