This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH, AArch64] Fix bug in hardware watchpoint/breakpoint handling
- From: pinskia at gmail dot com
- To: Yufeng Zhang <Yufeng dot Zhang at arm dot com>
- Cc: "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>, Marcus Shawcroft <Marcus dot Shawcroft at arm dot com>
- Date: Wed, 18 Dec 2013 23:00:32 -0800
- Subject: Re: [PATCH, AArch64] Fix bug in hardware watchpoint/breakpoint handling
- Authentication-results: sourceware.org; auth=none
- References: <52B1C84F dot 4000102 at arm dot com>
> On Dec 18, 2013, at 8:07 AM, Yufeng Zhang <Yufeng.Zhang@arm.com> wrote:
>
> Hi,
>
> This patch fixes an AArch64 GDB bug in handling the hardware debug registers. GDB calls ptrace to set hardware debug registers and it passes a full-length "struct user_hwdebug_state" variable regardless of the number of hardware debug registers available on a target. When there are fewer than 16 (the maximum number) hardware breakpoint/watchpoint registers on a target, the kernel will complain about the gdb's request to set non-existing hardware debug registers. There will be an warning of "Unexpected error setting hardware debug registers" when the inferior starts to run.
>
> This patch fixes the issue by setting iov.iov_len with a value reflecting the exact size in use.
>
> OK for the mainline?
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.
Thanks,
Andrew Pinski
>
> Thanks.
> Yufeng
>
>
> gdb/
>
> * aarch64-linux-nat.c (aarch64_linux_set_debug_regs): Set
> iov.iov_len with the real length in use.
>
> gdb/gdbserver/
>
> * linux-aarch64-low.c (aarch64_linux_set_debug_regs): Set
> iov.iov_len with the real length in use.
> <patch>