Enhance Vx visualization

This commit is contained in:
pancake 2016-12-26 13:51:12 +01:00
parent 20da3b53fe
commit d78af7acf6

View File

@ -720,14 +720,18 @@ repeat:
r_cons_any_key (NULL);
r_cons_clear00 ();
} else {
int lines;
(void)r_cons_get_size (&lines);
int rows, cols = r_cons_get_size (&rows);
idx = 0;
count = 0;
lines -= 3;
rows -= 3;
// int maxcount = rows > 20 ? 9: 4;
int maxcount = cols < 90 ? 4: 9;
r_list_foreach (xrefs, iter, refi) {
if (idx > maxcount) {
break;
}
if (idx >= skip) {
if (count > 9) {
if (count > maxcount) {
strcpy (cstr, "?");
} else {
snprintf (cstr, sizeof (cstr), "%d", count);
@ -739,10 +743,22 @@ repeat:
refi->type==R_ANAL_REF_TYPE_CALL?"CODE (CALL)":"DATA",
fun?fun->name:"unk");
if (idx == skip) {
r_core_cmdf (core, "pd 20 @ 0x%08"PFMT64x, refi->addr);
r_cons_column (60);
if (cols > 90) {
char *dis = r_core_cmd_strf (core, "pd $r-10 @ 0x%08"PFMT64x, refi->addr);
char *d = r_str_ansi_crop (dis, 0, 0, cols - 50, rows - 3);
r_cons_printf ("%s", d);
r_cons_column (50);
free (d);
free (dis);
} else {
char *dis = r_core_cmd_strf (core, "pd $r-10 @ 0x%08"PFMT64x, refi->addr);
char *d = r_str_ansi_crop (dis, 0, 0, cols, rows - 10);
r_cons_printf ("%s", d);
free (d);
free (dis);
}
}
if (++count >= lines) {
if (++count >= rows) {
r_cons_printf ("...\n");
break;
}