diff --git a/libr/core/visual.c b/libr/core/visual.c index 99836fae13..dddd0e39a7 100644 --- a/libr/core/visual.c +++ b/libr/core/visual.c @@ -345,8 +345,9 @@ static int prevopsz (RCore *core, ut64 addr) { R_API int r_core_visual_cmd(RCore *core, int ch) { RAsmOp op; + ut64 offset = core->offset; char buf[4096]; - int i, ret, offscreen, cols = core->print->cols; + int i, ret, offscreen, cols = core->print->cols, delta = 0; ch = r_cons_arrow_to_hjkl (ch); ch = visual_nkey (core, ch); if (ch<2) return 1; @@ -355,8 +356,8 @@ R_API int r_core_visual_cmd(RCore *core, int ch) { if (ch>='0'&& ch<='9') { ut64 off = core->asmqjmps[ch-'0']; if (off != UT64_MAX) { - int delta = R_ABS ((st64)off-(st64)core->offset); - r_io_sundo_push (core->io, core->offset); + int delta = R_ABS ((st64)off-(st64)offset); + r_io_sundo_push (core->io, offset); if (curset && delta<100) { cursor = delta; } else { @@ -379,7 +380,7 @@ R_API int r_core_visual_cmd(RCore *core, int ch) { if (f == t && f == 0) { core->print->col = core->print->col==1? 2: 1; } else { - ut64 delta = core->offset - f; + ut64 delta = offset - f; r_core_seek (core, t+delta, 1); r_config_set_i (core->config, "diff.from", t); r_config_set_i (core->config, "diff.to", f); @@ -492,14 +493,21 @@ R_API int r_core_visual_cmd(RCore *core, int ch) { buf[0]='\0'; strcat (buf, "\""); } else { - strcpy (buf, "wx "); r_line_set_prompt ("insert hex: "); - if (r_cons_fgets (buf+3, sizeof (buf)-4, 0, NULL) <0) + if (ocursor != -1) { + int bs = R_ABS (cursor-ocursor)+1; + core->blocksize = bs; + strcpy (buf, "wow "); + delta = R_MIN (cursor, ocursor); + } else { + strcpy (buf, "wx "); + } + if (r_cons_fgets (buf+strlen (buf), sizeof (buf)-strlen (buf), 0, NULL) <0) buf[0]='\0'; } - if (curset) r_core_seek (core, core->offset + cursor, 0); + if (curset) r_core_seek (core, core->offset + delta, 0); r_core_cmd (core, buf, 1); - if (curset) r_core_seek (core, core->offset - cursor, 1); + if (curset) r_core_seek (core, offset, 1); r_cons_set_raw (1); showcursor (core, R_FALSE); break; diff --git a/libr/debug/reg.c b/libr/debug/reg.c index 28571f6484..c1bbc5c0c2 100644 --- a/libr/debug/reg.c +++ b/libr/debug/reg.c @@ -80,11 +80,12 @@ R_API int r_debug_reg_list(RDebug *dbg, int type, int size, int rad) { switch (rad) { case 'j': dbg->printf ("%s\"%s\":%"PFMT64d, - n?",":"",item->name, value); + n?",":"", item->name, value); break; case 1: case '*': - dbg->printf ("f %s 1 0x%"PFMT64x"\n", item->name, value); + dbg->printf ("f %s 1 0x%"PFMT64x"\n", + item->name, value); break; case 'd': case 2: diff --git a/libr/reg/arena.c b/libr/reg/arena.c index 936d3df349..f59d795f03 100644 --- a/libr/reg/arena.c +++ b/libr/reg/arena.c @@ -171,6 +171,7 @@ R_API int r_reg_arena_set(RReg *reg, int n, int copy) { // XXX This is critical! return R_FALSE; } + memset (o->bytes, '\x00', o->size); } if (copy) r_reg_set_bytes (reg, i, o->bytes, a->size);