static int r_debug_gdb_attach(RDebug *dbg, int pid) { RIODesc *d = dbg->iob.io->desc; if (d && d->plugin && d->plugin->name && d->data) { if (!strcmp ("gdb", d->plugin->name)) { RIOGdb *g = d->data; support_sw_bp = UNKNOWN; support_hw_bp = UNKNOWN; if (( desc = &g->desc )) switch (dbg->arch) { case R_SYS_ARCH_X86: if ( dbg->anal->bits == 16 || dbg->anal->bits == 32) { gdbr_set_architecture(&g->desc, X86_32); } else if (dbg->anal->bits == 64) { gdbr_set_architecture(&g->desc, X86_64); } else { eprintf("Not supported register profile\n"); return R_FALSE; } break; case R_SYS_ARCH_SH: // TODO break; case R_SYS_ARCH_ARM: // TODO break; } } else { eprintf ("ERROR: Underlaying IO descriptor is not a GDB one..\n"); } } return R_TRUE; }
static int r_debug_gdb_attach(RDebug *dbg, int pid) { RIODesc *d = dbg->iob.io->desc; // TODO: the core must update the dbg.swstep config var when this var is changed dbg->swstep = false; //eprintf ("XWJSTEP TOFALSE\n"); if (d && d->plugin && d->plugin->name && d->data) { if (!strcmp ("gdb", d->plugin->name)) { RIOGdb *g = d->data; support_sw_bp = UNKNOWN; support_hw_bp = UNKNOWN; int arch = r_sys_arch_id (dbg->arch); int bits = dbg->anal->bits; if (( desc = &g->desc )) switch (arch) { case R_SYS_ARCH_X86: if (bits == 16 || bits == 32) { gdbr_set_architecture (&g->desc, X86_32); } else if (bits == 64) { gdbr_set_architecture (&g->desc, X86_64); } else { eprintf ("Not supported register %s %d profile\n", dbg->arch, bits); return false; } break; case R_SYS_ARCH_SH: // TODO break; case R_SYS_ARCH_ARM: if (bits == 16 || bits == 32) { gdbr_set_architecture (&g->desc, ARM_32); } else if (bits == 64) { gdbr_set_architecture (&g->desc, ARM_64); } else { eprintf ("Not supported register %s %d profile\n", dbg->arch, bits); return false; } break; case R_SYS_ARCH_MIPS: if (bits == 32 || bits == 64) { gdbr_set_architecture (&g->desc, MIPS); } else { eprintf ("Not supported register %s %d profile\n", dbg->arch, bits); return false; } break; case R_SYS_ARCH_AVR: if (bits == 16) { gdbr_set_architecture (&g->desc, AVR); } else { eprintf ("Not supported register profile\n"); return false; } break; } } else { eprintf ("ERROR: Underlaying IO descriptor is not a GDB one..\n"); } } return true; }