From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 102766 invoked by alias); 1 Oct 2017 04:07:26 -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 102484 invoked by uid 89); 1 Oct 2017 04:07:24 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.0 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=Download X-HELO: gproxy10-pub.mail.unifiedlayer.com Received: from gproxy10-pub.mail.unifiedlayer.com (HELO gproxy10-pub.mail.unifiedlayer.com) (69.89.20.226) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 01 Oct 2017 04:07:22 +0000 Received: from CMOut01 (unknown [10.0.90.82]) by gproxy10.mail.unifiedlayer.com (Postfix) with ESMTP id 9289D140564 for ; Sat, 30 Sep 2017 22:07:21 -0600 (MDT) Received: from box522.bluehost.com ([74.220.219.122]) by CMOut01 with id G47J1w00o2f2jeq0147M7V; Sat, 30 Sep 2017 22:07:21 -0600 X-Authority-Analysis: v=2.2 cv=K4VSJ2eI c=1 sm=1 tr=0 a=GsOEXm/OWkKvwdLVJsfwcA==:117 a=GsOEXm/OWkKvwdLVJsfwcA==:17 a=2JCJgTwv5E4A:10 a=zstS-IiYAAAA:8 a=KMO47auicS4WUuWXaw0A:9 a=4G6NA9xxw8l3yy4pmD5M:22 Received: from 75-166-0-208.hlrn.qwest.net ([75.166.0.208]:43148 helo=pokyo.Home) by box522.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.87) (envelope-from ) id 1dyVWh-002l9R-AM; Sat, 30 Sep 2017 22:06:47 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFA 5/8] Use gdb::byte_vector in load_progress Date: Sun, 01 Oct 2017 04:07:00 -0000 Message-Id: <20171001040643.25162-6-tom@tromey.com> In-Reply-To: <20171001040643.25162-1-tom@tromey.com> References: <20171001040643.25162-1-tom@tromey.com> X-BWhitelist: no X-Exim-ID: 1dyVWh-002l9R-AM X-Source-Sender: 75-166-0-208.hlrn.qwest.net (pokyo.Home) [75.166.0.208]:43148 X-Source-Auth: tom+tromey.com X-Email-Count: 6 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTIyLmJsdWVob3N0LmNvbQ== X-Local-Domain: yes X-SW-Source: 2017-10/txt/msg00006.txt.bz2 This changes load_progress to use gdb::byte_vector, removing a cleanup. 2017-09-30 Tom Tromey * symfile.c (load_progress): Use gdb::byte_vector. --- gdb/ChangeLog | 4 ++++ gdb/symfile.c | 9 ++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index ba841f8..f3faf73 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,9 @@ 2017-09-30 Tom Tromey + * symfile.c (load_progress): Use gdb::byte_vector. + +2017-09-30 Tom Tromey + * mi/mi-main.c (mi_cmd_trace_frame_collected): Remove unused declaration. * printcmd.c (x_command): Remove unused declaration. diff --git a/gdb/symfile.c b/gdb/symfile.c index f6bc378..a741654 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -56,6 +56,7 @@ #include "stack.h" #include "gdb_bfd.h" #include "cli/cli-utils.h" +#include "common/byte-vector.h" #include #include @@ -1942,16 +1943,14 @@ load_progress (ULONGEST bytes, void *untyped_arg) might add a verify_memory() method to the target vector and then use that. remote.c could implement that method using the ``qCRC'' packet. */ - gdb_byte *check = (gdb_byte *) xmalloc (bytes); - struct cleanup *verify_cleanups = make_cleanup (xfree, check); + gdb::byte_vector check (bytes); - if (target_read_memory (args->lma, check, bytes) != 0) + if (target_read_memory (args->lma, check.data (), bytes) != 0) error (_("Download verify read failed at %s"), paddress (target_gdbarch (), args->lma)); - if (memcmp (args->buffer, check, bytes) != 0) + if (memcmp (args->buffer, check.data (), bytes) != 0) error (_("Download verify compare failed at %s"), paddress (target_gdbarch (), args->lma)); - do_cleanups (verify_cleanups); } totals->data_count += bytes; args->lma += bytes; -- 2.9.5