This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: Regression for watchpoint-fork.exp [Re: [PATCH v3 2/5] PR breakpoints/7143 - Watchpoint does not trigger when first set]
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: Pedro Alves <palves at redhat dot com>
- Cc: Doug Evans <xdje42 at gmail dot com>, "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Thu, 19 Jun 2014 19:00:29 +0200
- Subject: Re: Regression for watchpoint-fork.exp [Re: [PATCH v3 2/5] PR breakpoints/7143 - Watchpoint does not trigger when first set]
- Authentication-results: sourceware.org; auth=none
- References: <1394154640-14053-1-git-send-email-palves at redhat dot com> <1394154640-14053-3-git-send-email-palves at redhat dot com> <CAP9bCMTj+A2B6cvwYKC2vjL1Si+yGBKXvQfCMNR0SYN19KztXg at mail dot gmail dot com> <53272CB0 dot 6050101 at redhat dot com> <532AF3D0 dot 8090904 at redhat dot com> <20140617191850 dot GA10997 at host2 dot jankratochvil dot net> <20140619134330 dot GA14567 at host2 dot jankratochvil dot net> <53A2FB68 dot 9090500 at redhat dot com> <53A3164E dot 4020109 at redhat dot com>
On Thu, 19 Jun 2014 18:56:46 +0200, Pedro Alves wrote:
> On 06/19/2014 04:02 PM, Pedro Alves wrote:
>
> >> Attaching gzipped gdb.threads/watchpoint-fork-parent-st
> >> from gcc-4.9.0-9.fc21.x86_64.
> >
> > Thanks, I can reproduce it.
>
> Hmm, I suspect this might be related to kernel-side validation
> of DR_CONTROL vs DR0-3, like what we already handle in amd64_linux_prepare_to_resume.
> And indeed this below makes the error go away. Not exactly sure why yet.
Because there is a data watchpoint of size 4 bytes at that DRx slot and it is
being updated by that 'hbreak' unaligned watchpoint (after the data watchpoint
is no longer valid).
But DR_CONTROL is updated only afterwards.
Your patch seems to be right.
Thanks,
Jan
>
> diff --git c/gdb/amd64-linux-nat.c w/gdb/amd64-linux-nat.c
> index 06199af..5972415 100644
> --- c/gdb/amd64-linux-nat.c
> +++ w/gdb/amd64-linux-nat.c
> @@ -415,6 +415,8 @@ amd64_linux_prepare_to_resume (struct lwp_info *lwp)
>
> Ensure DR_CONTROL gets written as the very last register here. */
>
> + amd64_linux_dr_set (lwp->ptid, DR_CONTROL, 0);
> +
> for (i = DR_FIRSTADDR; i <= DR_LASTADDR; i++)
> if (state->dr_ref_count[i] > 0)
> {
>
> --
> Pedro Alves