Fixes in RCore's disassembler
This commit is contained in:
parent
23bd67ce59
commit
56b442fb70
|
@ -40,6 +40,21 @@ static int step_until(RCore *core, ut64 addr) {
|
||||||
return R_TRUE;
|
return R_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* until end of frame */
|
||||||
|
static int step_until_eof(RCore *core) {
|
||||||
|
ut64 off, now = r_debug_reg_get (core->dbg, "sp");
|
||||||
|
do {
|
||||||
|
r_debug_step (core->dbg, 1);
|
||||||
|
if (checkbpcallback (core)) {
|
||||||
|
eprintf ("Interrupted by a breakpoint\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
off = r_debug_reg_get (core->dbg, "sp");
|
||||||
|
// check breakpoint here
|
||||||
|
} while (off <= now);
|
||||||
|
return R_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
static int step_line(RCore *core, int times) {
|
static int step_line(RCore *core, int times) {
|
||||||
char file[512], file2[512];
|
char file[512], file2[512];
|
||||||
int find_meta, line = -1, line2 = -1;
|
int find_meta, line = -1, line2 = -1;
|
||||||
|
@ -732,9 +747,13 @@ static int cmd_debug(void *data, const char *input) {
|
||||||
" dso 3 step over 3 instructions\n"
|
" dso 3 step over 3 instructions\n"
|
||||||
" dsp step into program (skip libs)\n"
|
" dsp step into program (skip libs)\n"
|
||||||
" dsu addr step until address\n"
|
" dsu addr step until address\n"
|
||||||
|
" dsf step until end of frame\n"
|
||||||
" dsl step one source line\n"
|
" dsl step one source line\n"
|
||||||
" dsl 40 step 40 source lines\n");
|
" dsl 40 step 40 source lines\n");
|
||||||
break;
|
break;
|
||||||
|
case 'f':
|
||||||
|
step_until_eof(core);
|
||||||
|
break;
|
||||||
case 'u':
|
case 'u':
|
||||||
r_reg_arena_swap (core->dbg->reg, R_TRUE);
|
r_reg_arena_swap (core->dbg->reg, R_TRUE);
|
||||||
step_until (core, r_num_math (core->num, input+2)); // XXX dupped by times
|
step_until (core, r_num_math (core->num, input+2)); // XXX dupped by times
|
||||||
|
|
|
@ -254,10 +254,11 @@ toro:
|
||||||
lastfail = 1;
|
lastfail = 1;
|
||||||
strcpy (asmop.buf_asm, "invalid");
|
strcpy (asmop.buf_asm, "invalid");
|
||||||
sprintf (asmop.buf_hex, "%02x", buf[idx]);
|
sprintf (asmop.buf_hex, "%02x", buf[idx]);
|
||||||
r_cons_printf ("%d %d\n", lines, l);
|
|
||||||
// HACK protection against 'invalid' false positives
|
// HACK protection against 'invalid' false positives
|
||||||
|
tries++;
|
||||||
|
if (tries>5) break;
|
||||||
if ((lines+10)<l) {// && (idx+5)<len) {
|
if ((lines+10)<l) {// && (idx+5)<len) {
|
||||||
tries++;
|
lines++;
|
||||||
goto retry;
|
goto retry;
|
||||||
} else {
|
} else {
|
||||||
break;
|
break;
|
||||||
|
@ -736,14 +737,13 @@ else
|
||||||
buf = nbuf = malloc (len);
|
buf = nbuf = malloc (len);
|
||||||
if (tries>1) {
|
if (tries>1) {
|
||||||
addr += 1;
|
addr += 1;
|
||||||
if (r_core_read_at (core, addr, buf, len) != len)
|
if (r_core_read_at (core, addr, buf, len) == len)
|
||||||
goto retryback;
|
goto toro;
|
||||||
goto toro;
|
|
||||||
}
|
}
|
||||||
if (invbreak && lines<l) {
|
if (invbreak && lines<l) {
|
||||||
addr += idx;
|
addr += idx;
|
||||||
if (r_core_read_at (core, addr, buf, len) != len) {
|
if (r_core_read_at (core, addr, buf, len) != len) {
|
||||||
tries = -1;
|
//tries = -1;
|
||||||
}
|
}
|
||||||
goto toro;
|
goto toro;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue