int breakpoint_inserted_here (CORE_ADDR addr) { struct raw_breakpoint *bp; bp = find_raw_breakpoint_at (addr); return (bp != NULL && bp->inserted); }
static struct raw_breakpoint * set_raw_breakpoint_at (CORE_ADDR where) { struct process_info *proc = current_process (); struct raw_breakpoint *bp; int err; unsigned char buf[MAX_BREAKPOINT_LEN]; if (breakpoint_data == NULL) error ("Target does not support breakpoints."); bp = find_raw_breakpoint_at (where); if (bp != NULL) { bp->refcount++; return bp; } bp = xcalloc (1, sizeof (*bp)); bp->pc = where; bp->refcount = 1; /* Note that there can be fast tracepoint jumps installed in the same memory range, so to get at the original memory, we need to use read_inferior_memory, which masks those out. */ err = read_inferior_memory (where, buf, breakpoint_len); if (err != 0) { if (debug_threads) fprintf (stderr, "Failed to read shadow memory of" " breakpoint at 0x%s (%s).\n", paddress (where), strerror (err)); free (bp); return NULL; } memcpy (bp->old_data, buf, breakpoint_len); err = (*the_target->write_memory) (where, breakpoint_data, breakpoint_len); if (err != 0) { if (debug_threads) fprintf (stderr, "Failed to insert breakpoint at 0x%s (%s).\n", paddress (where), strerror (err)); free (bp); return NULL; } /* Link the breakpoint in. */ bp->inserted = 1; bp->next = proc->raw_breakpoints; proc->raw_breakpoints = bp; return bp; }
static struct raw_breakpoint * set_raw_breakpoint_at (enum raw_bkpt_type type, CORE_ADDR where, int size, int *err) { struct process_info *proc = current_process (); struct raw_breakpoint *bp; if (type == raw_bkpt_type_sw || type == raw_bkpt_type_hw) { bp = find_enabled_raw_code_breakpoint_at (where, type); if (bp != NULL && bp->size != size) { /* A different size than previously seen. The previous breakpoint must be gone then. */ if (debug_threads) debug_printf ("Inconsistent breakpoint size? Was %d, now %d.\n", bp->size, size); bp->inserted = -1; bp = NULL; } } else bp = find_raw_breakpoint_at (where, type, size); if (bp != NULL) { bp->refcount++; return bp; } bp = xcalloc (1, sizeof (*bp)); bp->pc = where; bp->size = size; bp->refcount = 1; bp->raw_type = type; *err = the_target->insert_point (bp->raw_type, bp->pc, bp->size, bp); if (*err != 0) { if (debug_threads) debug_printf ("Failed to insert breakpoint at 0x%s (%d).\n", paddress (where), *err); free (bp); return NULL; } bp->inserted = 1; /* Link the breakpoint in. */ bp->next = proc->raw_breakpoints; proc->raw_breakpoints = bp; return bp; }
void reinsert_breakpoints_at (CORE_ADDR pc) { struct raw_breakpoint *bp; bp = find_raw_breakpoint_at (pc); if (bp == NULL) { /* This can happen when we remove all breakpoints while handling a step-over. */ if (debug_threads) fprintf (stderr, "Could not find raw breakpoint at 0x%s " "in list (reinserting).\n", paddress (pc)); return; } reinsert_raw_breakpoint (bp); }
int breakpoint_here (CORE_ADDR addr) { return (find_raw_breakpoint_at (addr) != NULL); }