Handle ^C in aab and abb

This commit is contained in:
pancake 2017-07-10 22:45:24 +02:00
parent 66f5520740
commit 389a8283e3
2 changed files with 20 additions and 1 deletions

View file

@ -232,6 +232,9 @@ R_API bool core_anal_bbs(RCore *core, const char* input) {
}
while (cur < size) {
if (r_cons_is_breaked ()) {
break;
}
// magic number to fix huge section of invalid code fuzz files
if (block_score < invalid_instruction_barrier) {
break;
@ -320,6 +323,9 @@ R_API bool core_anal_bbs(RCore *core, const char* input) {
eprintf ("Failed to get next block from list\n");
continue;
}
if (r_cons_is_breaked ()) {
break;
}
if (block_list->length > 0) {
bb_t *next_block = (bb_t*) r_list_iter_get_data (block_list->tail);
@ -375,6 +381,9 @@ R_API bool core_anal_bbs(RCore *core, const char* input) {
// we simply assume that non reached blocks or called blocks
// are functions
r_list_foreach (result, iter, block) {
if (r_cons_is_breaked ()) {
break;
}
if (block && (block->reached == 0 || block->called >= 1)) {
fcn_t* current_function = fcnNew (block);
RStack *stack = r_stack_new (100);

View file

@ -3726,6 +3726,8 @@ static void cmd_anal_blocks(RCore *core, const char *input) {
RIOSection *s;
ut64 min = UT64_MAX;
ut64 max = 0;
r_cons_break_push (NULL, NULL);
r_list_foreach (core->io->sections, iter, s) {
/* is executable */
if (!(s->flags & R_IO_EXEC)) {
@ -3734,12 +3736,20 @@ static void cmd_anal_blocks(RCore *core, const char *input) {
min = s->vaddr;
max = s->vaddr + s->vsize;
r_core_cmdf (core, "abb%s 0x%08"PFMT64x" @ 0x%08"PFMT64x, input, (max - min), min);
if (r_cons_is_breaked ()) {
goto ctrl_c;
}
}
if (r_list_empty (core->io->sections)) {
min = core->offset;
max = 0xffff + min;
r_core_cmdf (core, "abb%s 0x%08"PFMT64x" @ 0x%08"PFMT64x, input, (max - min), min);
if (r_cons_is_breaked ()) {
goto ctrl_c;
}
}
ctrl_c:
r_cons_break_pop ();
}
static void _anal_calls(RCore *core, ut64 addr, ut64 addr_end) {
@ -5731,7 +5741,7 @@ static int cmd_anal(void *data, const char *input) {
}
break;
case 'b':
if (input[1] == 'b') {
if (input[1] == 'b') { // "abb"
core_anal_bbs (core, input + 2);
} else if (input[1] == ' ' || input[1] == 'j') {
ut8 *buf = malloc (strlen (input) + 1);