From: Marcus Shawcroft <marcus.shawcroft@gmail.com>
To: pinskia@gmail.com
Cc: Yufeng Zhang <Yufeng.Zhang@arm.com>,
"gdb-patches@sourceware.org" <gdb-patches@sourceware.org>,
Marcus Shawcroft <Marcus.Shawcroft@arm.com>
Subject: Re: [PATCH, AArch64] Fix bug in hardware watchpoint/breakpoint handling
Date: Thu, 19 Dec 2013 10:16:00 -0000 [thread overview]
Message-ID: <CAFqB+PyUfWodaTX=jam=dE6ZzE4goj8n4xfc52AsvvMNaj4y+w@mail.gmail.com> (raw)
In-Reply-To: <430CEAB7-7F7B-430D-9C37-75F87D1F65AC@gmail.com>
On 19 December 2013 07:00, <pinskia@gmail.com> wrote:
> I think this patch is wrong as the size that is passed is always just one element as sizeof (regs.dbg_regs [count - 1]) is the same as sizeof (regs.dbg_regs [0]). This should have been sizeof (regs.dbg_regs [0])*count instead.
+ iov.iov_len = (offsetof (struct user_hwdebug_state, dbg_regs[count - 1])
+ + sizeof (regs.dbg_regs [count - 1]));
The offsetof() gives the number of bytes from the start of
user_hwdebug_state upto and including all of the reg array bar the
last in use entry. Adding on the sizeof() therefore gives the number
of bytes from the start of the structure upto and including the last
in use reg entry.
I agree that the sizeof() could be written either with dbg_regs[0] or
dbg_regs[count-1] with no change in behavior. But I think Yufengs
code is functionally correct.
It would have been simpler to write:
iov.iov_len = (offsetof (struct user_hwdebug_state, dbg_regs[count])
.. but I think that is illegal when count equals the number of
elements defined in the array.
Cheers
/Marcus
next prev parent reply other threads:[~2013-12-19 10:16 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-18 16:07 Yufeng Zhang
2013-12-18 16:24 ` Pedro Alves
2013-12-19 7:00 ` pinskia
2013-12-19 10:16 ` Marcus Shawcroft [this message]
2013-12-19 10:23 ` pinskia
2013-12-19 10:26 ` Marcus Shawcroft
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAFqB+PyUfWodaTX=jam=dE6ZzE4goj8n4xfc52AsvvMNaj4y+w@mail.gmail.com' \
--to=marcus.shawcroft@gmail.com \
--cc=Marcus.Shawcroft@arm.com \
--cc=Yufeng.Zhang@arm.com \
--cc=gdb-patches@sourceware.org \
--cc=pinskia@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox