static int __read(RIO *io, RIODesc *fd, ut8 *buf, int count) { memset (buf, 0xff, count); if (RIOGDB_IS_VALID (fd)) { char *ptr = gdbwrap_readmem (RIOGDB_DESC (fd), (la32)io->off, count); if (ptr == NULL) return -1; return r_hex_str2bin (ptr, buf); } return -1; }
/** * Set a breakpoint. We read the value in memory, save it and write a * 0xcc in replacement. The usual command to set a bp is not supported * by the gdbserver. */ void gdbwrap_setbp(gdbwrap_t *desc, la32 linaddr, void *datasaved) { u_char bp = 0xcc; char *ret; unsigned atohresult; ASSERT(desc != NULL && desc != datasaved); ret = gdbwrap_readmem(desc, linaddr, 1); /* Fix: not clean. ATOH is not clean when returning an unsigned. */ atohresult = gdbwrap_atoh(ret, 2 * 1); memcpy(datasaved, &atohresult, 1); gdbwrap_writemem(desc, linaddr, &bp, sizeof(u_char)); }