Exemple #1
0
static void
entry_breakpoint_on_hit(struct breakpoint *a, struct process *proc)
{
	struct entry_breakpoint *bp = (void *)a;
	if (proc == NULL || proc->leader == NULL)
		return;
	arch_addr_t dyn_addr = bp->dyn_addr;
	delete_breakpoint(proc, bp->super.addr);
	linkmap_init(proc, dyn_addr);
	arch_dynlink_done(proc);
}
static PyObject *
bppy_delete_breakpoint (PyObject *self, PyObject *args)
{
  breakpoint_object *self_bp = (breakpoint_object *) self;

  BPPY_REQUIRE_VALID (self_bp);

  delete_breakpoint (self_bp->bp);

  Py_RETURN_NONE;
}
static SCM
gdbscm_delete_breakpoint_x (SCM self)
{
  breakpoint_smob *bp_smob
    = bpscm_get_valid_breakpoint_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);

  TRY
    {
      delete_breakpoint (bp_smob->bp);
    }
  CATCH (except, RETURN_MASK_ALL)
    {
      GDBSCM_HANDLE_GDB_EXCEPTION (except);
    }
Exemple #4
0
static void
delete_breakpoint_action (Widget w, XtPointer client_data, XtPointer call_data)
{
  Widget dialog = (Widget) client_data;
  String value = XawDialogGetValueString (dialog);
  mem_addr addr;

  free (breakpoint_addr);
  breakpoint_addr = str_copy (value);
  addr = strtoul (value, NULL, 0);

  delete_breakpoint (addr);

  destroy_popup_prompt (NULL, (XtPointer) dialog, (XtPointer) NULL);
}
Exemple #5
0
static void
callstack_pop(Process *proc) {
	struct callstack_element *elem;
	assert(proc->callstack_depth > 0);

	debug(DEBUG_FUNCTION, "callstack_pop(pid=%d)", proc->pid);
	elem = &proc->callstack[proc->callstack_depth - 1];
	if (!elem->is_syscall && elem->return_addr) {
		assert(proc->leader != NULL);
		delete_breakpoint(proc, elem->return_addr);
	}
	if (elem->arch_ptr != NULL) {
		free(elem->arch_ptr);
		elem->arch_ptr = NULL;
	}
	proc->callstack_depth--;
}
static void
remove_thread_event_breakpoints (struct process_info *proc)
{
  struct thread_db *thread_db = proc->priv->thread_db;

  if (thread_db->td_create_bp != NULL)
    {
      struct thread_info *saved_thread = current_thread;

      switch_to_process (proc);

      delete_breakpoint (thread_db->td_create_bp);
      thread_db->td_create_bp = NULL;

      current_thread = saved_thread;
    }
}
Exemple #7
0
static void
reinsert_breakpoint_handler (CORE_ADDR stop_pc)
{
  struct breakpoint *stop_bp, *orig_bp;

  stop_bp = find_breakpoint_at (stop_pc);
  if (stop_bp == NULL)
    error ("lost the stopping breakpoint.");

  orig_bp = stop_bp->breakpoint_to_reinsert;
  if (orig_bp == NULL)
    error ("no breakpoint to reinsert");

  (*the_target->write_memory) (orig_bp->pc, breakpoint_data,
			       breakpoint_len);
  orig_bp->reinserting = 0;
  delete_breakpoint (stop_bp);
}
static void changed_breakpoint(GDB_ADDRESS address, int enabled)
{
    int i;

    i = find_breakpt(address);			/* find the breakpoint			*/
    if (i < 0) {				/* if not found...			*/
    	if (enabled)				/* ...if being enabled...		*/
    	    new_breakpoint(address, 1);		/* ...just recreate it in bkpt_tbl	*/
	return;
    }

    if (!enabled)				/* if found and being disabled...	*/
    	delete_breakpoint(address, 0);		/* ...delete it				*/

    if (0)
	for (i = 0; i <= bkpt_tbl_index; ++i)
	    gdb_printf("after change: %2d. 0x%llX\n", i+1, (long long)bkpt_tbl[i]);
}
Exemple #9
0
static int
delete_gdb_breakpoint_1 (char z_type, CORE_ADDR addr, int size)
{
  struct breakpoint *bp;
  int err;

  bp = find_gdb_breakpoint (z_type, addr, size);
  if (bp == NULL)
    return -1;

  /* Before deleting the breakpoint, make sure to free its condition
     and command lists.  */
  clear_breakpoint_conditions_and_commands (bp);
  err = delete_breakpoint (bp);
  if (err != 0)
    return -1;

  return 0;
}
Exemple #10
0
int
delete_gdb_breakpoint_at (CORE_ADDR addr)
{
  struct breakpoint *bp;
  int err;

  if (breakpoint_data == NULL)
    return 1;

  bp = find_gdb_breakpoint_at (addr);
  if (bp == NULL)
    return -1;

  /* Before deleting the breakpoint, make sure to free
     its condition list.  */
  clear_gdb_breakpoint_conditions (addr);
  err = delete_breakpoint (bp);
  if (err)
    return -1;

  return 0;
}
Exemple #11
0
static struct breakpoint *
set_gdb_breakpoint_1 (char z_type, CORE_ADDR addr, int size, int *err)
{
  struct breakpoint *bp;
  enum bkpt_type type;
  enum raw_bkpt_type raw_type;

  /* If we see GDB inserting a second code breakpoint at the same
     address, then either: GDB is updating the breakpoint's conditions
     or commands; or, the first breakpoint must have disappeared due
     to a shared library unload.  On targets where the shared
     libraries are handled by userspace, like SVR4, for example,
     GDBserver can't tell if a library was loaded or unloaded.  Since
     we refcount raw breakpoints, we must be careful to make sure GDB
     breakpoints never contribute more than one reference.  if we
     didn't do this, in case the previous breakpoint is gone due to a
     shared library unload, we'd just increase the refcount of the
     previous breakpoint at this address, but the trap was not planted
     in the inferior anymore, thus the breakpoint would never be hit.
     Note this must be careful to not create a window where
     breakpoints are removed from the target, for non-stop, in case
     the target can poke at memory while the program is running.  */
  if (z_type == Z_PACKET_SW_BP
      || z_type == Z_PACKET_HW_BP)
    {
      bp = find_gdb_breakpoint (z_type, addr, -1);

      if (bp != NULL)
	{
	  if (bp->raw->size != size)
	    {
	      /* A different size than previously seen.  The previous
		 breakpoint must be gone then.  */
	      bp->raw->inserted = -1;
	      delete_breakpoint (bp);
	      bp = NULL;
	    }
	  else if (z_type == Z_PACKET_SW_BP)
	    {
	      /* Check if the breakpoint is actually gone from the
		 target, due to an solib unload, for example.  Might
		 as well validate _all_ breakpoints.  */
	      validate_breakpoints ();

	      /* Breakpoints that don't pass validation are
		 deleted.  */
	      bp = find_gdb_breakpoint (z_type, addr, -1);
	    }
	}
    }
  else
    {
      /* Data breakpoints for the same address but different size are
	 expected.  GDB doesn't merge these.  The backend gets to do
	 that if it wants/can.  */
      bp = find_gdb_breakpoint (z_type, addr, size);
    }

  if (bp != NULL)
    {
      /* We already know about this breakpoint, there's nothing else
	 to do - GDB's reference is already accounted for.  Note that
	 whether the breakpoint inserted is left as is - we may be
	 stepping over it, for example, in which case we don't want to
	 force-reinsert it.  */
      return bp;
    }

  raw_type = Z_packet_to_raw_bkpt_type (z_type);
  type = Z_packet_to_bkpt_type (z_type);
  return set_breakpoint (type, raw_type, addr, size, NULL, err);
}