Re: [PATCH] PR threads/10729: x86 hw watchpoints and non-stop mode

Jan Kratochvil
2011-12-13T21:38:14Z

On Tue, 13 Dec 2011 17:26:03 +0100, Pedro Alves wrote:
> +amd64_linux_prepare_to_resume (struct lwp_info *lwp)
> {
> - struct lwp_info *lp;
> + int clear_status = 0;
>
> - ALL_LWPS (lp)
> + if (lwp->arch_private->debug_registers_changed)
> {
> - unsigned long value;
> -
> - value = amd64_linux_dr_get (lp->ptid, DR_STATUS);
> - value &= ~mask;
> - amd64_linux_dr_set (lp->ptid, DR_STATUS, value);
> + struct i386_debug_reg_state *state = i386_debug_reg_state ();
> + int i;
> +
> + for (i = DR_FIRSTADDR; i <= DR_LASTADDR; i++)
> + if (state->dr_ref_count[i] > 0)
> + {
> + amd64_linux_dr_set (lwp->ptid, i, state->dr_mirror[i]);

FYI this way it will leave non-zero DR_FIRSTADDR...DR_LASTADDR after detaching
from the inferior. This is not a bug, just that it may look as a sort of
regression. I do not think a fix - clearing them - is required.

Thanks,
Jan