From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 109137 invoked by alias); 12 Jun 2017 11:05:46 -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 109125 invoked by uid 89); 12 Jun 2017 11:05:45 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=H*r:sk:static. X-HELO: mail-it0-f41.google.com Received: from mail-it0-f41.google.com (HELO mail-it0-f41.google.com) (209.85.214.41) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 12 Jun 2017 11:05:44 +0000 Received: by mail-it0-f41.google.com with SMTP id l6so10327200iti.1 for ; Mon, 12 Jun 2017 04:05:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=1q+TPIzPmZo/sbDR8++n3WZu6ows35vlGyNuWIGa8c0=; b=YOgVwn2MlCCT6G7K5nCSLGMB4ogNx5aoO+PH3rzpXAS0n4i7gUkROG97dodBSp3pps w4p6Upxi61tLC4MPI4S5T47efRus0PQhl3TEzsSC5A7VPlpGiXwZDSfckHATby0T6CM/ 1R4Ycq2hS1ns514nn+egHc1WbzZFsm/McWDjTAFrk2ixZ/wxa0A2N9ESi8KSkJSKj5qI JAf6VSAEMAxIjFuWDeAj4DU4mcuoxY1UnwKbPXW6y5TORKPOAASysl37Z2SVbFhuNFyn s5CaSJbWs29i4v3XFjrA0uS9rKqMMLLzqujyJvdQeWCGsrBHUG1iq5oQHBXhoaFxLA3f SAuA== X-Gm-Message-State: AODbwcBFM/+r2c9NNm1ogDRlJNVKBcTQVlcZSe7m3MtSq4zHUf6HugF5 3GCJeqC5MeOvww== X-Received: by 10.36.110.23 with SMTP id w23mr10804877itc.24.1497265547646; Mon, 12 Jun 2017 04:05:47 -0700 (PDT) Received: from E107787-LIN (static.42.136.251.148.clients.your-server.de. [148.251.136.42]) by smtp.gmail.com with ESMTPSA id z191sm4462676iod.59.2017.06.12.04.05.46 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Mon, 12 Jun 2017 04:05:47 -0700 (PDT) From: Yao Qi To: Alan Hayward Cc: "gdb-patches\@sourceware.org" , nd Subject: Re: [PATCH] Remove an instance of MAX_REGISTER_SIZE from record-full.c References: <69EEE46A-D88C-4B4F-86A2-E35F6DAFD90A@arm.com> Date: Mon, 12 Jun 2017 11:05:00 -0000 In-Reply-To: <69EEE46A-D88C-4B4F-86A2-E35F6DAFD90A@arm.com> (Alan Hayward's message of "Mon, 12 Jun 2017 09:34:30 +0000") Message-ID: <86d1a9a2k9.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2017-06/txt/msg00304.txt.bz2 Alan Hayward writes: > - regcache_cooked_read (regcache, entry->u.reg.num, reg); > - regcache_cooked_write (regcache, entry->u.reg.num, > - record_full_get_loc (entry)); > - memcpy (record_full_get_loc (entry), reg, entry->u.reg.len); The original code is about swapping contents of register REG in regcache and record_full_get_loc (entry), and the length is known entry->u.reg.len. > + value =3D regcache->cooked_read_value (entry->u.reg.num); > + gdb_assert (value !=3D NULL); > + regcache->cooked_write (entry->u.reg.num, record_full_get_loc (entry)); > + memcpy (record_full_get_loc (entry), value_contents_all (value), > + entry->u.reg.len); > + release_value (value); > + value_free (value); It is a overkill to use value to swap these two buffers, IMO. How about xmalloc "reg" instead? --=20 Yao (=E9=BD=90=E5=B0=A7)