63 (*breakpoint_p) = malloc(
sizeof(
struct breakpoint));
64 (*breakpoint_p)->address =
address;
65 (*breakpoint_p)->asid = 0;
66 (*breakpoint_p)->length =
length;
67 (*breakpoint_p)->type =
type;
68 (*breakpoint_p)->is_set =
false;
69 (*breakpoint_p)->orig_instr = malloc(
length);
70 (*breakpoint_p)->next =
NULL;
78 reason =
"resource not available";
81 reason =
"target running";
84 reason =
"unknown reason";
87 free((*breakpoint_p)->orig_instr);
94 " of length 0x%8.8x, (BPID: %" PRIu32
")",
96 (*breakpoint_p)->address, (*breakpoint_p)->length,
97 (*breakpoint_p)->unique_id);
117 LOG_ERROR(
"Duplicate Breakpoint asid: 0x%08" PRIx32
" (BP %" PRIu32
")",
125 (*breakpoint_p) = malloc(
sizeof(
struct breakpoint));
126 (*breakpoint_p)->address = 0;
127 (*breakpoint_p)->asid =
asid;
128 (*breakpoint_p)->length =
length;
129 (*breakpoint_p)->type =
type;
130 (*breakpoint_p)->is_set =
false;
131 (*breakpoint_p)->orig_instr = malloc(
length);
132 (*breakpoint_p)->next =
NULL;
137 free((*breakpoint_p)->orig_instr);
139 *breakpoint_p =
NULL;
143 LOG_TARGET_DEBUG(
target,
"added %s Context breakpoint at 0x%8.8" PRIx32
" of length 0x%8.8x, (BPID: %" PRIu32
")",
145 (*breakpoint_p)->asid, (*breakpoint_p)->length,
146 (*breakpoint_p)->unique_id);
179 (*breakpoint_p) = malloc(
sizeof(
struct breakpoint));
180 (*breakpoint_p)->address =
address;
181 (*breakpoint_p)->asid =
asid;
182 (*breakpoint_p)->length =
length;
183 (*breakpoint_p)->type =
type;
184 (*breakpoint_p)->is_set =
false;
185 (*breakpoint_p)->orig_instr = malloc(
length);
186 (*breakpoint_p)->next =
NULL;
193 free((*breakpoint_p)->orig_instr);
195 *breakpoint_p =
NULL;
199 "added %s Hybrid breakpoint at address " TARGET_ADDR_FMT " of length 0x%8.8x, (BPID: %" PRIu32
")",
201 (*breakpoint_p)->address,
202 (*breakpoint_p)->length,
203 (*breakpoint_p)->unique_id);
347 unsigned int num_found_breakpoints = 0;
356 num_found_breakpoints++;
369 num_found_breakpoints++;
376 if (num_found_breakpoints == 0) {
517 " already has watchpoint %d",
529 (*watchpoint_p) = calloc(1,
sizeof(
struct watchpoint));
530 (*watchpoint_p)->address =
address;
531 (*watchpoint_p)->length =
length;
532 (*watchpoint_p)->value =
value;
533 (*watchpoint_p)->mask =
mask;
534 (*watchpoint_p)->rw =
rw;
542 reason =
"resource not available";
545 reason =
"target running";
548 reason =
"unrecognized error";
554 *watchpoint_p =
NULL;
559 " of length 0x%8.8x (WPID: %d)",
561 (*watchpoint_p)->address,
562 (*watchpoint_p)->length,
563 (*watchpoint_p)->unique_id);
608 unsigned int num_found_watchpoints = 0;
617 num_found_watchpoints++;
629 num_found_watchpoints++;
636 if (num_found_watchpoints == 0) {
646 LOG_DEBUG(
"Delete all watchpoints for target: %s",
672 *
rw = hit_watchpoint->
rw;
static const char *const watchpoint_rw_strings[]
int watchpoint_add(struct target *target, target_addr_t address, unsigned int length, enum watchpoint_rw rw, uint64_t value, uint64_t mask)
static int breakpoint_watchpoint_remove_all(struct target *target, enum breakpoint_watchpoint bp_wp)
static int watchpoint_free(struct target *target, struct watchpoint *watchpoint_to_remove)
static int breakpoint_add_internal(struct target *target, target_addr_t address, unsigned int length, enum breakpoint_type type)
int breakpoint_remove(struct target *target, target_addr_t address)
static int watchpoint_add_internal(struct target *target, target_addr_t address, unsigned int length, enum watchpoint_rw rw, uint64_t value, uint64_t mask)
int watchpoint_hit(struct target *target, enum watchpoint_rw *rw, target_addr_t *address)
static int breakpoint_remove_internal(struct target *target, target_addr_t address)
static int context_breakpoint_add_internal(struct target *target, uint32_t asid, unsigned int length, enum breakpoint_type type)
int watchpoint_remove(struct target *target, target_addr_t address)
int breakpoint_add(struct target *target, target_addr_t address, unsigned int length, enum breakpoint_type type)
static int bpwp_unique_id
int watchpoint_clear_target(struct target *target)
static const char *const breakpoint_type_strings[]
int context_breakpoint_add(struct target *target, uint32_t asid, unsigned int length, enum breakpoint_type type)
int breakpoint_clear_target(struct target *target)
static int watchpoint_remove_internal(struct target *target, target_addr_t address)
static int breakpoint_free(struct target *target, struct breakpoint *breakpoint_to_remove)
int watchpoint_remove_all(struct target *target)
int breakpoint_remove_all(struct target *target)
static int hybrid_breakpoint_add_internal(struct target *target, target_addr_t address, uint32_t asid, unsigned int length, enum breakpoint_type type)
static int breakpoint_remove_all_internal(struct target *target)
int hybrid_breakpoint_add(struct target *target, target_addr_t address, uint32_t asid, unsigned int length, enum breakpoint_type type)
static int watchpoint_remove_all_internal(struct target *target)
struct breakpoint * breakpoint_find(struct target *target, target_addr_t address)
#define ERROR_WATCHPOINT_NOT_FOUND
#define ERROR_BREAKPOINT_NOT_FOUND
#define list_first_entry(ptr, type, member)
#define LOG_TARGET_ERROR(target, fmt_str,...)
#define LOG_TARGET_DEBUG(target, fmt_str,...)
#define LOG_ERROR(expr ...)
#define LOG_DEBUG(expr ...)
static uint32_t lh(unsigned int rd, unsigned int base, uint16_t offset) __attribute__((unused))
#define foreach_smp_target(pos, head)
struct list_head * smp_targets
struct breakpoint * breakpoints
struct watchpoint * watchpoints
int target_add_watchpoint(struct target *target, struct watchpoint *watchpoint)
Add the watchpoint for target.
int target_remove_breakpoint(struct target *target, struct breakpoint *breakpoint)
Remove the breakpoint for target.
int target_add_hybrid_breakpoint(struct target *target, struct breakpoint *breakpoint)
Add the ContextID & IVA breakpoint for target.
int target_add_breakpoint(struct target *target, struct breakpoint *breakpoint)
Add the breakpoint for target.
int target_hit_watchpoint(struct target *target, struct watchpoint **hit_watchpoint)
Find out the just hit watchpoint for target.
int target_remove_watchpoint(struct target *target, struct watchpoint *watchpoint)
Remove the watchpoint for target.
int target_add_context_breakpoint(struct target *target, struct breakpoint *breakpoint)
Add the ContextID breakpoint for target.
#define ERROR_TARGET_NOT_HALTED
static const char * target_name(const struct target *target)
Returns the instance-specific name of the specified target.
#define ERROR_TARGET_DUPLICATE_BREAKPOINT
#define ERROR_TARGET_RESOURCE_NOT_AVAILABLE