Fix #6456 - Show cursor in data words

This commit is contained in:
pancake 2017-03-10 18:09:23 +01:00
parent 2df1e547ae
commit 8f34c0b2a5

View File

@ -1864,7 +1864,8 @@ static void ds_adistrick_comments(RDisasmState *ds) {
}
static bool ds_print_data_type(RCore *core, const ut8 *buf, int ib, int size) {
static bool ds_print_data_type(RDisasmState *ds, const ut8 *buf, int ib, int size) {
RCore *core = ds->core;
const char *type = NULL;
char msg[64];
const int isSigned = (ib == 1 || ib == 8 || ib == 10)? 1: 0;
@ -1876,6 +1877,23 @@ static bool ds_print_data_type(RCore *core, const ut8 *buf, int ib, int size) {
default: return false;
}
ut64 n = r_read_ble (buf, core->print->big_endian, size * 8);
{
int q = core->print->cur_enabled &&
ds->cursor >= ds->index &&
ds->cursor < (ds->index + size);
if (q) {
if (ds->cursor > ds->index) {
int diff = ds->cursor - ds->index;
r_cons_printf (" %d ", diff);
} else if (ds->cursor == ds->index) {
r_cons_printf (" * ");
} else {
r_cons_printf (" ");
}
} else {
r_cons_printf (" ");
}
}
switch (ib) {
case 1:
@ -1998,7 +2016,7 @@ static int ds_print_meta_infos(RDisasmState *ds, ut8* buf, int len, int idx) {
}
ds->oplen = mi->size - delta;
core->print->flags &= ~R_PRINT_FLAGS_HEADER;
if (!ds_print_data_type (core, buf + idx, ds->hint? ds->hint->immbase: 0, mi->size)) {
if (!ds_print_data_type (ds, buf + idx, ds->hint? ds->hint->immbase: 0, mi->size)) {
r_cons_printf ("hex length=%" PFMT64d " delta=%d\n", mi->size , delta);
r_print_hexdump (core->print, ds->at, buf+idx, hexlen-delta, 16, 1);
}