static int __system(RIO *io, RIODesc *fd, const char *cmd) { /* XXX: test only for x86-32 */ if(!strcmp(cmd,"regs")){ int i; gdbwrap_readgenreg (RIOGDB_DESC (fd)); for (i=0; i<NUM_REGS; i++){ ut32 v = gdbwrap_getreg (RIOGDB_DESC (fd), i) & 0xFFFFFFFF; printf ("Reg #%d - %#x\n", i, v); } } else if (!strcmp (cmd, "stepi")) { gdbwrap_stepi (RIOGDB_DESC (fd)); } else if (!strcmp (cmd, "cont")) { gdbwrap_continue (RIOGDB_DESC (fd)); } else if (!strncmp (cmd, "bp", 2) && r_str_word_count (cmd)==2) { char *saddr = strrchr (cmd, ' '); //Assuming only spaces as separator, get last space if (saddr) { int addr; r_hex_str2bin (saddr, (ut8*)&addr); //TODO handle endianness local machine gdbwrap_simplesetbp (RIOGDB_DESC (fd), addr); } } return -1; }
bool test_r_str_word_count(void) { mu_assert_eq (r_str_word_count ("let's test\nradare2 \t libraries!"), 4, "words in a string"); mu_end; }