Add conditional watchpoint (#8321)

This commit is contained in:
Ren Kimura 2017-08-27 01:57:51 +09:00 committed by radare
parent c4dd3bd9b0
commit 816c5ee244
2 changed files with 27 additions and 13 deletions

View File

@ -36,16 +36,3 @@ R_API RBreakpointItem* r_bp_watch_add(RBreakpoint *bp, ut64 addr, int size, int
R_API void r_bp_watch_del() {
}
/* TODO: move into _watch */
R_API int r_bp_add_cond(struct r_bp_t *bp, const char *cond) {
// TODO: implement contitional breakpoints
bp->stepcont = true;
return 0;
}
R_API int r_bp_del_cond(struct r_bp_t *bp, int idx) {
// add contitional
bp->stepcont = false;
return true;
}

View File

@ -3036,6 +3036,33 @@ static void r_core_cmd_bp(RCore *core, const char *input) {
}
break;
case 'w': // "dbw"
if (input[2] == 'C') { // "dbwC"
if (input[3] == ' ') {
char *inp = strdup (input + 4);
if (inp) {
char *arg = strchr (inp, ' ');
if (arg) {
*arg++ = 0;
addr = r_num_math (core->num, inp);
bpi = r_bp_get_at (core->dbg->bp, addr);
if (bpi) {
free (bpi->cond);
bpi->cond = strdup (arg);
} else {
eprintf ("No breakpoint defined at 0x%08"PFMT64x"\n", addr);
}
} else {
eprintf ("1 Missing argument\n");
}
free (inp);
} else {
eprintf ("Cannot strdup. Your heap is fucked up\n");
}
} else {
eprintf ("Use: dbwC [addr] [command]\n");
}
break;
}
input++; // skip 'w'
watch = true;
// passthru