예제 #1
0
파일: mem-break.c 프로젝트: dbl001/binutils
int
delete_gdb_breakpoint (char z_type, CORE_ADDR addr, int size)
{
  int ret;

  if (!check_gdb_bp_preconditions (z_type, &ret))
    return ret;

  /* If inserting a software/memory breakpoint, need to prepare to
     access memory.  */
  if (z_type == Z_PACKET_SW_BP)
    {
      int err;

      err = prepare_to_access_memory ();
      if (err != 0)
	return -1;
    }

  ret = delete_gdb_breakpoint_1 (z_type, addr, size);

  if (z_type == Z_PACKET_SW_BP)
    done_accessing_memory ();

  return ret;
}
예제 #2
0
int
prepare_to_access_memory (void)
{
  struct thread_search search;
  struct thread_info *thread;

  memset (&search, 0, sizeof (search));
  search.current_gen_ptid = general_thread;
  prev_general_thread = general_thread;

  if (the_target->prepare_to_access_memory != NULL)
    {
      int res;

      res = the_target->prepare_to_access_memory ();
      if (res != 0)
	return res;
    }

  find_inferior (&all_threads, thread_search_callback, &search);

  /* Prefer a stopped thread.  If none is found, try the current
     thread.  Otherwise, take the first thread in the process.  If
     none is found, undo the effects of
     target->prepare_to_access_memory() and return error.  */
  if (search.stopped != NULL)
    thread = search.stopped;
  else if (search.current != NULL)
    thread = search.current;
  else if (search.first != NULL)
    thread = search.first;
  else
    {
      done_accessing_memory ();
      return 1;
    }

  current_thread = thread;
  general_thread = ptid_of (thread);

  return 0;
}
예제 #3
0
파일: mem-break.c 프로젝트: dbl001/binutils
struct breakpoint *
set_gdb_breakpoint (char z_type, CORE_ADDR addr, int size, int *err)
{
  struct breakpoint *bp;

  if (!check_gdb_bp_preconditions (z_type, err))
    return NULL;

  /* If inserting a software/memory breakpoint, need to prepare to
     access memory.  */
  if (z_type == Z_PACKET_SW_BP)
    {
      *err = prepare_to_access_memory ();
      if (*err != 0)
	return NULL;
    }

  bp = set_gdb_breakpoint_1 (z_type, addr, size, err);

  if (z_type == Z_PACKET_SW_BP)
    done_accessing_memory ();

  return bp;
}