2009-09-14 00:37:28 +02:00
|
|
|
/* radare - LGPL - Copyright 2009 pancake<nopcode.org> */
|
|
|
|
|
|
|
|
#include <r_bp.h>
|
|
|
|
|
2010-05-26 18:25:35 +02:00
|
|
|
R_API int r_bp_plugin_del(struct r_bp_t *bp, const char *name)
|
2009-09-14 00:37:28 +02:00
|
|
|
{
|
2010-05-26 18:25:35 +02:00
|
|
|
#warning TODO: r_bp_plugin_del
|
2009-09-14 00:37:28 +02:00
|
|
|
return R_FALSE;
|
|
|
|
}
|
|
|
|
|
2010-05-26 18:25:35 +02:00
|
|
|
R_API int r_bp_plugin_add(struct r_bp_t *bp, struct r_bp_plugin_t *foo)
|
2009-09-14 00:37:28 +02:00
|
|
|
{
|
|
|
|
struct list_head *pos;
|
|
|
|
if (bp == NULL) {
|
2010-05-27 00:57:25 +02:00
|
|
|
eprintf("Cannot add plugin because dbg->bp is null and/or plugin is null\n");
|
2009-09-14 00:37:28 +02:00
|
|
|
return R_FALSE;
|
|
|
|
}
|
|
|
|
/* avoid dupped plugins */
|
2010-03-03 00:13:22 +01:00
|
|
|
list_for_each_prev (pos, &bp->bps) {
|
2010-05-26 01:42:22 +02:00
|
|
|
struct r_bp_plugin_t *h = list_entry (pos, struct r_bp_plugin_t, list);
|
2010-03-03 00:13:22 +01:00
|
|
|
if (!strcmp (h->name, foo->name))
|
2009-09-14 00:37:28 +02:00
|
|
|
return R_FALSE;
|
|
|
|
}
|
|
|
|
bp->nbps++;
|
2010-03-03 00:13:22 +01:00
|
|
|
list_add_tail (&(foo->list), &(bp->plugins));
|
2009-09-14 00:37:28 +02:00
|
|
|
return R_TRUE;
|
|
|
|
}
|
|
|
|
|
2009-09-20 02:16:14 +02:00
|
|
|
R_API int r_bp_use(struct r_bp_t *bp, const char *name)
|
2009-09-14 00:37:28 +02:00
|
|
|
{
|
|
|
|
struct list_head *pos;
|
2010-03-03 00:13:22 +01:00
|
|
|
list_for_each_prev (pos, &bp->plugins) {
|
2010-05-26 01:42:22 +02:00
|
|
|
struct r_bp_plugin_t *h = list_entry(pos, struct r_bp_plugin_t, list);
|
2010-03-03 00:13:22 +01:00
|
|
|
if (!strcmp (h->name, name)) {
|
2009-09-14 00:37:28 +02:00
|
|
|
bp->cur = h;
|
|
|
|
return R_TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return R_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
// TODO: deprecate
|
2010-05-26 18:25:35 +02:00
|
|
|
R_API void r_bp_plugin_list(struct r_bp_t *bp) {
|
2010-05-26 01:42:22 +02:00
|
|
|
struct r_bp_plugin_t *b;
|
2009-09-14 00:37:28 +02:00
|
|
|
struct list_head *pos;
|
2010-03-03 00:13:22 +01:00
|
|
|
list_for_each (pos, &bp->plugins) {
|
2010-05-26 01:42:22 +02:00
|
|
|
b = list_entry(pos, struct r_bp_plugin_t, list);
|
2010-03-03 00:13:22 +01:00
|
|
|
printf ("bp %c %s\n",
|
|
|
|
(bp->cur && !strcmp (bp->cur->name, b->name))?'*':'-',
|
2009-09-14 00:37:28 +02:00
|
|
|
b->name);
|
|
|
|
}
|
|
|
|
}
|