71 (*breakpoint_p) = malloc(
sizeof(
struct breakpoint));
72 (*breakpoint_p)->address =
address;
73 (*breakpoint_p)->asid = 0;
74 (*breakpoint_p)->length =
length;
75 (*breakpoint_p)->type =
type;
76 (*breakpoint_p)->is_set =
false;
77 (*breakpoint_p)->orig_instr = malloc(
length);
78 (*breakpoint_p)->next =
NULL;
86 reason =
"resource not available";
89 reason =
"target not halted";
92 reason =
"unknown reason";
95 free((*breakpoint_p)->orig_instr);
102 " of length 0x%8.8x, (BPID: %" PRIu32
")",
104 (*breakpoint_p)->address, (*breakpoint_p)->length,
105 (*breakpoint_p)->unique_id);
133 (*breakpoint_p) = malloc(
sizeof(
struct breakpoint));
134 (*breakpoint_p)->address = 0;
135 (*breakpoint_p)->asid =
asid;
136 (*breakpoint_p)->length =
length;
137 (*breakpoint_p)->type =
type;
138 (*breakpoint_p)->is_set =
false;
139 (*breakpoint_p)->orig_instr = malloc(
length);
140 (*breakpoint_p)->next =
NULL;
145 free((*breakpoint_p)->orig_instr);
147 *breakpoint_p =
NULL;
151 LOG_TARGET_DEBUG(
target,
"added %s Context breakpoint at 0x%8.8" PRIx32
" of length 0x%8.8x, (BPID: %" PRIu32
")",
153 (*breakpoint_p)->asid, (*breakpoint_p)->length,
154 (*breakpoint_p)->unique_id);
187 (*breakpoint_p) = malloc(
sizeof(
struct breakpoint));
188 (*breakpoint_p)->address =
address;
189 (*breakpoint_p)->asid =
asid;
190 (*breakpoint_p)->length =
length;
191 (*breakpoint_p)->type =
type;
192 (*breakpoint_p)->is_set =
false;
193 (*breakpoint_p)->orig_instr = malloc(
length);
194 (*breakpoint_p)->next =
NULL;
201 free((*breakpoint_p)->orig_instr);
203 *breakpoint_p =
NULL;
207 "added %s Hybrid breakpoint at address " TARGET_ADDR_FMT " of length 0x%8.8x, (BPID: %" PRIu32
")",
209 (*breakpoint_p)->address,
210 (*breakpoint_p)->length,
211 (*breakpoint_p)->unique_id);
349 unsigned int num_found_breakpoints = 0;
358 num_found_breakpoints++;
371 num_found_breakpoints++;
378 if (num_found_breakpoints == 0) {
500 " already has watchpoint %d",
512 (*watchpoint_p) = calloc(1,
sizeof(
struct watchpoint));
513 (*watchpoint_p)->address =
address;
514 (*watchpoint_p)->length =
length;
515 (*watchpoint_p)->value =
value;
516 (*watchpoint_p)->mask =
mask;
517 (*watchpoint_p)->rw =
rw;
525 reason =
"resource not available";
528 reason =
"target not halted";
531 reason =
"unrecognized error";
537 *watchpoint_p =
NULL;
542 " of length 0x%8.8x (WPID: %d)",
544 (*watchpoint_p)->address,
545 (*watchpoint_p)->length,
546 (*watchpoint_p)->unique_id);
591 unsigned int num_found_watchpoints = 0;
600 num_found_watchpoints++;
612 num_found_watchpoints++;
619 if (num_found_watchpoints == 0) {
637 unsigned int cnt = 0;
651 *
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
static const char *const breakpoint_type_strings[]
int context_breakpoint_add(struct target *target, uint32_t asid, unsigned int length, enum breakpoint_type type)
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
uint32_t address
Starting address. Sector aligned.
#define ERROR_NOT_IMPLEMENTED
#define LOG_TARGET_ERROR(target, fmt_str,...)
#define LOG_TARGET_DEBUG(target, fmt_str,...)
#define foreach_smp_target(pos, head)
enum target_debug_reason debug_reason
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
#define ERROR_TARGET_DUPLICATE_BREAKPOINT
#define ERROR_TARGET_INTERSECT_BREAKPOINT
#define ERROR_TARGET_RESOURCE_NOT_AVAILABLE
bool is_memory_regions_overlap(target_addr_t start1, unsigned int size1, target_addr_t start2, unsigned int size2)