Lines Matching refs:bp

63 breakpoint_on_hit(struct breakpoint *bp, struct process *proc)  in breakpoint_on_hit()  argument
65 assert(bp != NULL); in breakpoint_on_hit()
66 if (bp->cbs != NULL && bp->cbs->on_hit != NULL) in breakpoint_on_hit()
67 (bp->cbs->on_hit)(bp, proc); in breakpoint_on_hit()
71 breakpoint_on_continue(struct breakpoint *bp, struct process *proc) in breakpoint_on_continue() argument
73 assert(bp != NULL); in breakpoint_on_continue()
74 if (bp->cbs != NULL && bp->cbs->on_continue != NULL) in breakpoint_on_continue()
75 (bp->cbs->on_continue)(bp, proc); in breakpoint_on_continue()
77 continue_after_breakpoint(proc, bp); in breakpoint_on_continue()
81 breakpoint_on_retract(struct breakpoint *bp, struct process *proc) in breakpoint_on_retract() argument
83 assert(bp != NULL); in breakpoint_on_retract()
84 if (bp->cbs != NULL && bp->cbs->on_retract != NULL) in breakpoint_on_retract()
85 (bp->cbs->on_retract)(bp, proc); in breakpoint_on_retract()
89 breakpoint_on_install(struct breakpoint *bp, struct process *proc) in breakpoint_on_install() argument
91 assert(bp != NULL); in breakpoint_on_install()
92 if (bp->cbs != NULL && bp->cbs->on_install != NULL) in breakpoint_on_install()
93 (bp->cbs->on_install)(bp, proc); in breakpoint_on_install()
98 struct breakpoint *bp, struct process *proc) in breakpoint_get_return_bp() argument
100 assert(bp != NULL); in breakpoint_get_return_bp()
101 if (bp->cbs != NULL && bp->cbs->get_return_bp != NULL) in breakpoint_get_return_bp()
102 return (bp->cbs->get_return_bp)(ret, bp, proc); in breakpoint_get_return_bp()
165 breakpoint_init_base(struct breakpoint *bp, in breakpoint_init_base() argument
168 bp->cbs = NULL; in breakpoint_init_base()
169 bp->addr = addr; in breakpoint_init_base()
170 memset(bp->orig_value, 0, sizeof(bp->orig_value)); in breakpoint_init_base()
171 bp->enabled = 0; in breakpoint_init_base()
172 bp->libsym = libsym; in breakpoint_init_base()
180 breakpoint_init(struct breakpoint *bp, struct process *proc, in breakpoint_init() argument
183 breakpoint_init_base(bp, addr, libsym); in breakpoint_init()
184 if (os_breakpoint_init(proc, bp) < 0) in breakpoint_init()
186 if (arch_breakpoint_init(proc, bp) < 0) { in breakpoint_init()
187 os_breakpoint_destroy(bp); in breakpoint_init()
194 breakpoint_set_callbacks(struct breakpoint *bp, struct bp_callbacks *cbs) in breakpoint_set_callbacks() argument
196 if (bp->cbs != NULL) in breakpoint_set_callbacks()
197 assert(bp->cbs == NULL); in breakpoint_set_callbacks()
198 bp->cbs = cbs; in breakpoint_set_callbacks()
202 breakpoint_destroy(struct breakpoint *bp) in breakpoint_destroy() argument
204 if (bp == NULL) in breakpoint_destroy()
206 arch_breakpoint_destroy(bp); in breakpoint_destroy()
207 os_breakpoint_destroy(bp); in breakpoint_destroy()
212 struct breakpoint *bp) in breakpoint_clone() argument
215 if (bp->libsym != NULL) { in breakpoint_clone()
216 int rc = proc_find_symbol(new_proc, bp->libsym, NULL, &libsym); in breakpoint_clone()
220 breakpoint_init_base(retp, bp->addr, libsym); in breakpoint_clone()
221 memcpy(retp->orig_value, bp->orig_value, sizeof(bp->orig_value)); in breakpoint_clone()
222 retp->enabled = bp->enabled; in breakpoint_clone()
223 if (os_breakpoint_clone(retp, bp) < 0) in breakpoint_clone()
225 if (arch_breakpoint_clone(retp, bp) < 0) { in breakpoint_clone()
229 breakpoint_set_callbacks(retp, bp->cbs); in breakpoint_clone()
234 breakpoint_turn_on(struct breakpoint *bp, struct process *proc) in breakpoint_turn_on() argument
236 bp->enabled++; in breakpoint_turn_on()
237 if (bp->enabled == 1) { in breakpoint_turn_on()
239 enable_breakpoint(proc, bp); in breakpoint_turn_on()
240 breakpoint_on_install(bp, proc); in breakpoint_turn_on()
246 breakpoint_turn_off(struct breakpoint *bp, struct process *proc) in breakpoint_turn_off() argument
248 bp->enabled--; in breakpoint_turn_off()
249 if (bp->enabled == 0) in breakpoint_turn_off()
250 disable_breakpoint(proc, bp); in breakpoint_turn_off()
251 assert(bp->enabled >= 0); in breakpoint_turn_off()
258 struct breakpoint *bp = malloc(sizeof *bp); in create_default_return_bp() local
260 if (return_addr == 0 || bp == NULL in create_default_return_bp()
261 || breakpoint_init(bp, proc, return_addr, NULL) < 0) { in create_default_return_bp()
262 free(bp); in create_default_return_bp()
265 return bp; in create_default_return_bp()
278 struct breakpoint *bp = malloc(sizeof *bp); in insert_breakpoint_at() local
279 if (bp == NULL || breakpoint_init(bp, proc, addr, libsym) < 0) { in insert_breakpoint_at()
280 free(bp); in insert_breakpoint_at()
292 struct breakpoint *tmp = insert_breakpoint(proc, bp); in insert_breakpoint_at()
293 if (tmp != bp) { in insert_breakpoint_at()
294 breakpoint_destroy(bp); in insert_breakpoint_at()
295 free(bp); in insert_breakpoint_at()
301 insert_breakpoint(struct process *proc, struct breakpoint *bp) in insert_breakpoint() argument
316 struct breakpoint *ext_bp = bp; in insert_breakpoint()
317 if (DICT_FIND_VAL(leader->breakpoints, &bp->addr, &ext_bp) != 0) { in insert_breakpoint()
318 if (proc_add_breakpoint(leader, bp) < 0) in insert_breakpoint()
320 ext_bp = bp; in insert_breakpoint()
324 if (ext_bp != bp) in insert_breakpoint()
325 proc_remove_breakpoint(leader, bp); in insert_breakpoint()
341 struct breakpoint *bp = NULL; in delete_breakpoint_at() local
342 DICT_FIND_VAL(leader->breakpoints, &addr, &bp); in delete_breakpoint_at()
343 assert(bp != NULL); in delete_breakpoint_at()
345 if (delete_breakpoint(proc, bp) < 0) { in delete_breakpoint_at()
347 breakpoint_name(bp), bp->addr); in delete_breakpoint_at()
352 delete_breakpoint(struct process *proc, struct breakpoint *bp) in delete_breakpoint() argument
357 if (breakpoint_turn_off(bp, proc) < 0) in delete_breakpoint()
360 if (bp->enabled == 0) { in delete_breakpoint()
361 proc_remove_breakpoint(leader, bp); in delete_breakpoint()
362 breakpoint_destroy(bp); in delete_breakpoint()
363 free(bp); in delete_breakpoint()
370 breakpoint_name(const struct breakpoint *bp) in breakpoint_name() argument
372 assert(bp != NULL); in breakpoint_name()
373 return bp->libsym != NULL ? bp->libsym->name : NULL; in breakpoint_name()
377 breakpoint_library(const struct breakpoint *bp) in breakpoint_library() argument
379 assert(bp != NULL); in breakpoint_library()
380 return bp->libsym != NULL ? bp->libsym->lib : NULL; in breakpoint_library()
403 entry_breakpoint_on_hit(struct breakpoint *bp, struct process *proc) in entry_breakpoint_on_hit() argument
407 delete_breakpoint_at(proc, bp->addr); in entry_breakpoint_on_hit()
413 struct breakpoint *bp, arch_addr_t addr, in entry_breakpoint_init() argument
417 int err = breakpoint_init(bp, proc, addr, NULL); in entry_breakpoint_init()
424 bp->cbs = &entry_callbacks; in entry_breakpoint_init()