Add scr.visual, Fix BinBios section loading (rva issue)

This commit is contained in:
pancake 2014-09-28 03:27:22 +02:00
parent 461ffd6907
commit 0248e53fb6
6 changed files with 27 additions and 3 deletions

View File

@ -105,7 +105,8 @@ static RList* entries(RBinFile *arch) {
ret->free = free;
if (!(ptr = R_NEW0 (RBinAddr)))
return ret;
ptr->paddr = ptr->vaddr = 0xffff0;
ptr->paddr = 0x70000;
ptr->vaddr = 0xffff0;
r_list_append (ret, ptr);
return ret;
}

View File

@ -25,6 +25,8 @@ static ut64 rva (RBin *bin, int va, ut64 paddr, ut64 vaddr, ut64 baddr, ut64 lad
case 1: // va $ rabin2
return r_bin_get_vaddr (bin, baddr, paddr, vaddr);
case 2: // la $ rabin2 -B
if (!baddr && !laddr)
return vaddr;
return paddr + laddr;
}
return vaddr;
@ -1013,6 +1015,7 @@ static int bin_sections (RCore *r, int mode, ut64 baddr, ut64 laddr, int va, ut6
r_list_foreach (sections, iter, section) {
ut64 addr = rva (r->bin, va, section->paddr, section->vaddr, baddr, laddr);
addr = section->vaddr; // this line fixes rbin_bios
if (name && strcmp (section->name, name))
continue;
r_name_filter (section->name, sizeof (section->name));

View File

@ -972,8 +972,11 @@ static void esil_step(RCore *core, ut64 until_addr, const char *until_expr) {
r_anal_esil_stack_free (esil);
}
ut64 newaddr = r_reg_getv (core->anal->reg, name);
if (addr == newaddr)
if (addr == newaddr) {
if (op.size<1)
op.size = 1; // avoid inverted stepping
r_reg_setv (core->anal->reg, name, addr + op.size);
}
// check addr
if (until_addr != UT64_MAX) {
if (addr == until_addr) {

View File

@ -969,6 +969,7 @@ R_API int r_core_config_init(RCore *core) {
SETICB("scr.fix_columns", 0, &cb_fixcolumns, "Workaround for Prompt iOS ssh client");
SETCB("scr.highlight", "", &cb_scrhighlight, "Highligh that word at RCons level");
SETCB("scr.interactive", "true", &cb_scrint, "Start in interractive mode");
SETI("scr.feedback", 1, "Set visual feedback level (1=arrow on jump, 2=every key (useful for videos))");
SETCB("scr.html", "false", &cb_scrhtml, "If enabled disassembly uses HTML syntax");
SETCB("scr.nkey", "hit", &cb_scrnkey, "Select the seek mode in visual");
SETCB("scr.pager", "", &cb_pager, "Select pager program (used if output doesn't fit on window)");

View File

@ -319,7 +319,22 @@ static void visual_search (RCore *core) {
}
}
R_API void r_core_visual_show_char (RCore *core, char ch) {
if (r_config_get_i (core->config, "scr.feedback")<2)
return;
if (!IS_PRINTABLE(ch))
return;
r_cons_gotoxy (1, 2);
r_cons_printf (".---.\n");
r_cons_printf ("| %c |\n", ch);
r_cons_printf ("'---'\n");
r_cons_flush ();
r_sys_usleep (90000);
}
R_API void r_core_visual_seek_animation (RCore *core, ut64 addr) {
if (r_config_get_i (core->config, "scr.feedback")<1)
return;
#if 0
int i, ns = 90000;
const char *scmd = (addr > core->offset)? "so": "s-4";
@ -1469,6 +1484,7 @@ R_API int r_core_visual(RCore *core, const char *input) {
r_core_cmd (core, cmdprompt, 0);
r_core_visual_refresh (core);
ch = r_cons_readchar ();
r_core_visual_show_char (core, ch);
if (ch==-1 || ch==4) break; // error or eof
} while (r_core_visual_cmd (core, ch));

View File

@ -1251,7 +1251,7 @@ R_API void r_core_visual_define (RCore *core) {
{
int h;
(void)r_cons_get_size (&h);
h-=18;
h-=19;
if (h<0) {
r_cons_clear00 ();
} else {