mirror of
https://github.com/radareorg/radare2.git
synced 2025-01-01 10:38:51 +00:00
Handle ^C in /R and /R/
This commit is contained in:
parent
6706fb7c7b
commit
68955c2d46
@ -876,13 +876,10 @@ static int get_debug_info(PE_(image_debug_directory_entry) *dbg_dir_entry, ut8 *
|
||||
case IMAGE_DEBUG_TYPE_CODEVIEW:
|
||||
if (strncmp((char *)dbg_data, "RSDS", 4) == 0) {
|
||||
SCV_RSDS_HEADER rsds_hdr;
|
||||
|
||||
init_rsdr_hdr(&rsds_hdr);
|
||||
memset(res->guidstr, 0, 33);
|
||||
memset(res->file_name, 0, SIZEOF_FILE_NAME);
|
||||
|
||||
get_rsds(dbg_data, &rsds_hdr);
|
||||
sprintf((st8 *) res->guidstr, "%08x%04x%04x%02x%02x%02x%02x%02x%02x%02x%02x%x",
|
||||
init_rsdr_hdr (&rsds_hdr);
|
||||
get_rsds (dbg_data, &rsds_hdr);
|
||||
snprintf ((st8 *) res->guidstr, 33,
|
||||
"%08x%04x%04x%02x%02x%02x%02x%02x%02x%02x%02x%x",
|
||||
rsds_hdr.guid.data1,
|
||||
rsds_hdr.guid.data2,
|
||||
rsds_hdr.guid.data3,
|
||||
@ -895,28 +892,17 @@ static int get_debug_info(PE_(image_debug_directory_entry) *dbg_dir_entry, ut8 *
|
||||
rsds_hdr.guid.data4[6],
|
||||
rsds_hdr.guid.data4[7],
|
||||
rsds_hdr.age);
|
||||
|
||||
if (strlen((st8 *)rsds_hdr.file_name) < SIZEOF_FILE_NAME) {
|
||||
strcpy((st8 *)res->file_name, (st8 *)rsds_hdr.file_name);
|
||||
}
|
||||
|
||||
rsds_hdr.free((struct SCV_RSDS_HEADER *)&rsds_hdr);
|
||||
} else if (strncmp((char *)dbg_data, "NB10", 4) == 0) {
|
||||
strncpy (res->file_name, rsds_hdr.file_name, SIZEOF_FILE_NAME-1);
|
||||
res->file_name[SIZEOF_FILE_NAME] = 0;
|
||||
rsds_hdr.free ((struct SCV_RSDS_HEADER *)&rsds_hdr);
|
||||
} else if (strncmp((const char *)dbg_data, "NB10", 4) == 0) {
|
||||
SCV_NB10_HEADER nb10_hdr;
|
||||
|
||||
init_cv_nb10_header(&nb10_hdr);
|
||||
memset(res->guidstr, 0, 33);
|
||||
memset(res->file_name, 0, 255);
|
||||
|
||||
get_nb10(dbg_data, &nb10_hdr);
|
||||
|
||||
snprintf((st8 *) res->guidstr, sizeof (res->guidstr), "%x%x",
|
||||
nb10_hdr.timestamp, nb10_hdr.age);
|
||||
|
||||
if (strlen((st8 *)nb10_hdr.file_name) < SIZEOF_FILE_NAME) {
|
||||
strcpy((st8 *)res->file_name, (st8 *)nb10_hdr.file_name);
|
||||
}
|
||||
|
||||
strncpy (res->file_name, rsds_hdr.file_name, SIZEOF_FILE_NAME-1);
|
||||
res->file_name[SIZEOF_FILE_NAME] = 0;
|
||||
nb10_hdr.free((struct SCV_NB10_HEADER *)&nb10_hdr);
|
||||
} else {
|
||||
eprintf("CodeView section not NB10 or RSDS\n");
|
||||
@ -925,7 +911,7 @@ static int get_debug_info(PE_(image_debug_directory_entry) *dbg_dir_entry, ut8 *
|
||||
|
||||
break;
|
||||
default:
|
||||
eprintf("get_debug_info(): not supported type\n");
|
||||
//eprintf("get_debug_info(): not supported type\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -669,8 +669,8 @@ static int r_core_search_rop(RCore *core, ut64 from, ut64 to, int opt, const cha
|
||||
if (json)
|
||||
r_cons_printf ("[");
|
||||
|
||||
r_cons_break (NULL, NULL);
|
||||
r_list_foreach (list, itermap, map) {
|
||||
|
||||
from = map->from;
|
||||
to = map->to;
|
||||
|
||||
@ -703,6 +703,8 @@ static int r_core_search_rop(RCore *core, ut64 from, ut64 to, int opt, const cha
|
||||
if (is_end_gadget(end_gadget, crop)) {
|
||||
r_list_append(end_list, (void*)(intptr_t)i);
|
||||
}
|
||||
if (r_cons_singleton()->breaked)
|
||||
break;
|
||||
// Right now we have a list of all of the end/stop gadgets.
|
||||
// We can just construct gadgets from a little bit before them.
|
||||
}
|
||||
@ -713,10 +715,14 @@ static int r_core_search_rop(RCore *core, ut64 from, ut64 to, int opt, const cha
|
||||
// Get the depth of rop search, should just be max_instr
|
||||
// instructions, x86 and friends are weird length instructions, so
|
||||
// we'll just assume 15 byte instructions.
|
||||
if (r_cons_singleton()->breaked)
|
||||
break;
|
||||
int ropdepth = increment == 1 ? max_instr * 15 /* wow, x86 is long */ : max_instr * increment;
|
||||
next = (intptr_t)r_list_pop (end_list);
|
||||
// Start at just before the first end gadget.
|
||||
for (i = next - ropdepth; i < (delta - 15 /* max insn size */); i+=increment) {
|
||||
if (r_cons_singleton()->breaked)
|
||||
break;
|
||||
if (i >= next) {
|
||||
// We've exhausted the first end-gadget section,
|
||||
// move to the next one.
|
||||
@ -807,6 +813,9 @@ static int r_core_search_rop(RCore *core, ut64 from, ut64 to, int opt, const cha
|
||||
}
|
||||
free (buf);
|
||||
}
|
||||
if (r_cons_singleton()->breaked)
|
||||
eprintf ("\n");
|
||||
r_cons_break_end ();
|
||||
|
||||
if (json)
|
||||
r_cons_printf ("]\n");
|
||||
|
Loading…
Reference in New Issue
Block a user