static int r_debug_bf_stop(RDebug *dbg) { if (!is_io_bf (dbg)) { return false; } RIOBdescbg *o = dbg->iob.io->desc->data; BfvmCPU *c = o->bfvm; c->breaked = true; return true; }
static bool r_debug_bf_kill(RDebug *dbg, int pid, int tid, int sig) { if (!is_io_bf (dbg)) { return false; } RIOBdescbg *o = dbg->iob.io->desc->data; if (o) { bfvm_reset (o->bfvm); } return true; }
static int r_debug_bf_attach(RDebug *dbg, int pid) { if (!is_io_bf (dbg)) return false; #if 0 RIOBdescbg *o; o = dbg->iob.io->desc->data; eprintf ("base = %llx\n", o->bfvm->base); eprintf ("screen = %llx\n", o->bfvm->screen); eprintf ("input = %llx\n", o->bfvm->input); #endif return true; }
static RList *r_debug_native_map_get(RDebug *dbg) { if (!is_io_bf (dbg)) { return false; } RIOBdescbg *o = dbg->iob.io->desc->data; BfvmCPU *c = o->bfvm; RList *list = r_list_newf ((RListFree)r_debug_map_free); if (!list) { return NULL; } r_list_append (list, r_debug_map_new ( "code", 0, 4096, 6, 0)); r_list_append (list, r_debug_map_new ( "memory", c->base, c->base+c->size, 6, 0)); r_list_append (list, r_debug_map_new ( "screen", c->screen, c->screen+c->screen_size, 6, 0)); r_list_append (list, r_debug_map_new ( "input", c->input, c->input+c->input_size, 6, 0)); return list; }
static int r_debug_bf_reg_write(RDebug *dbg, int type, const ut8 *buf, int size) { RIOBdescbg *o; if (!dbg) return false; if (!is_io_bf (dbg)) return 0; if (!(dbg->iob.io) || !(dbg->iob.io->desc) || !(dbg->iob.io->desc->data)) return 0; o = dbg->iob.io->desc->data; memcpy (&r, buf, sizeof (r)); o->bfvm->eip = r.pc; o->bfvm->ptr = r.ptr; // dup o->bfvm->esp = r.sp; o->bfvm->screen = r.scr; o->bfvm->screen_idx = r.scri; o->bfvm->input = r.inp; o->bfvm->input_idx = r.inpi; o->bfvm->base = r.mem; o->bfvm->ptr = r.memi; // dup return true; }
static int r_debug_bf_reg_read(RDebug *dbg, int type, ut8 *buf, int size) { RIOBdescbg *o; if (!dbg) return false; if (!is_io_bf (dbg)) return 0; if (!(dbg->iob.io) || !(dbg->iob.io->desc) || !(dbg->iob.io->desc->data)) return 0; o = dbg->iob.io->desc->data; r.pc = o->bfvm->eip; r.ptr = o->bfvm->ptr; r.sp = o->bfvm->esp; r.scr = o->bfvm->screen; r.scri = o->bfvm->screen_idx; r.inp = o->bfvm->input; r.inpi = o->bfvm->input_idx; r.mem = o->bfvm->base; r.memi = o->bfvm->ptr; memcpy (buf, &r, sizeof (r)); //r_io_system (dbg->iob.io, "dr"); return sizeof (r); }
static int r_debug_bf_attach(RDebug *dbg, int pid) { if (!is_io_bf (dbg)) { return false; } return true; }