From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 125726 invoked by alias); 2 Nov 2015 16:51: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 125711 invoked by uid 89); 2 Nov 2015 16:51:45 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-pa0-f46.google.com Received: from mail-pa0-f46.google.com (HELO mail-pa0-f46.google.com) (209.85.220.46) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Mon, 02 Nov 2015 16:51:44 +0000 Received: by padec8 with SMTP id ec8so44411132pad.1 for ; Mon, 02 Nov 2015 08:51:42 -0800 (PST) X-Received: by 10.66.90.198 with SMTP id by6mr28091448pab.78.1446483102736; Mon, 02 Nov 2015 08:51:42 -0800 (PST) Received: from [127.0.0.1] (gcc2-power8.osuosl.org. [140.211.9.43]) by smtp.gmail.com with ESMTPSA id ij3sm24934393pbb.62.2015.11.02.08.51.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 02 Nov 2015 08:51:42 -0800 (PST) Subject: Re: [PATCH] Fix length calculation in aarch64_linux_set_debug_regs To: Simon Marchi , gdb-patches@sourceware.org References: <1446475684-31936-1-git-send-email-simon.marchi@ericsson.com> From: Yao Qi Message-ID: <56379498.1040109@gmail.com> Date: Mon, 02 Nov 2015 16:51:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <1446475684-31936-1-git-send-email-simon.marchi@ericsson.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2015-11/txt/msg00013.txt.bz2 Hi Simon, On 02/11/15 14:48, Simon Marchi wrote: > From what I understand, the dbg_regs array in the user_hwdebug_state structure > is 16 elements long, but we don't use all of them. We want iov_len to reflect > only the used bytes. If that's true, I don't think that the current code is > correct. Instead, it can be computed simply with: Your understand is correct, but the code is correct too. > > offsetof (struct user_hwdebug_state, dbg_regs) + count * sizeof (regs.dbg_reg[0]); > Your code must get the same value as the old code does. > Does it make sense? Yes, but I think Pedro's suggestion is better. -- Yao (齐尧)