static DWORD64
win32_get_current_dr (int dr)
{
  win32_thread_info *th = inferior_target_data (current_thread);

  win32_require_context (th);

#define RET_DR(DR)				\
  case DR:					\
    return th->context.Dr ## DR

  switch (dr)
    {
      RET_DR (0);
      RET_DR (1);
      RET_DR (2);
      RET_DR (3);
      RET_DR (6);
      RET_DR (7);
    }

#undef RET_DR

  gdb_assert_not_reached ("unhandled dr");
}
Esempio n. 2
0
/* Find a thread record given a thread id.  If GET_CONTEXT is set then
   also retrieve the context for this thread.  */
static win32_thread_info *
thread_rec (ptid_t ptid, int get_context)
{
  struct thread_info *thread;
  win32_thread_info *th;

  thread = (struct thread_info *) find_inferior_id (&all_threads, ptid);
  if (thread == NULL)
    return NULL;

  th = inferior_target_data (thread);
  if (get_context)
    win32_require_context (th);
  return th;
}
static void
i386_prepare_to_resume (win32_thread_info *th)
{
  if (th->debug_registers_changed)
    {
      struct x86_debug_reg_state *dr = &debug_reg_state;

      win32_require_context (th);

      th->context.Dr0 = dr->dr_mirror[0];
      th->context.Dr1 = dr->dr_mirror[1];
      th->context.Dr2 = dr->dr_mirror[2];
      th->context.Dr3 = dr->dr_mirror[3];
      /* th->context.Dr6 = dr->dr_status_mirror;
	 FIXME: should we set dr6 also ?? */
      th->context.Dr7 = dr->dr_control_mirror;

      th->debug_registers_changed = 0;
    }
}