- Fix r_bp_restore NULL ptr exception and extra loop over list

- Remove debug printf in debug_gdb
This commit is contained in:
Eloi Sanfelix 2011-05-08 18:51:23 +02:00
parent 9c3538308a
commit ed15598061
2 changed files with 18 additions and 16 deletions

View File

@ -57,24 +57,27 @@ R_API int r_debug_bp_add(struct r_debug_t *dbg, ut64 addr, int size, int hw, int
R_API int r_bp_restore(struct r_bp_t *bp, int set) {
RListIter *iter;
RBreakpointItem *b;
int handled;
r_list_foreach (bp->bps, iter, b) {
bp->breakpoint (bp->user, set, b->addr, b->hw, b->rwx);
}
/* write obytes from every breakpoint in r_bp */
if (set) {
r_list_foreach (bp->bps, iter, b) {
if (b->hw || !b->obytes)
eprintf ("hw breakpoints not supported yet\n");
else bp->iob.write_at (bp->iob.io, b->addr, b->obytes, b->size);
}
} else {
r_list_foreach (bp->bps, iter, b) {
if (b->hw || !b->bbytes)
eprintf ("hw breakpoints not supported yet\n");
else bp->iob.write_at (bp->iob.io, b->addr, b->bbytes, b->size);
}
if(bp->breakpoint)
handled = bp->breakpoint (bp->user, set, b->addr, b->hw, b->rwx);
else
handled = R_FALSE;
/* write obytes from every breakpoint in r_bp if not handled by plugin */
if (!handled)
if (set) {
if (b->hw || !b->obytes)
eprintf ("hw breakpoints not supported yet\n");
else bp->iob.write_at (bp->iob.io, b->addr, b->obytes, b->size);
} else {
if (b->hw || !b->bbytes)
eprintf ("hw breakpoints not supported yet\n");
else bp->iob.write_at (bp->iob.io, b->addr, b->bbytes, b->size);
}
}
return R_TRUE;
}

View File

@ -35,7 +35,6 @@ static int r_debug_gdb_reg_read(RDebug *dbg, int type, ut8 *buf, int size) {
// TODO: bounds check!!!
for (i=0; i< desc->num_registers ; i++) {
ut64 p = (ut64)gdbwrap_getreg (desc, i);
eprintf ( " Register: %d , value: %#x\n",i,p);
memcpy (buf+(i*desc->reg_size), &p, desc->reg_size);
}
return desc->num_registers*desc->reg_size;