mirror of
https://github.com/radareorg/radare2.git
synced 2024-12-03 10:51:01 +00:00
Fix #6475 - Show offset flags in pxr
This commit is contained in:
parent
7272dac44b
commit
c646b99724
@ -1,4 +1,4 @@
|
||||
/* radare - LGPL - Copyright 2009-2016 - nibble, pancake */
|
||||
/* radare - LGPL - Copyright 2009-2017 - nibble, pancake */
|
||||
#if 0
|
||||
* Use RList
|
||||
* Support callback for null command (why?)
|
||||
|
@ -1214,7 +1214,7 @@ R_API void r_core_debug_rr(RCore *core, RReg *reg) {
|
||||
continue;
|
||||
}
|
||||
value = r_reg_get_value (core->dbg->reg, r);
|
||||
rrstr = r_core_anal_hasrefs (core, value);
|
||||
rrstr = r_core_anal_hasrefs (core, value, true);
|
||||
if (bits == 64) {
|
||||
if (r->flags) {
|
||||
tmp = r_reg_get_bvalue (reg, r);
|
||||
|
@ -707,7 +707,7 @@ static int cmd_help(void *data, const char *input) {
|
||||
case 'w':
|
||||
{
|
||||
ut64 addr = r_num_math (core->num, input + 1);
|
||||
const char *rstr = core->print->hasrefs (core->print->user, addr);
|
||||
const char *rstr = core->print->hasrefs (core->print->user, addr, true);
|
||||
r_cons_println (rstr);
|
||||
}
|
||||
break;
|
||||
|
@ -3839,7 +3839,7 @@ static int cmd_print(void *data, const char *input) {
|
||||
RFlagItem *f;
|
||||
ut32 v = r_read_ble32 (core->block + i, core->print->big_endian);
|
||||
if (p && p->colorfor) {
|
||||
a = p->colorfor (p->user, v);
|
||||
a = p->colorfor (p->user, v, true);
|
||||
if (a && *a) {
|
||||
b = Color_RESET;
|
||||
} else {
|
||||
@ -3886,7 +3886,7 @@ static int cmd_print(void *data, const char *input) {
|
||||
// XXX: this only works in little endian
|
||||
withref = 0;
|
||||
if (core->print->hasrefs) {
|
||||
const char *rstr = core->print->hasrefs (core->print->user, val);
|
||||
const char *rstr = core->print->hasrefs (core->print->user, val, true);
|
||||
if (rstr && *rstr) {
|
||||
char *ns; //r_str_ansi_chop (ns, -1, 0);
|
||||
ns = r_str_escape (rstr);
|
||||
@ -3933,7 +3933,7 @@ static int cmd_print(void *data, const char *input) {
|
||||
RFlagItem *f;
|
||||
ut64 v = (ut64)r_read_ble16 (core->block + i, p->big_endian);
|
||||
if (p && p->colorfor) {
|
||||
a = p->colorfor (p->user, v);
|
||||
a = p->colorfor (p->user, v, true);
|
||||
if (a && *a) {
|
||||
b = Color_RESET;
|
||||
} else {
|
||||
@ -3976,7 +3976,7 @@ static int cmd_print(void *data, const char *input) {
|
||||
RFlagItem *f;
|
||||
ut64 v = r_read_ble64 (core->block + i, p->big_endian);
|
||||
if (p && p->colorfor) {
|
||||
a = p->colorfor (p->user, v);
|
||||
a = p->colorfor (p->user, v, true);
|
||||
if (a && *a) {
|
||||
b = Color_RESET;
|
||||
} else {
|
||||
|
@ -1274,8 +1274,15 @@ static int is_string (const ut8 *buf, int size, int *len) {
|
||||
}
|
||||
|
||||
static char *r_core_anal_hasrefs_to_depth(RCore *core, ut64 value, int depth);
|
||||
R_API char *r_core_anal_hasrefs(RCore *core, ut64 value) {
|
||||
return r_core_anal_hasrefs_to_depth(core, value, r_config_get_i(core->config, "hex.depth"));
|
||||
R_API char *r_core_anal_hasrefs(RCore *core, ut64 value, bool verbose) {
|
||||
if (verbose) {
|
||||
return r_core_anal_hasrefs_to_depth(core, value, r_config_get_i (core->config, "hex.depth"));
|
||||
}
|
||||
RFlagItem *fi = r_flag_get_i (core->flags, value);
|
||||
if (fi) {
|
||||
return strdup (fi->name);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static char *r_core_anal_hasrefs_to_depth(RCore *core, ut64 value, int depth) {
|
||||
@ -1284,8 +1291,7 @@ static char *r_core_anal_hasrefs_to_depth(RCore *core, ut64 value, int depth) {
|
||||
RIOSection *sect;
|
||||
char *mapname;
|
||||
RAnalFunction *fcn;
|
||||
RFlagItem *fi;
|
||||
fi = r_flag_get_i (core->flags, value);
|
||||
RFlagItem *fi = r_flag_get_i (core->flags, value);
|
||||
type = r_core_anal_address (core, value);
|
||||
fcn = r_anal_get_fcn_in (core->anal, value, 0);
|
||||
if (value && value != UT64_MAX) {
|
||||
@ -1312,7 +1318,7 @@ static char *r_core_anal_hasrefs_to_depth(RCore *core, ut64 value, int depth) {
|
||||
if (fi) r_strbuf_appendf (s, " %s", fi->name);
|
||||
if (fcn) r_strbuf_appendf (s, " %s", fcn->name);
|
||||
if (type) {
|
||||
const char *c = r_core_anal_optype_colorfor (core, value);
|
||||
const char *c = r_core_anal_optype_colorfor (core, value, true);
|
||||
const char *cend = (c && *c) ? Color_RESET: "";
|
||||
if (!c) c = "";
|
||||
if (type & R_ANAL_ADDR_TYPE_HEAP) {
|
||||
@ -1408,10 +1414,11 @@ static char *r_core_anal_hasrefs_to_depth(RCore *core, ut64 value, int depth) {
|
||||
return r_strbuf_drain (s);
|
||||
}
|
||||
|
||||
R_API const char *r_core_anal_optype_colorfor(RCore *core, ut64 addr) {
|
||||
R_API const char *r_core_anal_optype_colorfor(RCore *core, ut64 addr, bool verbose) {
|
||||
ut64 type;
|
||||
if (!(core->print->flags & R_PRINT_FLAGS_COLOR))
|
||||
if (!(core->print->flags & R_PRINT_FLAGS_COLOR)) {
|
||||
return NULL;
|
||||
}
|
||||
type = r_core_anal_address (core, addr);
|
||||
if (type & R_ANAL_ADDR_TYPE_EXEC)
|
||||
return core->cons->pal.ai_exec; //Color_RED;
|
||||
|
@ -338,7 +338,7 @@ R_API int r_core_process_input_pade(RCore *core, const char *input, char** hex,
|
||||
R_API RAnalOp* r_core_anal_op(RCore *core, ut64 addr);
|
||||
R_API void r_core_anal_esil (RCore *core, const char *str, const char *addr);
|
||||
R_API void r_core_anal_fcn_merge (RCore *core, ut64 addr, ut64 addr2);
|
||||
R_API const char *r_core_anal_optype_colorfor(RCore *core, ut64 addr);
|
||||
R_API const char *r_core_anal_optype_colorfor(RCore *core, ut64 addr, bool verbose);
|
||||
R_API ut64 r_core_anal_address (RCore *core, ut64 addr);
|
||||
R_API void r_core_anal_undefine (RCore *core, ut64 off);
|
||||
R_API void r_core_anal_hint_print (RAnal* a, ut64 addr, int mode);
|
||||
@ -556,7 +556,7 @@ typedef struct {
|
||||
RCoreAnalStatsItem *block;
|
||||
} RCoreAnalStats;
|
||||
|
||||
R_API char *r_core_anal_hasrefs(RCore *core, ut64 value);
|
||||
R_API char *r_core_anal_hasrefs(RCore *core, ut64 value, bool verbose);
|
||||
R_API RCoreAnalStats* r_core_anal_get_stats (RCore *a, ut64 from, ut64 to, ut64 step);
|
||||
R_API void r_core_anal_stats_free (RCoreAnalStats *s);
|
||||
R_API void r_core_anal_list_vtables(void *core, bool printJson);
|
||||
|
@ -24,7 +24,7 @@ extern "C" {
|
||||
|
||||
typedef int (*RPrintZoomCallback)(void *user, int mode, ut64 addr, ut8 *bufz, ut64 size);
|
||||
typedef const char *(*RPrintNameCallback)(void *user, ut64 addr);
|
||||
typedef const char *(*RPrintColorFor)(void *user, ut64 addr);
|
||||
typedef const char *(*RPrintColorFor)(void *user, ut64 addr, bool verbose);
|
||||
|
||||
typedef struct r_print_zoom_t {
|
||||
ut8 *buf;
|
||||
|
@ -855,7 +855,7 @@ R_API void r_print_hexdump(RPrint *p, ut64 addr, const ut8 *buf, int len, int ba
|
||||
r_print_cursor (p, j, 1);
|
||||
// stub for colors
|
||||
if (p && p->colorfor) {
|
||||
a = p->colorfor (p->user, n);
|
||||
a = p->colorfor (p->user, n, true);
|
||||
if (a && *a) { b = Color_RESET; } else { a = b = ""; }
|
||||
} else {
|
||||
a = b = "";
|
||||
@ -910,14 +910,19 @@ R_API void r_print_hexdump(RPrint *p, ut64 addr, const ut8 *buf, int len, int ba
|
||||
if (col == 2) printfmt("|");
|
||||
if (p && p->flags & R_PRINT_FLAGS_REFS) {
|
||||
ut64 *foo = (ut64*)(buf + i);
|
||||
ut64 addr = *foo;
|
||||
ut64 off = *foo;
|
||||
if (base == 32) {
|
||||
addr &= UT32_MAX;
|
||||
off &= UT32_MAX;
|
||||
}
|
||||
if (p->hasrefs) {
|
||||
const char *rstr = p->hasrefs (p->user, addr);
|
||||
if (rstr && *rstr)
|
||||
const char *rstr = p->hasrefs (p->user, addr + i, false);
|
||||
if (rstr && *rstr) {
|
||||
printfmt (" @%s", rstr);
|
||||
}
|
||||
rstr = p->hasrefs (p->user, off, true);
|
||||
if (rstr && *rstr) {
|
||||
printfmt ("%s", rstr);
|
||||
}
|
||||
}
|
||||
}
|
||||
printfmt ("\n");
|
||||
|
Loading…
Reference in New Issue
Block a user