2009-02-05 22:08:46 +01:00
|
|
|
/* radare - LGPL - Copyright 2009 pancake<nopcode.org> */
|
|
|
|
|
|
|
|
#include <r_debug.h>
|
|
|
|
|
|
|
|
/* XXX move to debug_init() ?? */
|
|
|
|
int r_debug_handle_init(struct r_debug_t *dbg)
|
|
|
|
{
|
|
|
|
INIT_LIST_HEAD(&dbg->handlers);
|
|
|
|
return R_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
int r_debug_handle_set(struct r_debug_t *dbg, const char *str)
|
|
|
|
{
|
|
|
|
struct list_head *pos;
|
|
|
|
list_for_each_prev(pos, &dbg->handlers) {
|
|
|
|
struct r_debug_handle_t *h = list_entry(pos, struct r_debug_handle_t, list);
|
|
|
|
if (!strcmp(str, h->name)) {
|
|
|
|
dbg->h = h;
|
|
|
|
return R_TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return R_FALSE;
|
|
|
|
}
|
|
|
|
|
2009-02-18 01:43:57 +01:00
|
|
|
int r_debug_handle_list(struct r_debug_t *dbg, const char *str)
|
|
|
|
{
|
|
|
|
int count = 0;
|
|
|
|
struct list_head *pos;
|
|
|
|
list_for_each_prev(pos, &dbg->handlers) {
|
|
|
|
struct r_debug_handle_t *h = list_entry(pos, struct r_debug_handle_t, list);
|
|
|
|
printf("%d %s %s\n", count, h->name, ((h==dbg->h)?"*":""));
|
|
|
|
count++;
|
|
|
|
}
|
|
|
|
|
|
|
|
return R_FALSE;
|
|
|
|
}
|
|
|
|
|
2009-02-05 22:08:46 +01:00
|
|
|
int r_debug_handle_add(struct r_debug_t *dbg, struct r_debug_handle_t *foo)
|
|
|
|
{
|
|
|
|
list_add_tail(&(foo->list), &(dbg->handlers));
|
|
|
|
return R_TRUE;
|
|
|
|
}
|