/** * 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)); }
static int __write(RIO *io, RIODesc *fd, const ut8 *buf, int count) { gdbwrap_writemem (RIOGDB_DESC (fd), io->off, (void *)buf, count); return count; }
void gdbwrap_delbp(gdbwrap_t *desc, la32 linaddr, void *datasaved) { gdbwrap_writemem(desc, linaddr, datasaved, sizeof(u_char)); }