This is the mail archive of the mailing list for the GDB project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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

Thanks again for the test.

I'm wondering why bother to mask out DR_STATUS bits instead
of clearing all of it.  I mean, when we set a watchpoint, we're
already clobbering the whole of DR_CONTROL, with

  i386_dr_low.set_control (new_state->dr_control_mirror);

so it seems there's no point in trying to retain all the other
bits of DR_STATUS.  If we set a watchpoint, any change the
inferior had done itself to the debug registers is thrown
out the window.

If I change amd64_linux_prepare_to_resume to look like:

static void
amd64_linux_prepare_to_resume (struct lwp_info *lwp)
  int clear_status = 0;

  if (lwp->arch_private->debug_registers_changed)
      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]);

	    /* Only a sanity check for leftover bits (set possibly
	       only by inferior).  */
	    clear_status = 1;

      amd64_linux_dr_set (lwp->ptid, DR_CONTROL, state->dr_control_mirror);

      lwp->arch_private->debug_registers_changed = 0;

  if (clear_status || lwp->stopped_by_watchpoint)
    amd64_linux_dr_set (lwp->ptid, DR_STATUS, 0);

(the `clear_status' bits are new) then the new test passes.

I'm doing a full run with this now.

Pedro Alves

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]