This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Fix length calculation in aarch64_linux_set_debug_regs
- From: Yao Qi <qiyaoltc at gmail dot com>
- To: Simon Marchi <simon dot marchi at ericsson dot com>, gdb-patches at sourceware dot org
- Date: Mon, 2 Nov 2015 16:51:36 +0000
- Subject: Re: [PATCH] Fix length calculation in aarch64_linux_set_debug_regs
- Authentication-results: sourceware.org; auth=none
- References: <1446475684-31936-1-git-send-email-simon dot marchi at ericsson dot com>
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 (éå)