Fix #7094 - Add direction information in xrefs ##analysis

* This PR breaks the ABI, so it won't go in until 5.7
* Needs new tests and massage the broken ones
* Remove duplicated reftype.toString() method
* Make more tests run on non-x86
* Update and fix tests
This commit is contained in:
pancake 2022-04-25 22:19:23 +02:00 committed by GitHub
parent 8ec4e3b529
commit 59f9681da4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
43 changed files with 56614 additions and 56427 deletions

View File

@ -1,4 +1,4 @@
/* radare - LGPL - Copyright 2010-2021 - nibble, alvaro, pancake */
/* radare - LGPL - Copyright 2010-2022 - nibble, alvaro, pancake */
#include <r_anal.h>
#include <r_parse.h>
@ -338,7 +338,8 @@ static void check_purity(HtUP *ht, RAnalFunction *fcn) {
ht_up_insert (ht, fcn->addr, NULL);
fcn->is_pure = true;
r_list_foreach (refs, iter, ref) {
if (ref->type == R_ANAL_REF_TYPE_CALL || ref->type == R_ANAL_REF_TYPE_CODE) {
int rt = R_ANAL_REF_TYPE_MASK (ref->type);
if (rt == R_ANAL_REF_TYPE_CALL || rt == R_ANAL_REF_TYPE_CODE) {
RAnalFunction *called_fcn = r_anal_get_fcn_in (fcn->anal, ref->addr, 0);
if (!called_fcn) {
continue;
@ -351,7 +352,7 @@ static void check_purity(HtUP *ht, RAnalFunction *fcn) {
break;
}
}
if (ref->type == R_ANAL_REF_TYPE_DATA) {
if (R_ANAL_REF_TYPE_MASK (ref->type) == R_ANAL_REF_TYPE_DATA) {
fcn->is_pure = false;
break;
}
@ -880,7 +881,21 @@ repeat:
}
if (op->ptr && op->ptr != UT64_MAX && op->ptr != UT32_MAX) {
// swapped parameters wtf
r_anal_xrefs_set (anal, op->addr, op->ptr, R_ANAL_REF_TYPE_DATA);
// its read or wr
int dir = 0;
if (op->direction & R_ANAL_OP_DIR_READ) {
dir |= R_ANAL_REF_TYPE_READ;
}
if (op->direction & R_ANAL_OP_DIR_REF) {
dir |= R_ANAL_REF_TYPE_READ;
}
if (op->direction & R_ANAL_OP_DIR_WRITE) {
dir |= R_ANAL_REF_TYPE_WRITE;
}
if (op->direction & R_ANAL_OP_DIR_EXEC) {
dir |= R_ANAL_REF_TYPE_EXEC;
}
r_anal_xrefs_set (anal, op->addr, op->ptr, R_ANAL_REF_TYPE_DATA | dir);
}
if (anal->opt.vars && !varset) {
// XXX uses op.src/dst and fails because regprofile invalidates the regitems
@ -1017,7 +1032,7 @@ repeat:
} else if (try_get_delta_jmptbl_info (anal, fcn, addr, op->addr, &table_size, &default_case, &case_shift)) {
ready = true;
}
// TODO: -1-
// TODO: -1-
if (ready) {
ret = casetbl_addr == op->ptr
? try_walkthrough_jmptbl (anal, fcn, bb, depth, addr, case_shift, jmptbl_addr, op->ptr, 4, table_size, default_case, 4)
@ -1068,7 +1083,7 @@ repeat:
gotoBeach (R_ANAL_RET_END);
}
if (anal->opt.jmpref) {
(void) r_anal_xrefs_set (anal, op->addr, op->jump, R_ANAL_REF_TYPE_CODE);
(void) r_anal_xrefs_set (anal, op->addr, op->jump, R_ANAL_REF_TYPE_CODE | R_ANAL_REF_TYPE_EXEC);
}
if (!anal->opt.jmpabove && (op->jump < fcn->addr)) {
gotoBeach (R_ANAL_RET_END);
@ -1110,7 +1125,7 @@ repeat:
fcn_recurse (anal, fcn, op->jump, anal->opt.bb_max_size, depth - 1);
}
} else if (R_ABS (diff) > tc) {
(void) r_anal_xrefs_set (anal, op->addr, op->jump, R_ANAL_REF_TYPE_CALL);
(void) r_anal_xrefs_set (anal, op->addr, op->jump, R_ANAL_REF_TYPE_CALL | R_ANAL_REF_TYPE_EXEC);
fcn_recurse (anal, fcn, op->jump, anal->opt.bb_max_size, depth - 1);
gotoBeach (R_ANAL_RET_END);
}
@ -1206,7 +1221,7 @@ repeat:
case R_ANAL_OP_TYPE_CCALL:
case R_ANAL_OP_TYPE_CALL:
/* call dst */
(void) r_anal_xrefs_set (anal, op->addr, op->jump, R_ANAL_REF_TYPE_CALL);
(void) r_anal_xrefs_set (anal, op->addr, op->jump, R_ANAL_REF_TYPE_CALL | R_ANAL_REF_TYPE_EXEC);
if (r_anal_noreturn_at (anal, op->jump)) {
RAnalFunction *f = r_anal_get_function_at (anal, op->jump);
@ -1363,7 +1378,7 @@ analopfinish:
last_is_push = true;
last_push_addr = op->val;
if (anal->iob.is_valid_offset (anal->iob.io, last_push_addr, 1)) {
(void) r_anal_xrefs_set (anal, op->addr, last_push_addr, R_ANAL_REF_TYPE_DATA);
(void) r_anal_xrefs_set (anal, op->addr, last_push_addr, R_ANAL_REF_TYPE_DATA | R_ANAL_REF_TYPE_WRITE);
}
break;
case R_ANAL_OP_TYPE_UPUSH:
@ -1372,7 +1387,7 @@ analopfinish:
last_is_push = true;
last_push_addr = last_reg_mov_lea_val;
if (anal->iob.is_valid_offset (anal->iob.io, last_push_addr, 1)) {
(void) r_anal_xrefs_set (anal, op->addr, last_push_addr, R_ANAL_REF_TYPE_DATA);
(void) r_anal_xrefs_set (anal, op->addr, last_push_addr, R_ANAL_REF_TYPE_DATA | R_ANAL_REF_TYPE_WRITE);
}
}
break;
@ -1514,7 +1529,8 @@ R_API void r_anal_trim_jmprefs(RAnal *anal, RAnalFunction *fcn) {
const bool is_x86 = anal->cur->arch && !strcmp (anal->cur->arch, "x86"); // HACK
r_list_foreach (refs, iter, ref) {
if (ref->type == R_ANAL_REF_TYPE_CODE && r_anal_function_contains (fcn, ref->addr)
int rt = R_ANAL_REF_TYPE_MASK (ref->type);
if (rt == R_ANAL_REF_TYPE_CODE && r_anal_function_contains (fcn, ref->addr)
&& (!is_x86 || !r_anal_function_contains (fcn, ref->at))) {
r_anal_xrefs_deln (anal, ref->at, ref->addr, ref->type);
}
@ -1529,7 +1545,8 @@ R_API void r_anal_del_jmprefs(RAnal *anal, RAnalFunction *fcn) {
RListIter *iter;
r_list_foreach (refs, iter, ref) {
if (ref->type == R_ANAL_REF_TYPE_CODE) {
int rt = R_ANAL_REF_TYPE_MASK (ref->type);
if (rt == R_ANAL_REF_TYPE_CODE) {
r_anal_xrefs_deln (anal, ref->at, ref->addr, ref->type);
}
}
@ -1572,7 +1589,7 @@ R_API int r_anal_function(RAnal *anal, RAnalFunction *fcn, ut64 addr, ut64 len,
}
}
/* defines fcn. or loc. prefix */
fcn->type = (reftype == R_ANAL_REF_TYPE_CODE) ? R_ANAL_FCN_TYPE_LOC : R_ANAL_FCN_TYPE_FCN;
fcn->type = (R_ANAL_REF_TYPE_MASK (reftype) == R_ANAL_REF_TYPE_CODE) ? R_ANAL_FCN_TYPE_LOC : R_ANAL_FCN_TYPE_FCN;
if (fcn->addr == UT64_MAX) {
fcn->addr = addr;
}

View File

@ -1,4 +1,4 @@
/* radare - LGPL - Copyright 2010-2021 - nibble, alvaro, pancake, th3str4ng3r */
/* radare - LGPL - Copyright 2010-2022 - nibble, alvaro, pancake, th3str4ng3r */
#include <r_anal.h>
#include <r_parse.h>
@ -13,7 +13,7 @@ static void apply_case(RAnal *anal, RAnalBlock *block, ut64 switch_addr, ut64 of
// eprintf ("** apply_case: 0x%"PFMT64x " from 0x%"PFMT64x "\n", case_addr, case_addr_loc);
r_meta_set_data_at (anal, case_addr_loc, offset_sz);
r_anal_hint_set_immbase (anal, case_addr_loc, 10);
r_anal_xrefs_set (anal, switch_addr, case_addr, R_ANAL_REF_TYPE_CODE);
r_anal_xrefs_set (anal, switch_addr, case_addr, R_ANAL_REF_TYPE_CODE | R_ANAL_REF_TYPE_EXEC);
if (block) {
r_anal_block_add_switch_case (block, switch_addr, id, case_addr);
}
@ -33,7 +33,7 @@ static void apply_switch(RAnal *anal, ut64 switch_addr, ut64 jmptbl_addr, ut64 c
snprintf (tmp, sizeof (tmp), "switch.0x%08"PFMT64x, switch_addr);
anal->flb.set (anal->flb.f, tmp, switch_addr, 1);
if (default_case_addr != UT64_MAX) {
r_anal_xrefs_set (anal, switch_addr, default_case_addr, R_ANAL_REF_TYPE_CODE);
r_anal_xrefs_set (anal, switch_addr, default_case_addr, R_ANAL_REF_TYPE_CODE | R_ANAL_REF_TYPE_EXEC);
snprintf (tmp, sizeof (tmp), "case.default.0x%"PFMT64x, switch_addr);
anal->flb.set (anal->flb.f, tmp, default_case_addr, 1);
}

View File

@ -52,7 +52,8 @@ R_API RList *r_sign_fcn_xrefs(RAnal *a, RAnalFunction *fcn) {
RList *ret = r_list_newf ((RListFree) free);
RList *xrefs = r_anal_function_get_xrefs (fcn);
r_list_foreach (xrefs, iter, refi) {
if (refi->type == R_ANAL_REF_TYPE_CODE || refi->type == R_ANAL_REF_TYPE_CALL) {
int rt = R_ANAL_REF_TYPE_MASK (refi->type);
if (rt == R_ANAL_REF_TYPE_CODE || rt == R_ANAL_REF_TYPE_CALL) {
const char *flag = getRealRef (core, refi->addr);
if (flag) {
r_list_append (ret, r_str_new (flag));
@ -78,7 +79,8 @@ R_API RList *r_sign_fcn_refs(RAnal *a, RAnalFunction *fcn) {
RList *ret = r_list_newf ((RListFree) free);
RList *refs = r_anal_function_get_refs (fcn);
r_list_foreach (refs, iter, refi) {
if (refi->type == R_ANAL_REF_TYPE_CODE || refi->type == R_ANAL_REF_TYPE_CALL) {
int rt = R_ANAL_REF_TYPE_MASK (refi->type);
if (rt == R_ANAL_REF_TYPE_CODE || rt == R_ANAL_REF_TYPE_CALL) {
const char *flag = getRealRef (core, refi->addr);
if (flag) {
r_list_append (ret, r_str_new (flag));

View File

@ -1,4 +1,4 @@
/* radare - LGPL - Copyright 2009-2021 - pancake, nibble, defragger, ret2libc */
/* radare - LGPL - Copyright 2009-2022 - pancake, nibble, defragger, ret2libc */
#include <r_anal.h>
#include <r_cons.h>
@ -8,7 +8,7 @@ static RAnalRef *r_anal_ref_new(ut64 addr, ut64 at, ut64 type) {
if (ref) {
ref->addr = addr;
ref->at = at;
ref->type = (type == -1)? R_ANAL_REF_TYPE_CODE: type;
ref->type = (type == UT64_MAX)? R_ANAL_REF_TYPE_CODE: type;
}
return ref;
}
@ -96,7 +96,8 @@ static void setxref(HtUP *m, ut64 from, ut64 to, int type) {
}
// set a reference from FROM to TO and a cross-reference(xref) from TO to FROM.
R_API bool r_anal_xrefs_set(RAnal *anal, ut64 from, ut64 to, const RAnalRefType type) {
R_API bool r_anal_xrefs_set(RAnal *anal, ut64 from, ut64 to, const RAnalRefType _type) {
RAnalRefType type = _type;
r_return_val_if_fail (anal, false);
if (from == to) {
return false;
@ -109,6 +110,19 @@ R_API bool r_anal_xrefs_set(RAnal *anal, ut64 from, ut64 to, const RAnalRefType
return false;
}
}
if (!R_ANAL_REF_TYPE_PERM (type)) {
// type |= R_ANAL_REF_TYPE_READ;
switch (R_ANAL_REF_TYPE_MASK (type)) {
case R_ANAL_REF_TYPE_CODE:
case R_ANAL_REF_TYPE_CALL:
case R_ANAL_REF_TYPE_JUMP:
type |= R_ANAL_REF_TYPE_EXEC;
break;
default:
type |= R_ANAL_REF_TYPE_READ;
break;
}
}
setxref (anal->dict_xrefs, to, from, type);
setxref (anal->dict_refs, from, to, type);
R_DIRTY (anal);
@ -214,9 +228,10 @@ R_API void r_anal_xrefs_list(RAnal *anal, int rad) {
pj_a (pj);
}
r_list_foreach (list, iter, ref) {
int t = ref->type ? ref->type: ' ';
int t = ref->type ? R_ANAL_REF_TYPE_MASK (ref->type): ' ';
switch (rad) {
case '*':
// TODO: export/import the read-write-exec information
anal->cb_printf ("ax%c 0x%"PFMT64x" 0x%"PFMT64x"\n", t, ref->addr, ref->at);
break;
case '\0':
@ -229,7 +244,8 @@ R_API void r_anal_xrefs_list(RAnal *anal, int rad) {
} else {
anal->cb_printf ("%40s", "?");
}
anal->cb_printf (" 0x%"PFMT64x" -> %9s -> 0x%"PFMT64x, ref->at, r_anal_xrefs_type_tostring (t), ref->addr);
anal->cb_printf (" 0x%"PFMT64x" > %4s:%s > 0x%"PFMT64x, ref->at,
r_anal_ref_type_tostring (t), r_anal_ref_perm_tostring (ref), ref->addr);
name = anal->coreb.getNameDelta (anal->coreb.core, ref->addr);
if (name) {
r_str_replace_ch (name, ' ', 0, true);
@ -241,7 +257,8 @@ R_API void r_anal_xrefs_list(RAnal *anal, int rad) {
}
break;
case 'q':
anal->cb_printf ("0x%08"PFMT64x" -> 0x%08"PFMT64x" %s\n", ref->at, ref->addr, r_anal_xrefs_type_tostring (t));
anal->cb_printf ("0x%08"PFMT64x" -> 0x%08"PFMT64x" %s:%s\n", ref->at, ref->addr,
r_anal_ref_type_tostring (t), r_anal_ref_perm_tostring (ref));
break;
case 'j':
{
@ -253,7 +270,8 @@ R_API void r_anal_xrefs_list(RAnal *anal, int rad) {
free (name);
}
pj_kn (pj, "from", ref->at);
pj_ks (pj, "type", r_anal_xrefs_type_tostring (t));
pj_ks (pj, "type", r_anal_ref_type_tostring (t));
pj_ks (pj, "perm", r_anal_ref_perm_tostring (ref));
pj_kn (pj, "addr", ref->addr);
name = anal->coreb.getNameDelta (anal->coreb.core, ref->addr);
if (name) {
@ -276,8 +294,43 @@ R_API void r_anal_xrefs_list(RAnal *anal, int rad) {
r_list_free (list);
}
R_API const char *r_anal_xrefs_type_tostring(RAnalRefType type) {
switch (type) {
R_API char r_anal_ref_perm_tochar(RAnalRef *ref) {
if (ref->type & R_ANAL_REF_TYPE_WRITE) {
return 'w';
}
if (ref->type & R_ANAL_REF_TYPE_READ) {
return 'r';
}
if (ref->type & R_ANAL_REF_TYPE_EXEC) {
return 'x';
}
switch (R_ANAL_REF_TYPE_MASK (ref->type)) {
case R_ANAL_REF_TYPE_CODE:
case R_ANAL_REF_TYPE_CALL:
case R_ANAL_REF_TYPE_JUMP:
return 'x';
}
return '-';
}
R_API const char *r_anal_ref_perm_tostring(RAnalRef *ref) {
int perm = R_ANAL_REF_TYPE_PERM (ref->type);
if (!perm) {
switch (R_ANAL_REF_TYPE_MASK (ref->type)) {
case R_ANAL_REF_TYPE_CODE:
case R_ANAL_REF_TYPE_CALL:
case R_ANAL_REF_TYPE_JUMP:
perm = R_ANAL_REF_TYPE_EXEC;
break;
}
}
return r_str_rwx_i (perm);
}
R_API const char *r_anal_ref_type_tostring(RAnalRefType type) {
switch (R_ANAL_REF_TYPE_MASK (type)) {
case R_ANAL_REF_TYPE_NULL:
return "NULL";
case R_ANAL_REF_TYPE_CODE:
return "CODE";
case R_ANAL_REF_TYPE_CALL:
@ -285,13 +338,42 @@ R_API const char *r_anal_xrefs_type_tostring(RAnalRefType type) {
case R_ANAL_REF_TYPE_DATA:
return "DATA";
case R_ANAL_REF_TYPE_STRING:
return "STRING";
case R_ANAL_REF_TYPE_NULL:
return "STRN";
default:
return "UNKNOWN";
return "UNKN";
}
}
R_API RAnalRefType r_anal_xrefs_type_from_string(const char *s) {
RAnalRefType rt = R_ANAL_REF_TYPE_NULL;
if (strchr (s, 'r')) {
rt |= R_ANAL_REF_TYPE_READ | R_ANAL_REF_TYPE_DATA;
}
if (strchr (s, 'w')) {
rt |= R_ANAL_REF_TYPE_WRITE | R_ANAL_REF_TYPE_DATA;
}
if (strchr (s, 'x')) {
rt |= R_ANAL_REF_TYPE_EXEC;
}
if (strchr (s, 'c')) {
rt |= R_ANAL_REF_TYPE_CODE;
}
if (strchr (s, 'C')) {
rt |= R_ANAL_REF_TYPE_CALL;
}
if (strchr (s, 'j')) {
rt |= R_ANAL_REF_TYPE_JUMP;
}
if (strchr (s, 'd')) {
rt |= R_ANAL_REF_TYPE_DATA;
}
if (strchr (s, 's')) {
rt |= R_ANAL_REF_TYPE_STRING;
}
return rt;
}
// TODO: deprecate
R_API RAnalRefType r_anal_xrefs_type(char ch) {
switch (ch) {
case R_ANAL_REF_TYPE_CODE:
@ -367,19 +449,3 @@ R_API RList *r_anal_function_get_xrefs(RAnalFunction *fcn) {
r_return_val_if_fail (fcn, NULL);
return fcn_get_refs (fcn, fcn->anal->dict_xrefs);
}
R_API const char *r_anal_ref_type_tostring(RAnalRefType t) {
switch (t) {
case R_ANAL_REF_TYPE_NULL:
return "null";
case R_ANAL_REF_TYPE_CODE:
return "code";
case R_ANAL_REF_TYPE_CALL:
return "call";
case R_ANAL_REF_TYPE_DATA:
return "data";
case R_ANAL_REF_TYPE_STRING:
return "string";
}
return "unknown";
}

View File

@ -585,9 +585,9 @@ static void r_anal_set_stringrefs(RCore *core, RAnalFunction *fcn) {
RAnalRef *ref;
RList *refs = r_anal_function_get_refs (fcn);
r_list_foreach (refs, iter, ref) {
if (ref->type == R_ANAL_REF_TYPE_DATA &&
r_bin_is_string (core->bin, ref->addr)) {
r_anal_xrefs_set (core->anal, ref->at, ref->addr, R_ANAL_REF_TYPE_STRING);
int rt = R_ANAL_REF_TYPE_MASK (ref->type);
if (rt == R_ANAL_REF_TYPE_DATA && r_bin_is_string (core->bin, ref->addr)) {
r_anal_xrefs_set (core->anal, ref->at, ref->addr, R_ANAL_REF_TYPE_STRING | R_ANAL_REF_TYPE_READ);
}
}
r_list_free (refs);
@ -663,18 +663,13 @@ static int r_anal_analyze_fcn_refs(RCore *core, RAnalFunction *fcn, int depth) {
if (ref->addr == UT64_MAX) {
continue;
}
switch (ref->type) {
case R_ANAL_REF_TYPE_DATA:
int rt = R_ANAL_REF_TYPE_MASK (ref->type);
if (rt == R_ANAL_REF_TYPE_DATA) {
if (core->anal->opt.followdatarefs) {
r_anal_try_get_fcn (core, ref, depth, 2);
}
break;
case R_ANAL_REF_TYPE_CODE:
case R_ANAL_REF_TYPE_CALL:
} else if (rt == R_ANAL_REF_TYPE_CODE || rt == R_ANAL_REF_TYPE_CALL) {
r_core_anal_fcn (core, ref->addr, ref->at, ref->type, depth - 1);
break;
default:
break;
}
// TODO: fix memleak here, fcn not freed even though it is
// added in core->anal->fcns which is freed in r_anal_free()
@ -709,7 +704,8 @@ static void autoname_imp_trampoline(RCore *core, RAnalFunction *fcn) {
RList *refs = r_anal_function_get_refs (fcn);
if (refs && r_list_length (refs) == 1) {
RAnalRef *ref = r_list_first (refs);
if (ref->type != R_ANAL_REF_TYPE_CALL) { /* Some fcns don't return */
int rt = R_ANAL_REF_TYPE_MASK (ref->type);
if (rt != R_ANAL_REF_TYPE_CALL) { /* Some fcns don't return */
RFlagItem *flg = r_flag_get_i (core->flags, ref->addr);
if (flg && r_str_startswith (flg->name, "sym.imp.")) {
R_FREE (fcn->name);
@ -749,11 +745,11 @@ static bool __core_anal_fcn(RCore *core, ut64 at, ut64 from, int reftype, int de
// r_sys_backtrace ();
return false;
}
int has_next = r_config_get_i (core->config, "anal.hasnext");
bool has_next = r_config_get_b (core->config, "anal.hasnext");
RAnalHint *hint = NULL;
int i, nexti = 0;
ut64 *next = NULL;
int fcnlen;
int fcnlen = 0;
RAnalFunction *fcn = r_anal_function_new (core->anal);
r_warn_if_fail (fcn);
const char *fcnpfx = r_config_get (core->config, "anal.fcnprefix");
@ -792,14 +788,12 @@ static bool __core_anal_fcn(RCore *core, ut64 at, ut64 from, int reftype, int de
if (r_cons_is_breaked ()) {
break;
}
fcnlen = r_anal_function(core->anal, fcn, at + delta, core->anal->opt.bb_max_size, reftype);
fcnlen = r_anal_function (core->anal, fcn, at + delta, core->anal->opt.bb_max_size, reftype);
if (core->anal->opt.searchstringrefs) {
r_anal_set_stringrefs (core, fcn);
}
if (fcnlen == 0) {
if (core->anal->verbose) {
eprintf ("Analyzed function size is 0 at 0x%08"PFMT64x"\n", at + delta);
}
R_LOG_DEBUG ("Analyzed function size is 0 at 0x%08"PFMT64x, at + delta);
goto error;
}
if (fcnlen < 0) {
@ -810,7 +804,7 @@ static bool __core_anal_fcn(RCore *core, ut64 at, ut64 from, int reftype, int de
case R_ANAL_RET_END:
break;
default:
eprintf ("Oops. Negative fcnsize at 0x%08"PFMT64x" (%d)\n", at, fcnlen);
R_LOG_DEBUG ("Oops. Negative fcnsize at 0x%08"PFMT64x" (%d)", at, fcnlen);
continue;
}
}
@ -858,7 +852,7 @@ static bool __core_anal_fcn(RCore *core, ut64 at, ut64 from, int reftype, int de
/* New function: Add initial xref */
if (from != UT64_MAX) {
r_anal_xrefs_set (core->anal, from, fcn->addr, reftype);
r_anal_xrefs_set (core->anal, from, fcn->addr, reftype | R_ANAL_REF_TYPE_EXEC);
}
// XXX: this is wrong. See CID 1134565
r_anal_add_function (core->anal, fcn);
@ -1999,7 +1993,9 @@ R_API bool r_core_anal_fcn(RCore *core, ut64 at, ut64 from, int reftype, int dep
// if the function was already analyzed as a "loc.",
// convert it to function and rename it to "fcn.",
// because we found a call to this address
if (reftype == R_ANAL_REF_TYPE_CALL && fcn->type == R_ANAL_FCN_TYPE_LOC) {
int rt = R_ANAL_REF_TYPE_MASK (reftype);
int ft = R_ANAL_REF_TYPE_MASK (fcn->type);
if (rt == R_ANAL_REF_TYPE_CALL && ft == R_ANAL_FCN_TYPE_LOC) {
function_rename (core->flags, fcn);
}
return 0; // already analyzed function
@ -2014,7 +2010,7 @@ R_API bool r_core_anal_fcn(RCore *core, ut64 at, ut64 from, int reftype, int dep
// we should analyze and add code ref otherwise aaa != aac
if (from != UT64_MAX) {
r_anal_xrefs_set (core->anal, from, at, reftype);
r_anal_xrefs_set (core->anal, from, at, reftype | R_ANAL_REF_TYPE_EXEC);
}
return true;
}
@ -2438,8 +2434,9 @@ repeat:
RList *calls = r_list_new ();
// TODO: maybe fcni->calls instead ?
r_list_foreach (refs, iter2, fcnr) {
int rt = R_ANAL_REF_TYPE_MASK (fcnr->type);
// TODO: tail calll jumps are also calls
if (fcnr->type == 'C' && r_list_find(calls, fcnr, (RListComparator)RAnalRef_cmp) == NULL) {
if (rt == R_ANAL_REF_TYPE_CALL && r_list_find (calls, fcnr, (RListComparator)RAnalRef_cmp) == NULL) {
r_list_append (calls, fcnr);
}
}
@ -2531,7 +2528,7 @@ repeat:
}
break;
default:
if (refgraph || fcnr->type == R_ANAL_REF_TYPE_CALL) {
if (refgraph || R_ANAL_REF_TYPE_MASK (fcnr->type) == R_ANAL_REF_TYPE_CALL) {
// TODO: avoid recreating nodes unnecessarily
r_cons_printf ("agn %s\n", fcni->name);
r_cons_printf ("agn %s\n", fcnr_name);
@ -2541,7 +2538,7 @@ repeat:
}
}
if (!(flag && flag->name)) {
free(fcnr_name);
free (fcnr_name);
}
}
r_list_free (refs);
@ -2619,7 +2616,7 @@ static int fcnlist_gather_metadata(RAnal *anal, RList *fcns) {
RList *refs = r_anal_function_get_refs (fcn);
int numcallrefs = 0;
r_list_foreach (refs, callrefiter, ref) {
if (ref->type == R_ANAL_REF_TYPE_CALL) {
if (R_ANAL_REF_TYPE_MASK (ref->type) == R_ANAL_REF_TYPE_CALL) {
numcallrefs++;
}
}
@ -2779,7 +2776,8 @@ R_API RList *r_core_anal_fcn_get_calls(RCore *core, RAnalFunction *fcn) {
if (!r_list_empty (refs)) {
// iterate over all the references and remove these which aren't of type call
r_list_foreach_safe (refs, iter, iter2, refi) {
if (refi->type != R_ANAL_REF_TYPE_CALL) {
int rt = R_ANAL_REF_TYPE_MASK (refi->type);
if (rt != R_ANAL_REF_TYPE_CALL) {
r_list_delete (refs, iter);
}
}
@ -2911,24 +2909,24 @@ static int fcn_print_json(RCore *core, RAnalFunction *fcn, PJ *pj) {
pj_k (pj, "callrefs");
pj_a (pj);
r_list_foreach (refs, iter, refi) {
if (refi->type == R_ANAL_REF_TYPE_CALL) {
int rt = R_ANAL_REF_TYPE_MASK (refi->type);
if (rt == R_ANAL_REF_TYPE_CALL) {
outdegree++;
}
if (refi->type == R_ANAL_REF_TYPE_CODE ||
refi->type == R_ANAL_REF_TYPE_CALL) {
if (rt == R_ANAL_REF_TYPE_CODE || rt != R_ANAL_REF_TYPE_CALL) {
pj_o (pj);
pj_kn (pj, "addr", refi->addr);
pj_ks (pj, "type", r_anal_xrefs_type_tostring (refi->type));
pj_ks (pj, "type", r_anal_ref_type_tostring (refi->type));
pj_kn (pj, "at", refi->at);
pj_end (pj);
}
}
pj_end (pj);
pj_k (pj, "datarefs");
pj_a (pj);
r_list_foreach (refs, iter, refi) {
if (refi->type == R_ANAL_REF_TYPE_DATA) {
int rt = R_ANAL_REF_TYPE_MASK (refi->type);
if (rt == R_ANAL_REF_TYPE_DATA) {
pj_n (pj, refi->addr);
}
}
@ -2942,12 +2940,12 @@ static int fcn_print_json(RCore *core, RAnalFunction *fcn, PJ *pj) {
pj_k (pj, "codexrefs");
pj_a (pj);
r_list_foreach (xrefs, iter, refi) {
if (refi->type == R_ANAL_REF_TYPE_CODE ||
refi->type == R_ANAL_REF_TYPE_CALL) {
int rt = R_ANAL_REF_TYPE_MASK (refi->type);
if (rt == R_ANAL_REF_TYPE_CALL || rt == R_ANAL_REF_TYPE_CALL) {
indegree++;
pj_o (pj);
pj_kn (pj, "addr", refi->addr);
pj_ks (pj, "type", r_anal_xrefs_type_tostring (refi->type));
pj_ks (pj, "type", r_anal_ref_type_tostring (refi->type));
pj_kn (pj, "at", refi->at);
pj_end (pj);
}
@ -2958,7 +2956,8 @@ static int fcn_print_json(RCore *core, RAnalFunction *fcn, PJ *pj) {
pj_a (pj);
r_list_foreach (xrefs, iter, refi) {
if (refi->type == R_ANAL_REF_TYPE_DATA) {
int rt = R_ANAL_REF_TYPE_MASK (refi->type);
if (rt == R_ANAL_REF_TYPE_DATA) {
pj_n (pj, refi->addr);
}
}
@ -3059,23 +3058,17 @@ static int fcn_print_detail(RCore *core, RAnalFunction *fcn) {
RAnalRef *refi;
RList *refs = r_anal_function_get_refs (fcn);
r_list_foreach (refs, refiter, refi) {
switch (refi->type) {
case R_ANAL_REF_TYPE_CALL:
const int t = R_ANAL_REF_TYPE_MASK (refi->type);
if (t == R_ANAL_REF_TYPE_CALL) {
r_cons_printf ("axC 0x%"PFMT64x" 0x%"PFMT64x"\n", refi->addr, refi->at);
break;
case R_ANAL_REF_TYPE_DATA:
} else if (t == R_ANAL_REF_TYPE_DATA) {
r_cons_printf ("axd 0x%"PFMT64x" 0x%"PFMT64x"\n", refi->addr, refi->at);
break;
case R_ANAL_REF_TYPE_CODE:
} else if (t == R_ANAL_REF_TYPE_CODE) {
r_cons_printf ("axc 0x%"PFMT64x" 0x%"PFMT64x"\n", refi->addr, refi->at);
break;
case R_ANAL_REF_TYPE_STRING:
} else if (t == R_ANAL_REF_TYPE_STRING) {
r_cons_printf ("axs 0x%"PFMT64x" 0x%"PFMT64x"\n", refi->addr, refi->at);
break;
case R_ANAL_REF_TYPE_NULL:
default:
} else {
r_cons_printf ("ax 0x%"PFMT64x" 0x%"PFMT64x"\n", refi->addr, refi->at);
break;
}
}
r_list_free (refs);
@ -3136,18 +3129,20 @@ static int fcn_print_legacy(RCore *core, RAnalFunction *fcn) {
int outdegree = 0;
refs = r_anal_function_get_refs (fcn);
r_list_foreach (refs, iter, refi) {
if (refi->type == R_ANAL_REF_TYPE_CALL) {
int rt = R_ANAL_REF_TYPE_MASK (refi->type);
if (rt == R_ANAL_REF_TYPE_CALL) {
outdegree++;
}
if (refi->type == R_ANAL_REF_TYPE_CODE || refi->type == R_ANAL_REF_TYPE_CALL) {
if (rt == R_ANAL_REF_TYPE_CODE || rt == R_ANAL_REF_TYPE_CALL) {
r_cons_printf (" 0x%08"PFMT64x" %c", refi->addr,
refi->type == R_ANAL_REF_TYPE_CALL?'C':'J');
rt == R_ANAL_REF_TYPE_CALL?'C':'J');
}
}
r_cons_printf ("\ndata-refs:");
r_list_foreach (refs, iter, refi) {
int rt = R_ANAL_REF_TYPE_MASK (refi->type);
// global or local?
if (refi->type == R_ANAL_REF_TYPE_DATA) {
if (rt == R_ANAL_REF_TYPE_DATA) {
r_cons_printf (" 0x%08"PFMT64x, refi->addr);
}
}
@ -3157,10 +3152,11 @@ static int fcn_print_legacy(RCore *core, RAnalFunction *fcn) {
r_cons_printf ("\ncode-xrefs:");
xrefs = r_anal_function_get_xrefs (fcn);
r_list_foreach (xrefs, iter, refi) {
if (refi->type == R_ANAL_REF_TYPE_CODE || refi->type == R_ANAL_REF_TYPE_CALL) {
int rt = R_ANAL_REF_TYPE_MASK (refi->type);
if (rt == R_ANAL_REF_TYPE_CODE || rt == R_ANAL_REF_TYPE_CALL) {
indegree++;
r_cons_printf (" 0x%08"PFMT64x" %c", refi->addr,
refi->type == R_ANAL_REF_TYPE_CALL?'C':'J');
rt == R_ANAL_REF_TYPE_CALL?'C':'J');
}
}
r_cons_printf ("\nnoreturn: %s", r_str_bool (fcn->is_noreturn));
@ -3168,7 +3164,8 @@ static int fcn_print_legacy(RCore *core, RAnalFunction *fcn) {
r_cons_printf ("\nout-degree: %d", outdegree);
r_cons_printf ("\ndata-xrefs:");
r_list_foreach (xrefs, iter, refi) {
if (refi->type == R_ANAL_REF_TYPE_DATA) {
int rt = R_ANAL_REF_TYPE_MASK (refi->type);
if (rt == R_ANAL_REF_TYPE_DATA) {
r_cons_printf (" 0x%08"PFMT64x, refi->addr);
}
}
@ -3591,7 +3588,8 @@ static bool anal_path_exists(RCore *core, ut64 from, ut64 to, RList *bbs, int de
RList *refs = r_anal_function_get_refs (cur_fcn);
if (refs) {
r_list_foreach (refs, iter, refi) {
if (refi->type == R_ANAL_REF_TYPE_CALL) {
int rt = R_ANAL_REF_TYPE_MASK (refi->type);
if (rt == R_ANAL_REF_TYPE_CALL) {
if (r_anal_block_contains (bb, refi->at)) {
if ((refi->at != refi->addr) && !ht_up_find (state, refi->addr, NULL) && anal_path_exists (core, refi->addr, to, bbs, depth - 1, state, avoid)) {
r_list_prepend (bbs, bb);
@ -3632,7 +3630,8 @@ static RList *anal_graph_to(RCore *core, ut64 addr, int depth, HtUP *avoid) {
RListIter *iter;
RAnalRef *xref = NULL;
r_list_foreach (xrefs, iter, xref) {
if (xref->type == R_ANAL_REF_TYPE_CALL) {
int rt = R_ANAL_REF_TYPE_MASK (xref->type);
if (rt == R_ANAL_REF_TYPE_CALL) {
ut64 offset = core->offset;
core->offset = xref->addr;
r_list_free (list);
@ -3775,13 +3774,13 @@ R_API int r_core_anal_graph(RCore *core, ut64 addr, int opts) {
return true;
}
static int core_anal_followptr(RCore *core, int type, ut64 at, ut64 ptr, ut64 ref, int code, int depth) {
static int core_anal_followptr(RCore *core, int type, ut64 at, ut64 ptr, ut64 ref, bool code, int depth) {
// SLOW Operation try to reduce as much as possible
if (!ptr) {
return false;
}
if (ref == UT64_MAX || ptr == ref) {
const RAnalRefType t = code? type? type: R_ANAL_REF_TYPE_CODE: R_ANAL_REF_TYPE_DATA;
RAnalRefType t = code? type? type: R_ANAL_REF_TYPE_CODE: R_ANAL_REF_TYPE_DATA;
r_anal_xrefs_set (core->anal, at, ptr, t);
return true;
}
@ -3918,7 +3917,7 @@ R_API int r_core_anal_search(RCore *core, ut64 from, ut64 to, ut64 ref, int mode
case R_ANAL_OP_TYPE_CALL:
case R_ANAL_OP_TYPE_CCALL:
if (op.jump != UT64_MAX &&
core_anal_followptr (core, 'C', at + i, op.jump, ref, true, 0)) {
core_anal_followptr (core, R_ANAL_REF_TYPE_CALL, at + i, op.jump, ref, true, 0)) {
count ++;
}
break;
@ -3929,7 +3928,7 @@ R_API int r_core_anal_search(RCore *core, ut64 from, ut64 to, ut64 ref, int mode
case R_ANAL_OP_TYPE_IRJMP:
case R_ANAL_OP_TYPE_MJMP:
if (op.ptr != UT64_MAX &&
core_anal_followptr (core, 'c', at + i, op.ptr, ref, true ,1)) {
core_anal_followptr (core, R_ANAL_REF_TYPE_JUMP, at + i, op.ptr, ref, true ,1)) {
count ++;
}
break;
@ -3939,7 +3938,7 @@ R_API int r_core_anal_search(RCore *core, ut64 from, ut64 to, ut64 ref, int mode
case R_ANAL_OP_TYPE_IRCALL:
case R_ANAL_OP_TYPE_UCCALL:
if (op.ptr != UT64_MAX &&
core_anal_followptr (core, 'C', at + i, op.ptr, ref, true ,1)) {
core_anal_followptr (core, R_ANAL_REF_TYPE_CALL, at + i, op.ptr, ref, true ,1)) {
count ++;
}
break;
@ -3990,7 +3989,8 @@ static bool found_xref(RCore *core, ut64 at, ut64 xref_to, RAnalRefType type, PJ
// allow only references to virtual addresses in order to reduce
// the number of false positives. In debugger mode, the reference
// must point to a mapped memory region.
if (type == R_ANAL_REF_TYPE_NULL) {
int rt = R_ANAL_REF_TYPE_MASK (type);
if (rt == R_ANAL_REF_TYPE_NULL) {
return false;
}
if (cfg_debug) {
@ -4003,7 +4003,7 @@ static bool found_xref(RCore *core, ut64 at, ut64 xref_to, RAnalRefType type, PJ
}
}
if (!rad) {
if (cfg_anal_strings && type == R_ANAL_REF_TYPE_DATA) {
if (cfg_anal_strings && R_ANAL_REF_TYPE_MASK (type) == R_ANAL_REF_TYPE_DATA) {
int len = 0;
char *str_string = is_string_at (core, xref_to, &len);
if (str_string) {
@ -4039,7 +4039,7 @@ static bool found_xref(RCore *core, ut64 at, ut64 xref_to, RAnalRefType type, PJ
default: cmd = "ax"; break;
}
r_cons_printf ("%s 0x%08"PFMT64x" 0x%08"PFMT64x"\n", cmd, xref_to, at);
if (cfg_anal_strings && type == R_ANAL_REF_TYPE_DATA) {
if (cfg_anal_strings && R_ANAL_REF_TYPE_MASK (type) == R_ANAL_REF_TYPE_DATA) {
char *str_flagname = is_string_at (core, xref_to, &len);
if (str_flagname) {
ut64 str_addr = xref_to;
@ -4735,7 +4735,7 @@ static void add_string_ref(RCore *core, ut64 xref_from, ut64 xref_to) {
}
char *str_flagname = is_string_at (core, xref_to, &len);
if (str_flagname) {
r_anal_xrefs_set (core->anal, xref_from, xref_to, R_ANAL_REF_TYPE_DATA);
r_anal_xrefs_set (core->anal, xref_from, xref_to, R_ANAL_REF_TYPE_DATA | R_ANAL_REF_TYPE_READ);
r_name_filter (str_flagname, -1);
r_flag_space_push (core->flags, R_FLAGS_FS_STRINGS);
char *flagname = r_str_newf ("str.%s", str_flagname);
@ -4824,8 +4824,28 @@ static void handle_var_stack_access(RAnalEsil *esil, ut64 addr, RAnalVarAccessTy
}
}
static bool is_stack(RIO *io, ut64 addr) {
RIOMap *map = r_io_map_get_at (io, addr);
if (map) {
if (map->name && r_str_startswith (map->name, "mem.0x")) {
return true;
}
}
return false;
}
static bool esilbreak_mem_write(RAnalEsil *esil, ut64 addr, const ut8 *buf, int len) {
handle_var_stack_access (esil, addr, R_ANAL_VAR_ACCESS_TYPE_WRITE, len);
// ignore writes in stack
if (myvalid (mycore->io, addr) && r_io_read_at (mycore->io, addr, (ut8*)buf, len)) {
if (!is_stack (mycore->io, addr)) {
r_anal_xrefs_set (mycore->anal, esil->address, addr, R_ANAL_REF_TYPE_DATA | R_ANAL_REF_TYPE_WRITE);
/** resolve ptr */
//if (ntarget == UT64_MAX || ntarget == addr || (ntarget == UT64_MAX && !validRef)) {
// r_anal_xrefs_set (mycore->anal, esil->address, addr, R_ANAL_REF_TYPE_DATA);
//}
}
}
return true;
}
@ -4843,7 +4863,7 @@ static bool esilbreak_mem_read(RAnalEsil *esil, ut64 addr, ut8 *buf, int len) {
}
handle_var_stack_access (esil, addr, R_ANAL_VAR_ACCESS_TYPE_READ, len);
if (myvalid (mycore->io, addr) && r_io_read_at (mycore->io, addr, (ut8*)buf, len)) {
ut64 refptr;
ut64 refptr = UT64_MAX;
bool trace = true;
switch (len) {
case 2:
@ -4870,7 +4890,7 @@ static bool esilbreak_mem_read(RAnalEsil *esil, ut64 addr, ut8 *buf, int len) {
str[0] = 0;
validRef = false;
} else {
r_anal_xrefs_set (mycore->anal, esil->address, refptr, R_ANAL_REF_TYPE_DATA);
r_anal_xrefs_set (mycore->anal, esil->address, refptr, R_ANAL_REF_TYPE_DATA | R_ANAL_REF_TYPE_READ);
str[sizeof (str) - 1] = 0;
add_string_ref (mycore, esil->address, refptr);
esilbreak_last_data = UT64_MAX;
@ -4881,7 +4901,7 @@ static bool esilbreak_mem_read(RAnalEsil *esil, ut64 addr, ut8 *buf, int len) {
/** resolve ptr */
if (ntarget == UT64_MAX || ntarget == addr || (ntarget == UT64_MAX && !validRef)) {
r_anal_xrefs_set (mycore->anal, esil->address, addr, R_ANAL_REF_TYPE_DATA);
r_anal_xrefs_set (mycore->anal, esil->address, addr, R_ANAL_REF_TYPE_DATA | R_ANAL_REF_TYPE_READ);
}
}
return false; // fallback
@ -5425,14 +5445,14 @@ R_API void r_core_anal_esil(RCore *core, const char *str, const char *target) {
// arm64
if (core->anal->cur && arch == R2_ARCH_ARM64) {
if (CHECKREF (ESIL->cur)) {
r_anal_xrefs_set (core->anal, cur, ESIL->cur, R_ANAL_REF_TYPE_STRING);
r_anal_xrefs_set (core->anal, cur, ESIL->cur, R_ANAL_REF_TYPE_STRING | R_ANAL_REF_TYPE_READ);
}
} else if ((target && op.ptr == ntarget) || !target) {
if (CHECKREF (ESIL->cur)) {
if (op.ptr && r_io_is_valid_offset (core->io, op.ptr, !core->anal->opt.noncode)) {
r_anal_xrefs_set (core->anal, cur, op.ptr, R_ANAL_REF_TYPE_STRING);
r_anal_xrefs_set (core->anal, cur, op.ptr, R_ANAL_REF_TYPE_STRING | R_ANAL_REF_TYPE_READ);
} else {
r_anal_xrefs_set (core->anal, cur, ESIL->cur, R_ANAL_REF_TYPE_STRING);
r_anal_xrefs_set (core->anal, cur, ESIL->cur, R_ANAL_REF_TYPE_STRING | R_ANAL_REF_TYPE_READ);
}
}
}
@ -5448,7 +5468,7 @@ R_API void r_core_anal_esil(RCore *core, const char *str, const char *target) {
if ((target && dst == ntarget) || !target) {
if (CHECKREF (dst)) {
int type = core_type_by_addr (core, dst); // R_ANAL_REF_TYPE_DATA;
r_anal_xrefs_set (core->anal, cur, dst, type);
r_anal_xrefs_set (core->anal, cur, dst, type | R_ANAL_REF_TYPE_WRITE);
}
}
if (cfg_anal_strings) {
@ -5496,7 +5516,7 @@ R_API void r_core_anal_esil(RCore *core, const char *str, const char *target) {
ut64 dst = esilbreak_last_read;
if (dst != UT64_MAX && CHECKREF (dst)) {
if (myvalid (mycore->io, dst)) {
r_anal_xrefs_set (core->anal, cur, dst, R_ANAL_REF_TYPE_DATA);
r_anal_xrefs_set (core->anal, cur, dst, R_ANAL_REF_TYPE_DATA | R_ANAL_REF_TYPE_READ);
if (cfg_anal_strings) {
add_string_ref (core, op.addr, dst);
}
@ -5505,7 +5525,7 @@ R_API void r_core_anal_esil(RCore *core, const char *str, const char *target) {
dst = esilbreak_last_data;
if (dst != UT64_MAX && CHECKREF (dst)) {
if (myvalid (mycore->io, dst)) {
r_anal_xrefs_set (core->anal, cur, dst, R_ANAL_REF_TYPE_DATA);
r_anal_xrefs_set (core->anal, cur, dst, R_ANAL_REF_TYPE_DATA | R_ANAL_REF_TYPE_READ);
if (cfg_anal_strings) {
add_string_ref (core, op.addr, dst);
}
@ -5518,7 +5538,7 @@ R_API void r_core_anal_esil(RCore *core, const char *str, const char *target) {
ut64 dst = op.jump;
if (CHECKREF (dst)) {
if (myvalid (core->io, dst)) {
r_anal_xrefs_set (core->anal, cur, dst, R_ANAL_REF_TYPE_CODE);
r_anal_xrefs_set (core->anal, cur, dst, R_ANAL_REF_TYPE_CODE | R_ANAL_REF_TYPE_EXEC);
}
}
}
@ -5528,7 +5548,7 @@ R_API void r_core_anal_esil(RCore *core, const char *str, const char *target) {
ut64 dst = op.jump;
if (CHECKREF (dst)) {
if (myvalid (core->io, dst)) {
r_anal_xrefs_set (core->anal, cur, dst, R_ANAL_REF_TYPE_CALL);
r_anal_xrefs_set (core->anal, cur, dst, R_ANAL_REF_TYPE_CALL | R_ANAL_REF_TYPE_EXEC);
}
ESIL->old = cur + op.size;
getpcfromstack (core, ESIL);
@ -5552,7 +5572,7 @@ R_API void r_core_anal_esil(RCore *core, const char *str, const char *target) {
(op.type & R_ANAL_OP_TYPE_MASK) == R_ANAL_OP_TYPE_UCALL
? R_ANAL_REF_TYPE_CALL
: R_ANAL_REF_TYPE_CODE;
r_anal_xrefs_set (core->anal, cur, dst, ref);
r_anal_xrefs_set (core->anal, cur, dst, ref | R_ANAL_REF_TYPE_EXEC);
r_core_anal_fcn (core, dst, UT64_MAX, R_ANAL_REF_TYPE_NULL, 1);
// analyze function here
#if 0
@ -6066,7 +6086,7 @@ R_API void r_core_anal_propagate_noreturn(RCore *core, ut64 addr) {
ut64 call_addr = xref->addr;
ut64 chop_addr = call_addr + xrefop->size;
r_anal_op_free (xrefop);
if (xref->type != R_ANAL_REF_TYPE_CALL) {
if (R_ANAL_REF_TYPE_MASK (xref->type) != R_ANAL_REF_TYPE_CALL) {
continue;
}

View File

@ -954,22 +954,24 @@ static const char *help_msg_ax[] = {
"ax", " addr [at]", "add code ref pointing to addr (from curseek)",
"ax-", " [at]", "clean all refs/refs from addr",
"ax-*", "", "clean all refs/refs",
"ax.", " [addr]", "find data/code references from and to this address",
"axc", " addr [at]", "add generic code ref",
"axC", " addr [at]", "add code call ref",
"axd", " addr [at]", "add data ref",
"axf", "[?] [addr]", "find data/code references from this address",
"axff[j]", " [addr]", "find data/code references from this function",
"axF", " [flg-glob]", "find data/code references of flags",
"axg", " [addr]", "show xrefs graph to reach current function",
"axg*", " [addr]", "show xrefs graph to given address, use .axg*;aggv",
"axgj", " [addr]", "show xrefs graph to reach current function in json format",
"axd", " addr [at]", "add data ref",
"axq", "", "list refs in quiet/human-readable format",
"axj", "", "list refs in json format",
"axF", " [flg-glob]", "find data/code references of flags",
"axm", " addr [at]", "copy data/code references pointing to addr to also point to curseek (or at)",
"axt", "[?] [addr]", "find data/code references to this address",
"axl", "[cq]", "list xrefs (axlc = count, axlq = quiet)",
"axf", "[?] [addr]", "find data/code references from this address",
"axm", " addr [at]", "copy data/code references pointing to addr to also point to curseek (or at)",
"axq", "", "list refs in quiet/human-readable format",
"axr", " addr [at]", "add data-read ref",
"axt", "[?] [addr]", "find data/code references to this address",
"axv", "[?] [addr]", "list local variables read-write-exec references",
"ax.", " [addr]", "find data/code references from and to this address",
"axff[j]", " [addr]", "find data/code references from this function",
"axw", " addr [at]", "add data-write ref",
"axs", " addr [at]", "add string ref",
NULL
};
@ -3939,7 +3941,8 @@ R_API void r_core_af(RCore *core, ut64 addr, const char *name, bool anal_calls)
//eprintf ("Warning: ignore 0x%08"PFMT64x" call 0x%08"PFMT64x"\n", ref->at, ref->addr);
continue;
}
if (ref->type != R_ANAL_REF_TYPE_CODE && ref->type != R_ANAL_REF_TYPE_CALL) {
int rt = R_ANAL_REF_TYPE_MASK (ref->type);
if (rt != R_ANAL_REF_TYPE_CODE && rt != R_ANAL_REF_TYPE_CALL) {
/* only follow code/call references */
continue;
}
@ -3958,7 +3961,8 @@ R_API void r_core_af(RCore *core, ut64 addr, const char *name, bool anal_calls)
if (!r_io_is_valid_offset (core->io, ref->addr, !core->anal->opt.noncode)) {
continue;
}
if (ref->type != 'c' && ref->type != 'C') {
int rt = R_ANAL_REF_TYPE_MASK (ref->type);
if (rt != R_ANAL_REF_TYPE_CALL && rt != R_ANAL_REF_TYPE_CODE) {
continue;
}
r_core_anal_fcn (core, ref->addr, f->addr, R_ANAL_REF_TYPE_CALL, depth - 1);
@ -4908,11 +4912,12 @@ static int cmd_af(RCore *core, const char *input) {
pj_end (pj);
} else {
r_cons_printf ("%c 0x%08" PFMT64x " -> ", ref->type, ref->at);
switch (ref->type) {
switch (R_ANAL_REF_TYPE_MASK (ref->type)) {
case R_ANAL_REF_TYPE_NULL:
r_cons_printf ("0x%08" PFMT64x " ", ref->addr);
break;
case R_ANAL_REF_TYPE_CODE:
case R_ANAL_REF_TYPE_JUMP:
case R_ANAL_REF_TYPE_CALL:
case R_ANAL_REF_TYPE_DATA:
r_cons_printf ("0x%08" PFMT64x " ", ref->addr);
@ -4930,6 +4935,9 @@ static int cmd_af(RCore *core, const char *input) {
free (s);
}
break;
default:
// ignore rwx
break;
}
}
}
@ -4972,7 +4980,7 @@ static int cmd_af(RCore *core, const char *input) {
input++;
anal_calls = true;
} else {
anal_calls = r_config_get_i (core->config, "anal.calls");
anal_calls = r_config_get_b (core->config, "anal.calls");
}
ut64 addr = core->offset;
const char *name = NULL;
@ -8674,7 +8682,9 @@ static bool cmd_anal_refs(RCore *core, const char *input) {
//get all xrefs pointing to addr
list = r_anal_xrefs_get (core->anal, addr);
r_list_foreach (list, iter, ref) {
r_cons_printf ("0x%"PFMT64x" %s\n", ref->addr, r_anal_xrefs_type_tostring (ref->type));
r_cons_printf ("0x%"PFMT64x" %s %s\n", ref->addr,
r_anal_ref_perm_tostring (ref),
r_anal_ref_type_tostring (ref->type));
r_anal_xrefs_set (core->anal, ref->addr, at, ref->type);
}
r_list_free (list);
@ -8716,7 +8726,6 @@ static bool cmd_anal_refs(RCore *core, const char *input) {
axtm (core);
break;
}
RList *list = NULL;
RAnalFunction *fcn;
RAnalRef *ref;
RListIter *iter;
@ -8730,7 +8739,7 @@ static bool cmd_anal_refs(RCore *core, const char *input) {
} else {
addr = core->offset;
}
list = r_anal_xrefs_get (core->anal, addr);
RList *list = r_anal_xrefs_get (core->anal, addr);
if (list) {
if (input[1] == 'q') { // "axtq"
r_list_foreach (list, iter, ref) {
@ -8748,7 +8757,8 @@ static bool cmd_anal_refs(RCore *core, const char *input) {
pj_o (pj);
pj_kn (pj, "from", ref->addr);
if (ref->type) {
pj_ks (pj, "type", r_anal_xrefs_type_tostring (ref->type));
pj_ks (pj, "type", r_anal_ref_type_tostring (ref->type));
pj_ks (pj, "perm", r_anal_ref_perm_tostring (ref));
}
pj_ks (pj, "opcode", str);
if (fcn) {
@ -8818,9 +8828,10 @@ static bool cmd_anal_refs(RCore *core, const char *input) {
}
} else if (input[1] == '*') { // axt*
// TODO: implement multi-line comments
r_list_foreach (list, iter, ref)
r_list_foreach (list, iter, ref) {
r_cons_printf ("CCa 0x%" PFMT64x " \"XREF type %d at 0x%" PFMT64x"%s\n",
ref->addr, ref->type, addr, iter->n? ",": "");
}
} else if (input[1] == ' ' || input[1] == 0) { // "axt"
RAnalFunction *fcn;
r_list_foreach (list, iter, ref) {
@ -8836,8 +8847,9 @@ static bool cmd_anal_refs(RCore *core, const char *input) {
? r_str_newf ("%s; %s", fcn ? fcn->name : "(nofunc)", comment)
: r_str_newf ("%s", fcn ? fcn->name : "(nofunc)");
free (print_comment);
r_cons_printf ("%s 0x%" PFMT64x " [%s] %s\n",
buf_fcn, ref->addr, r_anal_xrefs_type_tostring (ref->type), buf_asm);
r_cons_printf ("%s 0x%" PFMT64x " [%s:%s] %s\n",
buf_fcn, ref->addr, r_anal_ref_type_tostring (ref->type),
r_anal_ref_perm_tostring (ref), buf_asm);
free (buf_asm);
free (buf_fcn);
}
@ -8877,14 +8889,14 @@ static bool cmd_anal_refs(RCore *core, const char *input) {
const char *name = f ? f->name: "";
if (pj) {
pj_o (pj);
pj_ks (pj, "type", r_anal_xrefs_type_tostring(refi->type));
pj_ks (pj, "type", r_anal_ref_type_tostring(refi->type));
pj_kn (pj, "at", refi->at);
pj_kn (pj, "ref", refi->addr);
pj_ks (pj, "name", name);
pj_end (pj);
} else {
r_cons_printf ("%s 0x%08"PFMT64x" 0x%08"PFMT64x" %s\n",
r_anal_xrefs_type_tostring(refi->type), refi->at, refi->addr, name);
r_anal_ref_type_tostring(refi->type), refi->at, refi->addr, name);
}
}
if (pj) {
@ -8949,7 +8961,8 @@ static bool cmd_anal_refs(RCore *core, const char *input) {
pj_o (pj);
pj_kn (pj, "from", ref->at);
pj_kn (pj, "to", ref->addr);
pj_ks (pj, "type", r_anal_xrefs_type_tostring (ref->type));
pj_ks (pj, "type", r_anal_ref_type_tostring (ref->type));
pj_ks (pj, "perm", r_anal_ref_perm_tostring (ref));
pj_ks (pj, "opcode", r_asm_op_get_asm (&asmop));
pj_end (pj);
}
@ -8987,10 +9000,10 @@ static bool cmd_anal_refs(RCore *core, const char *input) {
desc = str;
}
}
r_cons_printf ("%c 0x%" PFMT64x " %s",
ref->type ? ref->type : ' ', ref->addr, desc);
r_cons_printf ("%s 0x%" PFMT64x " %s",
r_anal_ref_type_tostring (ref->type), ref->addr, desc);
if (ref->type == R_ANAL_REF_TYPE_CALL) {
if (R_ANAL_REF_TYPE_MASK (ref->type) == R_ANAL_REF_TYPE_CALL) {
RAnalOp aop;
r_anal_op (core->anal, &aop, ref->addr, buf, sizeof (buf), R_ANAL_OP_MASK_BASIC);
if (aop.type == R_ANAL_OP_TYPE_UCALL) {
@ -9014,6 +9027,8 @@ static bool cmd_anal_refs(RCore *core, const char *input) {
break;
case 'C': // "axC"
case 'c': // "axc"
case 'r': // "axr"
case 'w': // "axw"
case 'd': // "axd"
case 's': // "axs"
case ' ': // "ax "

View File

@ -2082,7 +2082,7 @@ static void do_ref_search(RCore *core, ut64 addr,ut64 from, ut64 to, struct sear
free (print_comment);
if (from <= ref->addr && to >= ref->addr) {
r_cons_printf ("%s 0x%" PFMT64x " [%s] %s\n",
buf_fcn, ref->addr, r_anal_xrefs_type_tostring (ref->type), str);
buf_fcn, ref->addr, r_anal_ref_type_tostring (ref->type), str);
if (*param->cmd_hit) {
ut64 here = core->offset;
r_core_seek (core, ref->addr, true);

View File

@ -1078,9 +1078,8 @@ static void ds_build_op_str(RDisasmState *ds, bool print_color) {
RListIter *iter;
RAnalRef *ref;
r_list_foreach (list, iter, ref) {
if ((ref->type == R_ANAL_REF_TYPE_DATA
|| ref->type == R_ANAL_REF_TYPE_STRING)
&& ds->analop.type == R_ANAL_OP_TYPE_LEA) {
int rt = R_ANAL_REF_TYPE_MASK (ref->type);
if ((rt == R_ANAL_REF_TYPE_DATA || rt == R_ANAL_REF_TYPE_STRING) && ds->analop.type == R_ANAL_OP_TYPE_LEA) {
core->parser->subrel_addr = ref->addr;
break;
}
@ -1374,6 +1373,8 @@ static void ds_show_refs(RDisasmState *ds) {
}
static void ds_show_xrefs(RDisasmState *ds) {
char xrefs_char[32]; // no more than 32 xrefs meh
int xci = 0;
RAnalRef *refi;
RListIter *iter, *it;
RCore *core = ds->core;
@ -1412,7 +1413,7 @@ static void ds_show_xrefs(RDisasmState *ds) {
ds_comment (ds, false, "%s; XREFS: ", ds->show_color? ds->pal_comment: "");
r_list_foreach (xrefs, iter, refi) {
ds_comment (ds, false, "%s 0x%08"PFMT64x" ",
r_anal_xrefs_type_tostring (refi->type), refi->addr);
r_anal_ref_type_tostring (refi->type), refi->addr);
if (count == cols) {
if (iter->n) {
ds_print_color_reset (ds);
@ -1436,7 +1437,8 @@ static void ds_show_xrefs(RDisasmState *ds) {
RAnalFunction *fun, *next_fun;
RFlagItem *f, *next_f;
r_list_foreach (xrefs, iter, refi) {
if (!ds->asm_xrefs_code && refi->type == R_ANAL_REF_TYPE_CODE) {
int rt = R_ANAL_REF_TYPE_MASK (refi->type);
if (!ds->asm_xrefs_code && rt == R_ANAL_REF_TYPE_CODE) {
continue;
}
if (refi->at == ds->at) {
@ -1447,6 +1449,9 @@ static void ds_show_xrefs(RDisasmState *ds) {
ut64 next_addr = ((RAnalRef *)(iter->n->data))->addr;
next_fun = r_anal_get_fcn_in (core->anal, next_addr, -1);
if (next_fun && next_fun->addr == fun->addr) {
if (xci < 32) {
xrefs_char[xci++] = r_anal_ref_perm_tochar (refi);
}
r_list_append (addrs, r_num_dup (refi->addr));
continue;
}
@ -1458,6 +1463,9 @@ static void ds_show_xrefs(RDisasmState *ds) {
}
}
name = strdup (fun->name);
if (xci < 32) {
xrefs_char[xci++] = r_anal_ref_perm_tochar (refi);
}
r_list_append (addrs, r_num_dup (refi->addr));
} else {
f = r_flag_get_at (core->flags, refi->addr, true);
@ -1466,6 +1474,9 @@ static void ds_show_xrefs(RDisasmState *ds) {
ut64 next_addr = ((RAnalRef *)(iter->n->data))->addr;
next_f = r_flag_get_at (core->flags, next_addr, true);
if (next_f && f->offset == next_f->offset) {
if (xci < 32) {
xrefs_char[xci++] = r_anal_ref_perm_tochar (refi);
}
r_list_append (addrs, r_num_dup (refi->addr - f->offset));
continue;
}
@ -1482,6 +1493,9 @@ static void ds_show_xrefs(RDisasmState *ds) {
}
}
name = strdup (f->name);
if (xci < 32) {
xrefs_char[xci++] = r_anal_ref_perm_tochar (refi);
}
r_list_append (addrs, r_num_dup (refi->addr - f->offset));
} else {
name = strdup ("unk");
@ -1492,12 +1506,16 @@ static void ds_show_xrefs(RDisasmState *ds) {
const char* plural = r_list_length (addrs) > 1 ? "S" : "";
const char* plus = fun ? "" : "+";
ds_comment (ds, false, "%s; %s XREF%s from %s @ ",
COLOR (ds, pal_comment), r_anal_xrefs_type_tostring (refi->type), plural,
COLOR (ds, pal_comment), r_anal_ref_type_tostring (refi->type), plural,
realname ? realname : name);
ut64 *addrptr;
int i = 0;
r_list_foreach (addrs, it, addrptr) {
if (addrptr && *addrptr) {
ds_comment (ds, false, "%s%s0x%"PFMT64x, it == addrs->head ? "" : ", ", plus, *addrptr);
char ch = xrefs_char [i++];
ds_comment (ds, false, "%s%s0x%"PFMT64x"(%c)",
it == addrs->head ? "" : ", ", plus, *addrptr, ch);
}
}
if (realname && (!fun || r_anal_get_function_at (core->anal, ds->at))) {
@ -4167,7 +4185,8 @@ static void ds_print_ptr(RDisasmState *ds, int len, int idx) {
RAnalRef *ref;
list = r_anal_refs_get (core->anal, ds->at);
r_list_foreach (list, iter, ref) {
if (ref->type == R_ANAL_REF_TYPE_STRING || ref->type == R_ANAL_REF_TYPE_DATA) {
int rt = R_ANAL_REF_TYPE_MASK (ref->type);
if (rt == R_ANAL_REF_TYPE_STRING || rt == R_ANAL_REF_TYPE_DATA) {
if ((f = r_flag_get_i (core->flags, ref->addr))) {
refaddr = ref->addr;
break;
@ -6562,7 +6581,8 @@ R_API int r_core_print_disasm_json(RCore *core, ut64 addr, ut8 *buf, int nb_byte
r_list_foreach (refs, iter, ref) {
pj_o (pj);
pj_kn (pj, "addr", ref->addr);
pj_ks (pj, "type", r_anal_xrefs_type_tostring (ref->type));
pj_ks (pj, "type", r_anal_ref_type_tostring (ref->type));
pj_ks (pj, "perm", r_anal_ref_perm_tostring (ref));
pj_end (pj);
}
pj_end (pj);
@ -6580,7 +6600,8 @@ R_API int r_core_print_disasm_json(RCore *core, ut64 addr, ut8 *buf, int nb_byte
r_list_foreach (xrefs, iter, ref) {
pj_o (pj);
pj_kn (pj, "addr", ref->addr);
pj_ks (pj, "type", r_anal_xrefs_type_tostring (ref->type));
pj_ks (pj, "type", r_anal_ref_type_tostring (ref->type));
pj_ks (pj, "perm", r_anal_ref_perm_tostring (ref));
pj_end (pj);
}
pj_end (pj);

View File

@ -1,4 +1,4 @@
/* radare - LGPL - Copyright 2021 - Siguza, pancake, hot3eed */
/* radare - LGPL - Copyright 2021-2022 - Siguza, pancake, hot3eed */
// Context: https://raw.githubusercontent.com/Siguza/misc/master/xref.c

View File

@ -1523,7 +1523,7 @@ repeat:
r_str_trim (cmt);
r_cons_printf (" %d [%s] 0x%08"PFMT64x" 0x%08"PFMT64x " %s %sref (%s) ; %s\n",
idx, cstr, refi->at, refi->addr,
r_anal_xrefs_type_tostring (refi->type),
r_anal_ref_type_tostring (refi->type),
xref ? "x":"", name, cmt);
free (cmt);
free (name);

View File

@ -965,19 +965,27 @@ typedef struct r_anal_bb_t {
} RAnalBlock;
typedef enum {
R_ANAL_REF_TYPE_NULL = 0,
R_ANAL_REF_TYPE_NULL = 0, // find better name
R_ANAL_REF_TYPE_CODE = 'c', // code ref
R_ANAL_REF_TYPE_CALL = 'C', // code ref (call)
R_ANAL_REF_TYPE_JUMP = 'j', // code ref (call)
R_ANAL_REF_TYPE_DATA = 'd', // mem ref
R_ANAL_REF_TYPE_STRING='s' // string ref
R_ANAL_REF_TYPE_STRING = 's', // string ref
R_ANAL_REF_TYPE_READ = 4 << 8,
R_ANAL_REF_TYPE_WRITE = 2 << 8,
R_ANAL_REF_TYPE_EXEC = 1 << 8,
R_ANAL_REF_TYPE_MASK = 0xff,
R_ANAL_REF_TYPE_DIRECTION_MASK = 0xff00
} RAnalRefType;
#define R_ANAL_REF_TYPE_PERM(x) (((x)>>8) & 0xff)
#define R_ANAL_REF_TYPE_MASK(x) ((x) & 0xff)
typedef struct r_anal_ref_t {
ut64 addr;
ut64 at;
RAnalRefType type;
} RAnalRef;
R_API const char *r_anal_ref_type_tostring(RAnalRefType t);
/* represents a reference line from one address (from) to another (to) */
typedef struct r_anal_refline_t {
@ -1720,9 +1728,15 @@ R_API bool r_anal_pin_set(RAnal *a, const char *name, const char *cmd);
typedef bool (* RAnalRefCmp)(RAnalRef *ref, void *data);
R_API RList *r_anal_ref_list_new(void);
R_API const char *r_anal_ref_type_tostring(RAnalRefType t);
R_API ut64 r_anal_xrefs_count(RAnal *anal);
R_API const char *r_anal_xrefs_type_tostring(RAnalRefType type);
R_API RAnalRefType r_anal_xrefs_type(char ch);
R_DEPRECATE R_API RAnalRefType r_anal_xrefs_type(char ch);
R_API const char *r_anal_ref_perm_tostring(RAnalRef *ref);
R_API char r_anal_ref_perm_tochar(RAnalRef *ref);
R_API char r_anal_ref_permchar_tostring(RAnalRef *ref);
R_API RAnalRefType r_anal_xrefs_type_from_string(const char *s);
R_API RList *r_anal_xrefs_get(RAnal *anal, ut64 to);
R_API RList *r_anal_refs_get(RAnal *anal, ut64 to);
R_API RList *r_anal_xrefs_get_from(RAnal *anal, ut64 from);

View File

@ -640,7 +640,7 @@ afva@sym.call
pdf@sym.call
EOF
EXPECT=<<EOF
; CALL XREF from main @ 0x10468
; CALL XREF from main @ 0x10468(x)
/ (fcn) sym.call 44
| ; arg int32_t arg1 @ r0
| ; var int32_t var_8h @ fp-0x8
@ -698,7 +698,7 @@ EXPECT=<<EOF
0x00010328 .dword 0x000104e0 ; sym.__libc_csu_fini
0x0001032c .dword 0x00010450 ; main ; sym.main
;-- aav.0x00010330:
; UNKNOWN XREF from section..plt @ +0x10
; NULL XREF from section..plt @ +0x10(r)
0x00010330 .dword 0x0001047c ; sym.__libc_csu_init
EOF
RUN
@ -1051,7 +1051,7 @@ af
axt str.helloradareworld_n
EOF
EXPECT=<<EOF
main 0xbf9c [STRING] add r0, pc
main 0xbf9c [STRN:-w-] add r0, pc
EOF
RUN

View File

@ -12,7 +12,7 @@ EOF
EXPECT=<<EOF
;-- str..._.._third_party_boringssl_src_ssl_ssl_x509.cc:
;-- s:
; STRING XREF from f @ 0x37194e
; STRN XREF from f @ 0x37194e(w)
0x00080c62 .string "../../third_party/boringssl/src/ssl/ssl_x509.cc" ; len=48
;-- str..._.._third_party_boringssl_src_ssl_ssl_asn1.cc:
0x00080c92 .string "../../third_party/boringssl/src/ssl/ssl_asn1.cc" ; len=48
@ -33,7 +33,7 @@ EOF
EXPECT=<<EOF
;-- str..._.._third_party_boringssl_src_ssl_ssl_x509.cc:
;-- s:
; STRING XREF from f @ 0x37194e
; STRN XREF from f @ 0x37194e(r)
0x00080c62 .string "../../third_party/boringssl/src/ssl/ssl_x509.cc" ; len=48
;-- str..._.._third_party_boringssl_src_ssl_ssl_asn1.cc:
0x00080c92 .string "../../third_party/boringssl/src/ssl/ssl_asn1.cc" ; len=48

File diff suppressed because it is too large Load Diff

View File

@ -374,7 +374,7 @@ aaa
axt 0x28a
EOF
EXPECT=<<EOF
fcn.0000029e 0x328 [CODE] jmp 0x28a
fcn.0000029e 0x328 [CODE:--x] jmp 0x28a
EOF
RUN
@ -579,7 +579,7 @@ aac @ 0
axt 0x4ec
EOF
EXPECT=<<EOF
fcn.00000360 0x3e2 [CALL] call fcn.000004ec
fcn.00000360 0x3e2 [CALL:--x] call fcn.000004ec
EOF
RUN
@ -592,7 +592,7 @@ aaa
axt 0x4ec
EOF
EXPECT=<<EOF
fcn.00000360 0x3e2 [CALL] call fcn.000004ec
fcn.00000360 0x3e2 [CALL:--x] call fcn.000004ec
EOF
RUN

View File

@ -14,7 +14,7 @@ NAME=Dalvik HelloWorld string xref
FILE=bins/dex/HelloWorld.dex
CMDS=aa; axt @ str.Findus
EXPECT=<<EOF
entry0 0x260 [DATA] const-string v1, str.Findus
entry0 0x260 [DATA:r--] const-string v1, str.Findus
EOF
RUN
@ -22,6 +22,6 @@ NAME=Dalvik HelloWorld func xref
FILE=bins/dex/HelloWorld.dex
CMDS=e io.va=0; aa; axt @ sym.LHello.method._init___V
EXPECT=<<EOF
entry0 0x26e [CALL] invoke-direct {v0}, LHello.<init>()V ; 0x0
entry0 0x26e [CALL:--x] invoke-direct {v0}, LHello.<init>()V ; 0x0
EOF
RUN

View File

@ -87,19 +87,19 @@ ret paths
`------------------------' v
v |
| |
'------. |
| .--------------------'
| |
.---------------------------------------------.
| 0x100007f1c |
| ; CODE XREF from sym._retbool @ 0x100007f0c |
| ldurb w8, [x29, -1] |
| and w8, w8, 1 |
| and w0, w8, 0xff |
| ldp x29, x30, [var_10h] |
| add sp, arg_20h |
| ret |
`---------------------------------------------'
'----. |
| .----------------------'
| |
.------------------------------------------------.
| 0x100007f1c |
| ; CODE XREF from sym._retbool @ 0x100007f0c(x) |
| ldurb w8, [x29, -1] |
| and w8, w8, 1 |
| and w0, w8, 0xff |
| ldp x29, x30, [var_10h] |
| add sp, arg_20h |
| ret |
`------------------------------------------------'
path
0x100007ed8
fromblocks

View File

@ -28,8 +28,8 @@ aae @entry0
axt sym.imp.signal
EOF
EXPECT=<<EOF
sym.imp.open 0x9acc [CALL] jirl zero, t3, 0
(nofunc) 0x9f98 [CALL] bl -sym.imp.signal #
sym.imp.open 0x9acc [CALL:--x] jirl zero, t3, 0
(nofunc) 0x9f98 [CALL:--x] bl -sym.imp.signal #
EOF
RUN

View File

@ -16,35 +16,35 @@ EOF
EXPECT=<<EOF
| `=< 0x00008058 03e4 b 0x7862
0x0000805a 0000 movs r0, r0
; DATA XREF from sub.free_73a0 @ 0x7d30
; DATA XREF from sub.free_73a0 @ 0x7d30(r)
0x0000805c .dword 0x000693da
; DATA XREF from sub.free_73a0 @ 0x7d3e
; DATA XREF from sub.free_73a0 @ 0x7d3e(r)
0x00008060 .dword 0x0006c1f4
; DATA XREF from sub.free_73a0 @ 0x7d48
; DATA XREF from sub.free_73a0 @ 0x7d48(r)
0x00008064 .dword 0x0006c1a6
; DATA XREF from sub.free_73a0 @ 0x7e30
; DATA XREF from sub.free_73a0 @ 0x7e30(r)
0x00008068 .dword 0x0006c102
; DATA XREF from sub.free_73a0 @ 0x7e3a
; DATA XREF from sub.free_73a0 @ 0x7e3a(r)
0x0000806c .dword 0x0006c0b4
; DATA XREF from sub.free_73a0 @ 0x7e58
; DATA XREF from sub.free_73a0 @ 0x7e58(r)
0x00008070 .dword 0x0006c0da
; DATA XREF from sub.free_73a0 @ 0x7e62
; DATA XREF from sub.free_73a0 @ 0x7e62(r)
0x00008074 .dword 0x0006c08c
; DATA XREF from sub.strcpy_7890 @ 0x7e80
; DATA XREF from sub.strcpy_7890 @ 0x7e80(r)
0x00008078 .dword 0x0006c0b2
; DATA XREF from sub.strcpy_7890 @ 0x7e8a
; DATA XREF from sub.strcpy_7890 @ 0x7e8a(r)
0x0000807c .dword 0x0006c064
; DATA XREF from sub.strcpy_7890 @ 0x7ed8
; DATA XREF from sub.strcpy_7890 @ 0x7ed8(r)
0x00008080 .dword 0x00069232
; DATA XREF from sub.strcpy_7890 @ 0x7ee8
; DATA XREF from sub.strcpy_7890 @ 0x7ee8(r)
0x00008084 .dword 0x0006c04a
; DATA XREF from sub.strcpy_7890 @ 0x7ef2
; DATA XREF from sub.strcpy_7890 @ 0x7ef2(r)
0x00008088 .dword 0x0006bffc
; DATA XREF from sub.free_73a0 @ 0x7f64
; DATA XREF from sub.free_73a0 @ 0x7f64(r)
0x0000808c .dword 0x0006bfce
; DATA XREF from sub.free_73a0 @ 0x7f72
; DATA XREF from sub.free_73a0 @ 0x7f72(r)
0x00008090 .dword 0x0006bf7c
; DATA XREF from sub.free_73a0 @ 0x7fcc
; DATA XREF from sub.free_73a0 @ 0x7fcc(r)
0x00008094 .dword 0x0006bf66
EOF
RUN

View File

@ -46,7 +46,7 @@ axt str.busybox
EOF
EXPECT=<<EOF
0x00406228 fcc38424 addiu a0, a0, -0x3c04 ; 0x44c3fc ; "busybox" ; str.busybox
(nofunc); str.busybox 0x406228 [DATA] addiu a0, a0, -str.busybox
(nofunc); str.busybox 0x406228 [DATA:r--] addiu a0, a0, -str.busybox
EOF
RUN
@ -83,7 +83,7 @@ aae @entry0
axt str.Hello_World
EOF
EXPECT=<<EOF
(nofunc); str.Hello_World 0x805c4 [DATA] addiu a0, v0, str.Hello_World
(nofunc); str.Hello_World 0x805c4 [DATA:r--] addiu a0, v0, str.Hello_World
EOF
RUN
@ -252,7 +252,7 @@ EXPECT=<<EOF
0x80100014 00000000 nop
0x80100018 40040408 j 0x80101100
0x8010001c 00000000 nop
; CALL XREF from fcn.80100000 @ 0x80100000
; CALL XREF from fcn.80100000 @ 0x80100000(x)
(fcn) fcn.80100020 8
0x80100020 0800e003 jr ra
0x80100024 00000000 nop

View File

@ -144,7 +144,7 @@ EOF
RUN
NAME=pdf
FILE=bins/elf/test.o
FILE=bins/elf/test_o
CMDS=<<EOF
af
pdf
@ -346,7 +346,7 @@ EXPECT=<<EOF
\ 0x00000015 c3 ret
0x00000016 cc int3
0x00000017 cc int3
; CALL XREF from fcn.00000000 @ 0x9
; CALL XREF from fcn.00000000 @ 0x9(x)
/ 5: fcn.00000018 (int64_t arg1, int64_t arg2);
| ; arg int64_t arg1 @ rcx
| ; arg int64_t arg2 @ rdx

View File

@ -159,7 +159,7 @@ aar
axt 0x4bffb0
EOF
EXPECT=<<EOF
(nofunc) 0x4bfe53 [DATA] mov edx, 0x4bffb0
(nofunc) 0x4bfe53 [DATA:r--] mov edx, 0x4bffb0
EOF
RUN
@ -1420,7 +1420,7 @@ aar
axt @ str.john
EOF
EXPECT=<<EOF
main 0x804831a [DATA] mov dword [var_ch], str.john
main 0x804831a [DATA:r--] mov dword [var_ch], str.john
EOF
RUN
@ -3404,7 +3404,7 @@ s 0x00402130
axt
EOF
EXPECT=<<EOF
(nofunc) 0x4010d1 [DATA] lea edx, [ebx*4 + 0x402130]
(nofunc) 0x4010d1 [DATA:r--] lea edx, [ebx*4 + 0x402130]
EOF
RUN
@ -3561,30 +3561,30 @@ EXPECT=<<EOF
[0x0804805b]> # fcn.0804805b ();
----.
| |
|.-------------------------------------------.
|| 0x8048054 |
|| ;-- entry0: |
|| ; CODE XREF from fcn.0804805b @ 0x804805b |
|| ; '*' |
|| ; 42 |
|| mov bl, 0x2a |
|| xor eax, eax |
|| inc eax |
|| ;-- syscall.close: |
|| int 0x80 |
|`-------------------------------------------'
|.----------------------------------------------.
|| 0x8048054 |
|| ;-- entry0: |
|| ; CODE XREF from fcn.0804805b @ 0x804805b(x) |
|| ; '*' |
|| ; 42 |
|| mov bl, 0x2a |
|| xor eax, eax |
|| inc eax |
|| ;-- syscall.close: |
|| int 0x80 |
|`----------------------------------------------'
| v
| |
| '----------.
| |
| .---------------------.
| | 0x804805b |
| | 9: fcn.0804805b (); |
| | jmp entry0 |
| `---------------------'
| v
| |
`---------------'
| '------------.
| |
| .---------------------.
| | 0x804805b |
| | 9: fcn.0804805b (); |
| | jmp entry0 |
| `---------------------'
| v
| |
`-----------------'
0x0804805b 2 9 fcn.0804805b
EOF

View File

@ -488,7 +488,7 @@ EXPECT=<<EOF
| ;-- switch
| 0x00003ec4 jmp rax ; switch table (275 cases) at 0x172d8
| ;-- case 110: ; from 0x00003ec4
| ; CODE XREF from main @ 0x3ec4
| ; CODE XREF from main @ 0x3ec4(x)
| 0x00003ec6 mov byte [0x00021260], 1 ; [0x21260:1]=0
EOF
RUN
@ -1403,7 +1403,7 @@ EXPECT=<<EOF
| ||||| 0x0001141a mov rax, qword [rip + 0xdeaf] ; reloc.program_invocation_short_name
| ||||| ; [0x1f2d0:8]=0
| ||||| 0x00011421 mov qword [rax], rbx
| ||||| ; CODE XREFS from fcn.00011390 @ 0x113d0, 0x113e0, 0x113f4, 0x11414
| ||||| ; CODE XREFS from fcn.00011390 @ 0x113d0(x), 0x113e0(x), 0x113f4(x), 0x11414(x)
| ````--> 0x00011424 mov rax, qword [rip + 0xde3d] ; [0x1f268:8]=0x21680
EOF
RUN
@ -1428,9 +1428,9 @@ EXPECT=<<EOF
| || 0x00003cb4 sub eax, 1
| ,===< 0x00003cb7 je 0x3cbe
| ||| ;-- default: ; from 0x58d2
| ||| ; CODE XREFS from main @ 0x58bc, 0x58d2
| ||| ; CODE XREFS from main @ 0x58bc(x), 0x58d2(x)
| ||| 0x00003cb9 call sym.imp.abort ; void abort(void)
| ||| ; CODE XREF from main @ 0x3cb7
| ||| ; CODE XREF from main @ 0x3cb7(x)
| `---> 0x00003cbe mov edi, 1 ; int fd
| || 0x00003cc3 call sym.imp.isatty ; int isatty(int fd)
| || 0x00003cc8 test eax, eax
@ -1438,12 +1438,12 @@ EXPECT=<<EOF
| ||| 0x00003cd0 mov dword [rip + 0x1d626], 2 ; [0x21300:4]=0
| ||| 0x00003cda mov byte [rip + 0x1d33f], 1 ; [0x21020:1]=0
| ,====< 0x00003ce1 jmp 0x3cf9
| |||| ; CODE XREF from main @ 0x3cb2
| |||| ; CODE XREF from main @ 0x3cb2(x)
| ||`--> 0x00003ce3 mov esi, 5 ; int64_t arg2
| || | 0x00003ce8 xor edi, edi ; int64_t arg1
| || | 0x00003cea mov dword [rip + 0x1d60c], 0 ; [0x21300:4]=0
| || | 0x00003cf4 call fcn.00012740
| || | ; CODE XREFS from main @ 0x3ce1, 0x4602, 0x4c38
| || | ; CODE XREFS from main @ 0x3ce1(x), 0x4602(x), 0x4c38(x)
| `----> 0x00003cf9 lea rdi, [rip + 0x14fb4] ; str.QUOTING_STYLE
| | | ; 0x18cb4 ; "QUOTING_STYLE" ; const char *name
EOF
@ -1470,9 +1470,9 @@ EXPECT=<<EOF
| | | 0x00003cb4 sub eax, 1
| ,======< 0x00003cb7 je 0x3cbe
| | | | ;-- default: ; from 0x58d2
| | | | ; CODE XREFS from main @ 0x58bc, 0x58d2
| | | | ; CODE XREFS from main @ 0x58bc(x), 0x58d2(x)
| | | | 0x00003cb9 call sym.imp.abort ; void abort(void)
| | | | ; CODE XREF from main @ 0x3cb7
| | | | ; CODE XREF from main @ 0x3cb7(x)
| `------> 0x00003cbe mov edi, 1 ; int fd
| | | 0x00003cc3 call sym.imp.isatty ; int isatty(int fd)
| | | 0x00003cc8 test eax, eax
@ -1480,12 +1480,12 @@ EXPECT=<<EOF
| | | | 0x00003cd0 mov dword [rip + 0x1d626], 2 ; [0x21300:4]=0
| | | | 0x00003cda mov byte [rip + 0x1d33f], 1 ; [0x21020:1]=0
| ========< 0x00003ce1 jmp 0x3cf9
| | | | ; CODE XREF from main @ 0x3cb2
| | | | ; CODE XREF from main @ 0x3cb2(x)
| | `----> 0x00003ce3 mov esi, 5 ; int64_t arg2
| | | 0x00003ce8 xor edi, edi ; int64_t arg1
| | | 0x00003cea mov dword [rip + 0x1d60c], 0 ; [0x21300:4]=0
| | | 0x00003cf4 call fcn.00012740
| | | ; CODE XREFS from main @ 0x3ce1, 0x4602, 0x4c38
| | | ; CODE XREFS from main @ 0x3ce1(x), 0x4602(x), 0x4c38(x)
| --------> 0x00003cf9 lea rdi, [rip + 0x14fb4] ; str.QUOTING_STYLE
| | | ; 0x18cb4 ; "QUOTING_STYLE" ; const char *name
EOF
@ -1511,9 +1511,9 @@ EXPECT=<<EOF
| | | 0x00003cb4 sub eax, 1
| ,======< 0x00003cb7 je 0x3cbe
| | | | ;-- default: ; from 0x58d2
| | | | ; CODE XREFS from main @ 0x58bc, 0x58d2
| | | | ; CODE XREFS from main @ 0x58bc(x), 0x58d2(x)
| | | | 0x00003cb9 call sym.imp.abort ; void abort(void)
| | | | ; CODE XREF from main @ 0x3cb7
| | | | ; CODE XREF from main @ 0x3cb7(x)
| `------> 0x00003cbe mov edi, 1 ; int fd
| | | 0x00003cc3 call sym.imp.isatty ; int isatty(int fd)
| | | 0x00003cc8 test eax, eax
@ -1521,12 +1521,12 @@ EXPECT=<<EOF
| | | | 0x00003cd0 mov dword [rip + 0x1d626], 2 ; [0x21300:4]=0
| | | | 0x00003cda mov byte [rip + 0x1d33f], 1 ; [0x21020:1]=0
| ========< 0x00003ce1 jmp 0x3cf9
| | | | ; CODE XREF from main @ 0x3cb2
| | | | ; CODE XREF from main @ 0x3cb2(x)
| | `----> 0x00003ce3 mov esi, 5 ; int64_t arg2
| | | 0x00003ce8 xor edi, edi ; int64_t arg1
| | | 0x00003cea mov dword [rip + 0x1d60c], 0 ; [0x21300:4]=0
| | | 0x00003cf4 call fcn.00012740
| | | ; CODE XREFS from main @ 0x3ce1, 0x4602, 0x4c38
| | | ; CODE XREFS from main @ 0x3ce1(x), 0x4602(x), 0x4c38(x)
| --------> 0x00003cf9 lea rdi, [rip + 0x14fb4] ; str.QUOTING_STYLE
| | | ; 0x18cb4 ; "QUOTING_STYLE" ; const char *name
EOF
@ -1584,7 +1584,7 @@ pd 3
EOF
EXPECT=<<EOF
╎ ; CALL XREF from main @ 0x400406
╎ ; CALL XREF from main @ 0x400406(x)
┌ 6: int sym.imp.puts (const char *s);
└ ╎ 0x004003f0 jmp qword [reloc.puts] ; [0x601018:8]=0x4003f6
╎ 0x004003f6 push 0
@ -1978,7 +1978,7 @@ pdf
EOF
EXPECT=<<EOF
fastcall
; CALL XREF from main @ 0x80484c7
; CALL XREF from main @ 0x80484c7(x)
/ 59: sym.fastcaslled (int32_t arg1, int32_t arg2, int32_t arg_8h, int32_t arg_ch);
| ; arg int32_t arg1 @ ecx
| ; arg int32_t arg2 @ edx
@ -2024,7 +2024,7 @@ pdf
EOF
EXPECT=<<EOF
cdecl
; CALL XREF from main @ 0x80484db
; CALL XREF from main @ 0x80484db(x)
/ (fcn) sym.nonfastcaslled 51
// void sym.nonfastcaslled (int32_t arg_8h, int32_t arg_ch, int32_t arg_10h, int32_t arg_14h);
| ; arg int32_t arg_8h @ ebp+0x8
@ -2307,7 +2307,7 @@ aa
axt @ str.Hello_World
EOF
EXPECT=<<EOF
main 0x40050a [DATA] mov edi, str.Hello_World
main 0x40050a [DATA:r--] mov edi, str.Hello_World
EOF
RUN
@ -2322,7 +2322,7 @@ aa
axt @ str.Password:_
EOF
EXPECT=<<EOF
main 0x804843c [DATA] mov dword [esp], str.Password:_
main 0x804843c [DATA:-w-] mov dword [esp], str.Password:_
EOF
RUN
@ -2333,9 +2333,9 @@ aaa
axt @ sym.imp.exit
EOF
EXPECT=<<EOF
fcn.08048524 0x804853d [CALL] call sym.imp.exit
fcn.08048542 0x80485ab [CALL] call sym.imp.exit
(nofunc) 0x804866f [CALL] call sym.imp.exit
fcn.08048524 0x804853d [CALL:--x] call sym.imp.exit
fcn.08048542 0x80485ab [CALL:--x] call sym.imp.exit
(nofunc) 0x804866f [CALL:--x] call sym.imp.exit
EOF
RUN
@ -2346,9 +2346,9 @@ aaaa
axt @ sym.imp.exit
EOF
EXPECT=<<EOF
fcn.08048524 0x804853d [CALL] call sym.imp.exit
fcn.08048542 0x80485ab [CALL] call sym.imp.exit
(nofunc) 0x804866f [CALL] call sym.imp.exit
fcn.08048524 0x804853d [CALL:--x] call sym.imp.exit
fcn.08048542 0x80485ab [CALL:--x] call sym.imp.exit
(nofunc) 0x804866f [CALL:--x] call sym.imp.exit
EOF
RUN
@ -2362,8 +2362,8 @@ e asm.sub.rel=true
axt @ sym.imp.msvcrt.dll_printf
EOF
EXPECT=<<EOF
entry0 0xffffffffffff100a [CALL] call qword [rip + 0xd8]
entry0 0xffffffffffff100a [CALL] call qword [sym.imp.msvcrt.dll_printf]
entry0 0xffffffffffff100a [CALL:--x] call qword [rip + 0xd8]
entry0 0xffffffffffff100a [CALL:--x] call qword [sym.imp.msvcrt.dll_printf]
EOF
RUN
@ -2376,7 +2376,7 @@ ax-10 20
axq
EOF
EXPECT=<<EOF
0x00000014 -> 0x0000000a UNKNOWN
0x00000014 -> 0x0000000a NULL:r--
EOF
RUN
@ -2390,7 +2390,7 @@ ax-10
axq
EOF
EXPECT=<<EOF
0x00000014 -> 0x0000000a UNKNOWN
0x00000014 -> 0x0000000a NULL:r--
EOF
RUN
@ -2403,7 +2403,7 @@ ax-*
ax
EOF
EXPECT=<<EOF
? 0x0 -> UNKNOWN -> 0xa
? 0x0 > NULL:r-- > 0xa
EOF
RUN
@ -2414,7 +2414,7 @@ aaa
axt fcn.00401270
EOF
EXPECT=<<EOF
(nofunc) 0x401a1d [CALL] call fcn.00401270
(nofunc) 0x401a1d [CALL:--x] call fcn.00401270
EOF
RUN
@ -2434,8 +2434,8 @@ s 0x804848a
axf
EOF
EXPECT=<<EOF
d 0x80485fe str.SdvvzrugRN____
d 0x80485fe str.SdvvzrugRN____
DATA 0x80485fe str.SdvvzrugRN____
DATA 0x80485fe str.SdvvzrugRN____
EOF
RUN
@ -2516,13 +2516,13 @@ axt 0x00001df4
axt 0x00001e09
EOF
EXPECT=<<EOF
main 0x1457 [STRING] lea eax, str._Take_the_Red_Pill____n
main 0x148e [STRING] lea eax, str._use:_._exploit1_PILL_
main 0x14eb [STRING] lea eax, str._____Red_Pill__0x50444552
main 0x1502 [STRING] lea eax, str._____Your_Pill_0x_08x_n
main 0x1523 [STRING] lea eax, str._n__Red_Pill
main 0x1557 [STRING] lea eax, str.__fwhibbit
main 0x161d [STRING] lea eax, str._n__Blue_Pill
main 0x1457 [STRN:r--] lea eax, str._Take_the_Red_Pill____n
main 0x148e [STRN:r--] lea eax, str._use:_._exploit1_PILL_
main 0x14eb [STRN:r--] lea eax, str._____Red_Pill__0x50444552
main 0x1502 [STRN:r--] lea eax, str._____Your_Pill_0x_08x_n
main 0x1523 [STRN:r--] lea eax, str._n__Red_Pill
main 0x1557 [STRN:r--] lea eax, str.__fwhibbit
main 0x161d [STRN:r--] lea eax, str._n__Blue_Pill
EOF
RUN
@ -2533,7 +2533,7 @@ aaa
axt@0x0804a01c
EOF
EXPECT=<<EOF
main 0x80483ee [DATA] mov dword [obj.a], 0x1337
main 0x80483ee [DATA:r--] mov dword [obj.a], 0x1337
EOF
RUN
@ -2551,9 +2551,9 @@ ax-*
axq
EOF
EXPECT=<<EOF
0x00000014 -> 0x0000000a UNKNOWN
0x00000014 -> 0x0000000a UNKNOWN
0x00000028 -> 0x0000001e UNKNOWN
0x00000014 -> 0x0000000a NULL:r--
0x00000014 -> 0x0000000a NULL:r--
0x00000028 -> 0x0000001e NULL:r--
EOF
RUN
@ -2566,7 +2566,7 @@ aae
axt@0x80484e0
EOF
EXPECT=<<EOF
main 0x8048432 [STRING] lea eax, str.Hello_PIC_
main 0x8048432 [STRN:r--] lea eax, str.Hello_PIC_
EOF
RUN
@ -2586,13 +2586,13 @@ axt 0x00001df4
axt 0x00001e09
EOF
EXPECT=<<EOF
main 0x1457 [STRING] lea eax, [esi - 0x2277]
main 0x148e [STRING] lea eax, [esi - 0x2260]
main 0x14eb [STRING] lea eax, [esi - 0x2249]
main 0x1502 [STRING] lea eax, [esi - 0x222f]
main 0x1523 [STRING] lea eax, [esi - 0x2218]
main 0x1557 [STRING] lea eax, [esi - 0x220c]
main 0x161d [STRING] lea eax, [esi - 0x21f7]
main 0x1457 [STRN:r--] lea eax, [esi - 0x2277]
main 0x148e [STRN:r--] lea eax, [esi - 0x2260]
main 0x14eb [STRN:r--] lea eax, [esi - 0x2249]
main 0x1502 [STRN:r--] lea eax, [esi - 0x222f]
main 0x1523 [STRN:r--] lea eax, [esi - 0x2218]
main 0x1557 [STRN:r--] lea eax, [esi - 0x220c]
main 0x161d [STRN:r--] lea eax, [esi - 0x21f7]
EOF
RUN
@ -2606,7 +2606,7 @@ aae
axt@0x80484e0
EOF
EXPECT=<<EOF
main 0x8048432 [STRING] lea eax, [ebx - 0x1b20]
main 0x8048432 [STRN:r--] lea eax, [ebx - 0x1b20]
EOF
RUN
@ -2646,7 +2646,7 @@ axs 0x10
axq
EOF
EXPECT=<<EOF
0x00000000 -> 0x00000010 STRING
0x00000000 -> 0x00000010 STRN:r--
EOF
RUN
@ -2662,12 +2662,12 @@ pd 1 @0x400610
EOF
EXPECT=<<EOF
;-- __libc_csu_fini:
; DATA XREF from entry0 @ +0xf
; DATA XREF from entry0 @ +0xf(r)
0x00400730 f3c3 ret
; CODE XREF from sym.__do_global_ctors_aux @ +0x2d
; CODE XREF from sym.__do_global_ctors_aux @ +0x2d(x)
0x004007f0 4883eb08 sub rbx, 8
;-- __do_global_dtors_aux:
; CALL XREF from section..fini @ +0x4
; CALL XREF from section..fini @ +0x4(x)
0x00400610 55 push rbp
EOF
RUN
@ -2685,12 +2685,12 @@ pd 1 @0x4007f0
pd 1 @0x400610
EOF
EXPECT=<<EOF
; DATA XREF from entry0 @ 0x4005cf
; DATA XREF from entry0 @ 0x4005cf(r)
2: sym.__libc_csu_fini ();
0x00400730 f3c3 ret
; CODE XREF from sym.__do_global_ctors_aux @ 0x4007fd
; CODE XREF from sym.__do_global_ctors_aux @ 0x4007fd(x)
0x004007f0 4883eb08 sub rbx, 8
; CALL XREF from sym._fini @ 0x40080c
; CALL XREF from sym._fini @ 0x40080c(x)
100: sym.__do_global_dtors_aux ();
0x00400610 55 push rbp
EOF
@ -2736,7 +2736,7 @@ aaa
axt main
EOF
EXPECT=<<EOF
entry0 0x40488d [DATA] mov rdi, main
entry0 0x40488d [DATA:r--] mov rdi, main
EOF
RUN
@ -2820,7 +2820,7 @@ diff: type: new
/ 7: fcn.00000000 ();
| 0x00000000 ~ b8210000c1 mov eax, 0xc1000021 ; '!'
| ; CODE XREF from fcn.00000000 @ 0x5
| ; CODE XREF from fcn.00000000 @ 0x5(x)
\ .-> 0x00000004 c1ebfd shr ebx, 0xfd
/ 7: fcn.00000000 ();
@ -2885,36 +2885,36 @@ diff: type: new
| 0x00000000 b8210000c1 mov eax, 0xc1000021 ; '!'
| 0x00000005 ebfd jmp 4
| // true: 0x00000004
| ; CODE XREF from fcn.00000000 @ 0x5
| ; CODE XREF from fcn.00000000 @ 0x5(x)
| 0x00000004 c1ebfd shr ebx, 0xfd
| 0x00000007 bb2c000000 mov ebx, 0x2c ; ','
\ 0x0000000c cc int3
[0x00000000]> # fcn.00000000 ();
.------------------------.
| 0x0 |
| 16: fcn.00000000 (); |
| ; '!' |
| mov eax, 0xc1000021 |
| jmp 4 |
`------------------------'
v
|
.-----'
.------------------------.
| 0x0 |
| 16: fcn.00000000 (); |
| ; '!' |
| mov eax, 0xc1000021 |
| jmp 4 |
`------------------------'
v
|
.-------'
|
.-------------------------------------.
| 0x4 |
| ; CODE XREF from fcn.00000000 @ 0x5 |
| shr ebx, 0xfd |
| ; ',' |
| mov ebx, 0x2c |
| int3 |
`-------------------------------------'
.----------------------------------------.
| 0x4 |
| ; CODE XREF from fcn.00000000 @ 0x5(x) |
| shr ebx, 0xfd |
| ; ',' |
| mov ebx, 0x2c |
| int3 |
`----------------------------------------'
/ 16: fcn.00000000 ();
| 0x00000000 ~ b8210000c1 mov eax, 0xc1000021 ; '!'
| ; CODE XREF from fcn.00000000 @ 0x5
| ; CODE XREF from fcn.00000000 @ 0x5(x)
| .-> 0x00000004 c1ebfd shr ebx, 0xfd
| 0x00000007 bb2c000000 mov ebx, 0x2c ; ','
\ 0x0000000c cc int3
@ -2964,44 +2964,44 @@ diff: type: new
| 0x00000000 b8210000c1 mov eax, 0xc1000021 ; '!'
| 0x00000005 ebfd jmp 4
| // true: 0x00000004
| ; CODE XREFS from fcn.00000000 @ 0x5, 0xc
| ; CODE XREFS from fcn.00000000 @ 0x5(x), 0xc(x)
| 0x00000004 c1ebfd shr ebx, 0xfd
| 0x00000007 bb2c000000 mov ebx, 0x2c ; ','
\ 0x0000000c ebf6 jmp 4
| // true: 0x00000004
[0x00000000]> # fcn.00000000 ();
.------------------------.
| 0x0 |
| 17: fcn.00000000 (); |
| ; '!' |
| mov eax, 0xc1000021 |
| jmp 4 |
`------------------------'
v
|
'--------.
|
|
|
.---------------'
.------------------------.
| 0x0 |
| 17: fcn.00000000 (); |
| ; '!' |
| mov eax, 0xc1000021 |
| jmp 4 |
`------------------------'
v
|
'--------.
|
|
|
.------------------'
.--------.
| | |
|.-------------------------------------------.
|| 0x4 |
|| ; CODE XREFS from fcn.00000000 @ 0x5, 0xc |
|| shr ebx, 0xfd |
|| ; ',' |
|| mov ebx, 0x2c |
|| jmp 4 |
|`-------------------------------------------'
|.-------------------------------------------------.
|| 0x4 |
|| ; CODE XREFS from fcn.00000000 @ 0x5(x), 0xc(x) |
|| shr ebx, 0xfd |
|| ; ',' |
|| mov ebx, 0x2c |
|| jmp 4 |
|`-------------------------------------------------'
| v
| |
`----'
/ 17: fcn.00000000 ();
| 0x00000000 ~ b8210000c1 mov eax, 0xc1000021 ; '!'
| ; CODE XREFS from fcn.00000000 @ 0x5, 0xc
| ; CODE XREFS from fcn.00000000 @ 0x5(x), 0xc(x)
| ..-> 0x00000004 c1ebfd shr ebx, 0xfd
| : 0x00000007 bb2c000000 mov ebx, 0x2c ; ','
\ `=< 0x0000000c ebf6 jmp 4
@ -3051,52 +3051,52 @@ diff: type: new
/ 17: fcn.00000000 ();
| 0x00000000 b8210000c1 mov eax, 0xc1000021 ; '!'
| // true: 0x00000005
| ; CODE XREF from fcn.00000000 @ 0x5
| ; CODE XREF from fcn.00000000 @ 0x5(x)
| 0x00000004 c1ebfd shr ebx, 0xfd
| 0x00000007 bb2c000000 mov ebx, 0x2c ; ','
\ 0x0000000c ebf7 jmp 5
| // true: 0x00000005
| ; CODE XREF from fcn.00000000 @ 0xc
| ; CODE XREF from fcn.00000000 @ 0xc(x)
| 0x00000005 ebfd jmp 4
| // true: 0x00000004
[0x00000000]> # fcn.00000000 ();
.------------------------.
| 0x0 |
| 17: fcn.00000000 (); |
| ; '!' |
| mov eax, 0xc1000021 |
`------------------------'
v
|
.---'
.------------------------.
| 0x0 |
| 17: fcn.00000000 (); |
| ; '!' |
| mov eax, 0xc1000021 |
`------------------------'
v
|
.-----'
.--------.
| | |
|.-------------------------------------.
|| 0x5 |
|| ; CODE XREF from fcn.00000000 @ 0xc |
|| jmp 4 |
|`-------------------------------------'
|.----------------------------------------.
|| 0x5 |
|| ; CODE XREF from fcn.00000000 @ 0xc(x) |
|| jmp 4 |
|`----------------------------------------'
| v
| |
| |
|.-------------------------------------.
|| 0x4 |
|| ; CODE XREF from fcn.00000000 @ 0x5 |
|| shr ebx, 0xfd |
|| ; ',' |
|| mov ebx, 0x2c |
|| jmp 5 |
|`-------------------------------------'
|.----------------------------------------.
|| 0x4 |
|| ; CODE XREF from fcn.00000000 @ 0x5(x) |
|| shr ebx, 0xfd |
|| ; ',' |
|| mov ebx, 0x2c |
|| jmp 5 |
|`----------------------------------------'
| v
| |
`----'
/ 17: fcn.00000000 ();
| 0x00000000 ~ b8210000c1 mov eax, 0xc1000021 ; '!'
| ; CODE XREF from fcn.00000000 @ 0x5
| ; CODE XREF from fcn.00000000 @ 0x5(x)
| .-> 0x00000004 ~ c1ebfd shr ebx, 0xfd
| | ; CODE XREF from fcn.00000000 @ 0xc
| | ; CODE XREF from fcn.00000000 @ 0xc(x)
| .`=< 0x00000005 ebfd jmp 4
| : 0x00000007 bb2c000000 mov ebx, 0x2c ; ','
\ `==< 0x0000000c ebf7 jmp 5
@ -3104,7 +3104,7 @@ diff: type: new
/ 17: fcn.00000000 ();
| 0x00000000 b8210000c1 mov eax, 0xc1000021 ; '!'
| | ; CODE XREF from fcn.00000000 @ 0xc
| | ; CODE XREF from fcn.00000000 @ 0xc(x)
| .`=< 0x00000005 ebfd jmp 4
| : 0x00000007 bb2c000000 mov ebx, 0x2c ; ','
\ `==< 0x0000000c ebf7 jmp 5
@ -3148,66 +3148,65 @@ diff: type: new
/ 24: fcn.00000000 ();
| 0x00000000 0f1f440000 nop dword [rax + rax]
| // true: 0x00000005
| ; CODE XREF from fcn.00000000 @ 0x11
| ; CODE XREF from fcn.00000000 @ 0x11(x)
| 0x00000003 0000 add byte [rax], al
| // true: 0x00000005
| 0x00000005 b8210000c1 mov eax, 0xc1000021 ; '!'
| 0x0000000a ebfd jmp 9
| // true: 0x00000009
| ; CODE XREF from fcn.00000000 @ 0xa
| ; CODE XREF from fcn.00000000 @ 0xa(x)
| 0x00000009 c1ebfd shr ebx, 0xfd
| 0x0000000c bb2c000000 mov ebx, 0x2c ; ','
\ 0x00000011 ebf0 jmp 3
| // true: 0x00000003
[0x00000000]> # fcn.00000000 ();
.--------------------------.
| 0x0 |
| 24: fcn.00000000 (); |
| nop dword [rax + rax] |
`--------------------------'
v
|
'--.
.---------------.
| | |
| .------------------------.
| | 0x5 |
| | ; '!' |
| | mov eax, 0xc1000021 |
| | jmp 9 |
| `------------------------'
| v
| |
| .-----'
| |
| .-------------------------------------.
| | 0x9 |
| | ; CODE XREF from fcn.00000000 @ 0xa |
| | shr ebx, 0xfd |
| | ; ',' |
| | mov ebx, 0x2c |
| | jmp 3 |
| `-------------------------------------'
| v
| |
| .'
.--------------------------.
| 0x0 |
| 24: fcn.00000000 (); |
| nop dword [rax + rax] |
`--------------------------'
v
|
'--.
.----------------.
| | |
| .------------------------.
| | 0x5 |
| | ; '!' |
| | mov eax, 0xc1000021 |
| | jmp 9 |
| `------------------------'
| v
| |
| .-------'
| |
|.--------------------------------------.
|| 0x3 |
|| ; CODE XREF from fcn.00000000 @ 0x11 |
|| add byte [rax], al |
|`--------------------------------------'
|.----------------------------------------.
|| 0x9 |
|| ; CODE XREF from fcn.00000000 @ 0xa(x) |
|| shr ebx, 0xfd |
|| ; ',' |
|| mov ebx, 0x2c |
|| jmp 3 |
|`----------------------------------------'
| v
| |
| |
|.-----------------------------------------.
|| 0x3 |
|| ; CODE XREF from fcn.00000000 @ 0x11(x) |
|| add byte [rax], al |
|`-----------------------------------------'
| v
| |
`----'
/ 24: fcn.00000000 ();
| 0x00000000 ~ 0f1f440000 nop dword [rax + rax]
| ; CODE XREF from fcn.00000000 @ 0x11
| ; CODE XREF from fcn.00000000 @ 0x11(x)
| .-> 0x00000003 0000 add byte [rax], al
| : 0x00000005 ~ b8210000c1 mov eax, 0xc1000021 ; '!'
| : ; CODE XREF from fcn.00000000 @ 0xa
| : ; CODE XREF from fcn.00000000 @ 0xa(x)
| .--> 0x00000009 c1ebfd shr ebx, 0xfd
| : 0x0000000c bb2c000000 mov ebx, 0x2c ; ','
\ `=< 0x00000011 ebf0 jmp 3
@ -3507,16 +3506,16 @@ EXPECT=<<EOF
0x00000870 => immbase=10
0x00000874 => immbase=10
0x00000878 => immbase=10
c 0x59f case.0x59d.13
c 0x5b2 case.0x59d.1
c 0x5c0 case.0x59d.2
c 0x5ce case.0x59d.5
c 0x5dc case.0x59d.6
c 0x5ea case.0x59d.7
c 0x5f8 case.0x59d.9
c 0x606 case.0x59d.11
c 0x614 case.0x59d.12
c 0x622 case.0x59d.0
CODE 0x59f case.0x59d.13
CODE 0x5b2 case.0x59d.1
CODE 0x5c0 case.0x59d.2
CODE 0x5ce case.0x59d.5
CODE 0x5dc case.0x59d.6
CODE 0x5ea case.0x59d.7
CODE 0x5f8 case.0x59d.9
CODE 0x606 case.0x59d.11
CODE 0x614 case.0x59d.12
CODE 0x622 case.0x59d.0
0x00000580 0x0000058d 00:0000 13 j 0x00000622 f 0x0000058d
0x0000058d 0x0000059f 00:0000 18 s 0x00000622 s 0x000005b2 s 0x000005c0 s 0x000005ce s 0x000005dc s 0x000005ea s 0x000005f8 s 0x00000606 s 0x00000614 s 0x0000059f
0x0000059f 0x000005ab 00:0000 12 j 0x000005ab
@ -4083,7 +4082,7 @@ agf
afll
EOF
EXPECT=<<EOF
| ; CODE XREF from fcn.00000003 @ 0x5
| ; CODE XREF from fcn.00000003 @ 0x5(x)
| ;-- (0x00000003) fcn.00000003:
| 0x00000000 ~ b821c10010 mov eax, 0x1000c121
| // true: 0x00000005
@ -4096,24 +4095,24 @@ EXPECT=<<EOF
[0x00000003]> # fcn.00000003 ();
----.
| |
|.-------------------------------------. .-----------------------.
|| 0x0 | | 0x3 |
|| ; CODE XREF from fcn.00000003 @ 0x5 | | 9: fcn.00000003 (); |
|| ;-- (0x00000003) fcn.00000003: | | add byte [rax], dl |
|| mov eax, 0x1000c121 | `-----------------------'
|`-------------------------------------' v
| v |
| | |
| '----------------------------. |
| .--------------'
| | |
| .--------------------.
| | 0x5 |
| | jmp 0 |
| `--------------------'
| v
| |
`-----------------------------'
|.----------------------------------------. .-----------------------.
|| 0x0 | | 0x3 |
|| ; CODE XREF from fcn.00000003 @ 0x5(x) | | 9: fcn.00000003 (); |
|| ;-- (0x00000003) fcn.00000003: | | add byte [rax], dl |
|| mov eax, 0x1000c121 | `-----------------------'
|`----------------------------------------' v
| v |
| | |
| '-------------------------------. |
| .---------------'
| | |
| .--------------------.
| | 0x5 |
| | jmp 0 |
| `--------------------'
| v
| |
`--------------------------------'
address size nbbs edges cc cost min bound range max bound calls locals args xref frame name
================== ==== ===== ===== ===== ==== ================== ===== ================== ===== ====== ==== ==== ===== ====

View File

@ -33,47 +33,47 @@ af
axf@0x100001308
EOF
EXPECT=<<EOF
c 0x1000012dc case.0x100001308.50
c 0x10000130a case.0x100001308.49
c 0x100001321 case.0x100001308.114
c 0x10000132a case.0x100001308.120
c 0x100001347 case.0x100001308.118
c 0x100001353 case.0x100001308.99
c 0x100001370 case.0x100001308.102
c 0x100001392 case.0x100001308.97
c 0x100001396 case.0x100001308.65
c 0x1000013a2 case.0x100001308.84
c 0x1000013b1 case.0x100001308.107
c 0x1000013bd case.0x100001308.115
c 0x1000013cc case.0x100001308.76
c 0x1000013fb case.0x100001308.104
c 0x10000140a case.0x100001308.80
c 0x10000141a case.0x100001308.110
c 0x10000143f case.0x100001308.108
c 0x10000144b case.0x100001308.103
c 0x100001473 case.0x100001308.83
c 0x10000147f case.0x100001308.100
c 0x100001492 case.0x100001308.111
c 0x1000014d0 case.0x100001308.79
c 0x1000014df case.0x100001308.113
c 0x1000014f0 case.0x100001308.64
c 0x1000014ff case.0x100001308.67
c 0x100001519 case.0x100001308.82
c 0x100001525 case.0x100001308.70
c 0x10000153e case.0x100001308.66
c 0x10000155b case.0x100001308.105
c 0x10000156a case.0x100001308.119
c 0x100001583 case.0x100001308.85
c 0x1000015a0 case.0x100001308.87
c 0x1000015ac case.0x100001308.71
c 0x1000015c9 case.0x100001308.72
c 0x1000015f7 case.0x100001308.112
c 0x10000160d case.0x100001308.98
c 0x10000162a case.0x100001308.116
c 0x100001636 case.0x100001308.101
c 0x100001645 case.0x100001308.109
c 0x100001665 case.0x100001308.117
c 0x100001682 case.default.0x100001308
CODE 0x1000012dc case.0x100001308.50
CODE 0x10000130a case.0x100001308.49
CODE 0x100001321 case.0x100001308.114
CODE 0x10000132a case.0x100001308.120
CODE 0x100001347 case.0x100001308.118
CODE 0x100001353 case.0x100001308.99
CODE 0x100001370 case.0x100001308.102
CODE 0x100001392 case.0x100001308.97
CODE 0x100001396 case.0x100001308.65
CODE 0x1000013a2 case.0x100001308.84
CODE 0x1000013b1 case.0x100001308.107
CODE 0x1000013bd case.0x100001308.115
CODE 0x1000013cc case.0x100001308.76
CODE 0x1000013fb case.0x100001308.104
CODE 0x10000140a case.0x100001308.80
CODE 0x10000141a case.0x100001308.110
CODE 0x10000143f case.0x100001308.108
CODE 0x10000144b case.0x100001308.103
CODE 0x100001473 case.0x100001308.83
CODE 0x10000147f case.0x100001308.100
CODE 0x100001492 case.0x100001308.111
CODE 0x1000014d0 case.0x100001308.79
CODE 0x1000014df case.0x100001308.113
CODE 0x1000014f0 case.0x100001308.64
CODE 0x1000014ff case.0x100001308.67
CODE 0x100001519 case.0x100001308.82
CODE 0x100001525 case.0x100001308.70
CODE 0x10000153e case.0x100001308.66
CODE 0x10000155b case.0x100001308.105
CODE 0x10000156a case.0x100001308.119
CODE 0x100001583 case.0x100001308.85
CODE 0x1000015a0 case.0x100001308.87
CODE 0x1000015ac case.0x100001308.71
CODE 0x1000015c9 case.0x100001308.72
CODE 0x1000015f7 case.0x100001308.112
CODE 0x10000160d case.0x100001308.98
CODE 0x10000162a case.0x100001308.116
CODE 0x100001636 case.0x100001308.101
CODE 0x100001645 case.0x100001308.109
CODE 0x100001665 case.0x100001308.117
CODE 0x100001682 case.default.0x100001308
EOF
RUN

View File

@ -7,7 +7,7 @@ sf loc.0000f190
agfj~reloc.free
EOF
EXPECT=<<EOF
[{"name":"loc.0000f190","offset":61840,"ninstr":7,"nargs":0,"nlocals":0,"size":23,"stack":8,"type":"loc","blocks":[{"offset":61840,"size":23,"ops":[{"offset":61840,"esil":"rbx,8,rsp,-,=[8],8,rsp,-=","refptr":false,"fcn_addr":61840,"fcn_last":61862,"size":1,"opcode":"push rbx","disasm":"push rbx","bytes":"53","family":"cpu","type":"rpush","reloc":false,"type_num":268435468,"type2_num":0,"flags":["loc.0000f190"],"xrefs":[{"addr":53124,"type":"DATA"},{"addr":54437,"type":"CODE"}]},{"offset":61841,"esil":"rdi,rbx,=","refptr":false,"fcn_addr":61840,"fcn_last":61860,"size":3,"opcode":"mov rbx, rdi","disasm":"mov rbx, rdi","bytes":"4889fb","family":"cpu","type":"mov","reloc":false,"type_num":9,"type2_num":0},{"offset":61844,"esil":"rdi,[8],rdi,=","refptr":true,"fcn_addr":61840,"fcn_last":61860,"size":3,"opcode":"mov rdi, qword [rdi]","disasm":"mov rdi, qword [rdi]","bytes":"488b3f","family":"cpu","type":"mov","reloc":false,"type_num":9,"type2_num":0},{"offset":61847,"ptr":138400,"esil":"0x12b03,rip,+,[8],rip,8,rsp,-=,rsp,=[8],rip,=","refptr":true,"fcn_addr":61840,"fcn_last":61857,"size":6,"opcode":"call qword [rip + 0x12b03]","disasm":"call qword [reloc.free]","bytes":"ff15032b0100","family":"cpu","type":"ircall","reloc":false,"type_num":402653188,"type2_num":0,"refs":[{"addr":138400,"type":"CALL"}]},{"offset":61853,"esil":"rbx,rdi,=","refptr":false,"fcn_addr":61840,"fcn_last":61860,"size":3,"opcode":"mov rdi, rbx","disasm":"mov rdi, rbx","bytes":"4889df","family":"cpu","type":"mov","reloc":false,"type_num":9,"type2_num":0},{"offset":61856,"esil":"rsp,[8],rbx,=,8,rsp,+=","refptr":false,"fcn_addr":61840,"fcn_last":61862,"size":1,"opcode":"pop rbx","disasm":"pop rbx","bytes":"5b","family":"cpu","type":"pop","reloc":false,"type_num":14,"type2_num":0},{"offset":61857,"ptr":138400,"esil":"0x12af9,rip,+,[8],rip,=","refptr":true,"fcn_addr":61840,"fcn_last":61857,"size":6,"opcode":"jmp qword [rip + 0x12af9]","disasm":"jmp qword [reloc.free]","bytes":"ff25f92a0100","family":"cpu","type":"irjmp","reloc":false,"type_num":402653186,"type2_num":0,"refs":[{"addr":138400,"type":"DATA"}]}]}]}]
[{"name":"loc.0000f190","offset":61840,"ninstr":7,"nargs":0,"nlocals":0,"size":23,"stack":8,"type":"loc","blocks":[{"offset":61840,"size":23,"ops":[{"offset":61840,"esil":"rbx,8,rsp,-,=[8],8,rsp,-=","refptr":false,"fcn_addr":61840,"fcn_last":61862,"size":1,"opcode":"push rbx","disasm":"push rbx","bytes":"53","family":"cpu","type":"rpush","reloc":false,"type_num":268435468,"type2_num":0,"flags":["loc.0000f190"],"xrefs":[{"addr":53124,"type":"DATA","perm":"r--"},{"addr":54437,"type":"CODE","perm":"--x"}]},{"offset":61841,"esil":"rdi,rbx,=","refptr":false,"fcn_addr":61840,"fcn_last":61860,"size":3,"opcode":"mov rbx, rdi","disasm":"mov rbx, rdi","bytes":"4889fb","family":"cpu","type":"mov","reloc":false,"type_num":9,"type2_num":0},{"offset":61844,"esil":"rdi,[8],rdi,=","refptr":true,"fcn_addr":61840,"fcn_last":61860,"size":3,"opcode":"mov rdi, qword [rdi]","disasm":"mov rdi, qword [rdi]","bytes":"488b3f","family":"cpu","type":"mov","reloc":false,"type_num":9,"type2_num":0},{"offset":61847,"ptr":138400,"esil":"0x12b03,rip,+,[8],rip,8,rsp,-=,rsp,=[8],rip,=","refptr":true,"fcn_addr":61840,"fcn_last":61857,"size":6,"opcode":"call qword [rip + 0x12b03]","disasm":"call qword [reloc.free]","bytes":"ff15032b0100","family":"cpu","type":"ircall","reloc":false,"type_num":402653188,"type2_num":0,"refs":[{"addr":138400,"type":"CALL","perm":"--x"}]},{"offset":61853,"esil":"rbx,rdi,=","refptr":false,"fcn_addr":61840,"fcn_last":61860,"size":3,"opcode":"mov rdi, rbx","disasm":"mov rdi, rbx","bytes":"4889df","family":"cpu","type":"mov","reloc":false,"type_num":9,"type2_num":0},{"offset":61856,"esil":"rsp,[8],rbx,=,8,rsp,+=","refptr":false,"fcn_addr":61840,"fcn_last":61862,"size":1,"opcode":"pop rbx","disasm":"pop rbx","bytes":"5b","family":"cpu","type":"pop","reloc":false,"type_num":14,"type2_num":0},{"offset":61857,"ptr":138400,"esil":"0x12af9,rip,+,[8],rip,=","refptr":true,"fcn_addr":61840,"fcn_last":61857,"size":6,"opcode":"jmp qword [rip + 0x12af9]","disasm":"jmp qword [reloc.free]","bytes":"ff25f92a0100","family":"cpu","type":"irjmp","reloc":false,"type_num":402653186,"type2_num":0,"refs":[{"addr":138400,"type":"DATA","perm":"--x"}]}]}]}]
EOF
RUN

View File

@ -7,11 +7,12 @@ ax~0x804969c
axtj~{}
EOF
EXPECT=<<EOF
section..plt+6 0x80482c6 -> CODE -> 0x804969c section..got.plt+8
section..plt+6 0x80482c6 > CODE:--x > 0x804969c section..got.plt+8
[
{
"from": 134513350,
"type": "CODE",
"perm": "--x",
"opcode": "jmp dword [0x804969c]",
"name": "section..plt+6",
"refname": "section..got.plt+8"
@ -20,7 +21,7 @@ EXPECT=<<EOF
EOF
RUN
NAME=axf
NAME=axf C44
FILE=-
CMDS=<<EOF
e asm.arch=x86
@ -33,9 +34,9 @@ f someflag @ 0x43
axf
EOF
EXPECT=<<EOF
0x42 add byte [rax], al
0x43 someflag
C 0x44 add byte [rax], al
NULL 0x42 add byte [rax], al
NULL 0x43 someflag
CALL 0x44 add byte [rax], al
EOF
RUN
@ -63,4 +64,4 @@ EOF
EXPECT=<<EOF
0x600ff8
EOF
RUN
RUN

View File

@ -1286,7 +1286,7 @@ pdJ 1 @ 0x00400506
EOF
EXPECT=<<EOF
[{"offset":4195590,"text":" ;-- main:"},{"offset":4195590,"text":" 0x00400506 55 push rbp"}]
[{"offset":4195590,"text":" ; DATA XREF from entry0 @ 0x40042d"},{"offset":4195590,"text":"/ 16: int main (int argc, char **argv, char **envp);"},{"offset":4195590,"text":"| 0x00400506 55 push rbp"}]
[{"offset":4195590,"text":" ; DATA XREF from entry0 @ 0x40042d(r)"},{"offset":4195590,"text":"/ 16: int main (int argc, char **argv, char **envp);"},{"offset":4195590,"text":"| 0x00400506 55 push rbp"}]
EOF
RUN

View File

@ -1,5 +1,6 @@
NAME=Cd4middle
FILE=-
ARGS=-a x86 -b 64
CMDS=<<EOF
wx 01002143547601020304
Cd 4 4 @ 4
@ -15,6 +16,7 @@ RUN
NAME=Cd999
FILE=-
ARGS=-a x86 -b 64
CMDS=<<EOF
Cd 4096
pd 2~?
@ -31,6 +33,7 @@ EOF
RUN
NAME=ipmetacolor
ARGS=-a x86 -b 64
FILE=-
CMDS=<<EOF
wx 01020304 05060708 090a0b0c
@ -50,6 +53,7 @@ EOF
RUN
NAME=ipmetacolor with metatrue
ARGS=-a x86 -b 64
FILE=-
CMDS=<<EOF
wx 01020304 05060708 090a0b0c
@ -69,6 +73,7 @@ EOF
RUN
NAME=Cd999nometa
ARGS=-a x86 -b 64
FILE=-
CMDS=<<EOF
e asm.meta=false
@ -106,6 +111,7 @@ RUN
NAME=bytes for invalid insn (#11434)
FILE=-
ARGS=-a x86 -b 64
CMDS=<<EOF
e asm.arch=x86
e asm.bits=64
@ -296,21 +302,21 @@ EXPECT=<<EOF
| : 0x00560e67 56 push esi
| ,==< 0x00560e68 e904000000 jmp 0x560e71
..
| |: ; CODE XREF from fcn.00560e67 @ 0x560e68
| |: ; CODE XREF from fcn.00560e67 @ 0x560e68(x)
| `--> 0x00560e71 90 nop
| : 0x00560e72 eb09 jmp 0x560e7d
..
| : ; CODE XREF from fcn.00560e67 @ 0x560e72
| : ; CODE XREF from fcn.00560e67 @ 0x560e72(x)
| : 0x00560e7d 5e pop esi
| : 0x00560e7e 50 push eax
| : 0x00560e7f 52 push edx
| ,==< 0x00560e80 e911000000 jmp 0x560e96
..
| ||: ; CODE XREF from fcn.00560e67 @ 0x560e80
| ||: ; CODE XREF from fcn.00560e67 @ 0x560e80(x)
| |`--> 0x00560e96 0f31 rdtsc
| | : 0x00560e98 e914000000 jmp 0x560eb1
..
| ||: ; CODE XREF from fcn.00560e67 @ 0x560e98
| ||: ; CODE XREF from fcn.00560e67 @ 0x560e98(x)
| ||: 0x00560eb1 5a pop edx
\ ||`=< 0x00560eb2 e940c5edff jmp 0x43d3f7
@ -318,21 +324,21 @@ EXPECT=<<EOF
| 0x00560e67 56 push esi
| 0x00560e68 e904000000 jmp 0x560e71
| // true: 0x00560e71
| ; CODE XREF from fcn.00560e67 @ 0x560e68
| ; CODE XREF from fcn.00560e67 @ 0x560e68(x)
| 0x00560e71 90 nop
| 0x00560e72 eb09 jmp 0x560e7d
| // true: 0x00560e7d
| ; CODE XREF from fcn.00560e67 @ 0x560e72
| ; CODE XREF from fcn.00560e67 @ 0x560e72(x)
| 0x00560e7d 5e pop esi
| 0x00560e7e 50 push eax
| 0x00560e7f 52 push edx
| 0x00560e80 e911000000 jmp 0x560e96
| // true: 0x00560e96
| ; CODE XREF from fcn.00560e67 @ 0x560e80
| ; CODE XREF from fcn.00560e67 @ 0x560e80(x)
| 0x00560e96 0f31 rdtsc
| 0x00560e98 e914000000 jmp 0x560eb1
| // true: 0x00560eb1
| ; CODE XREF from fcn.00560e67 @ 0x560e98
| ; CODE XREF from fcn.00560e67 @ 0x560e98(x)
| 0x00560eb1 5a pop edx
\ 0x00560eb2 e940c5edff jmp 0x43d3f7
@ -414,6 +420,7 @@ RUN
NAME=aht asm.cmt.right=false fix (#12330)
FILE=-
ARGS=-a x86 -b 64
CMDS=<<EOF
e asm.arch=x86
e asm.bits=64
@ -933,6 +940,7 @@ RUN
NAME=seek with spaces
FILE=-
ARGS=-a x86 -b 64
CMDS=<<EOF
wx 010203040506
p8 1 @ 1 + 3

View File

@ -72,13 +72,13 @@ EXPECT=<<EOF
/ 24: fcn.00000000 ();
| 0x00000000 0f1f440000 nop dword [rax + rax]
| // true: 0x00000005
| ; CODE XREF from fcn.00000000 @ 0x11
| ; CODE XREF from fcn.00000000 @ 0x11(x)
| 0x00000003 0000 add byte [rax], al
| // true: 0x00000005
| 0x00000005 b8210000c1 mov eax, 0xc1000021 ; '!'
| 0x0000000a ebfd jmp 9
| // true: 0x00000009
| ; CODE XREF from fcn.00000000 @ 0xa
| ; CODE XREF from fcn.00000000 @ 0xa(x)
| 0x00000009 c1ebfd shr ebx, 0xfd
| 0x0000000c bb2c000000 mov ebx, 0x2c ; ','
\ 0x00000011 ebf0 jmp 3
@ -122,7 +122,8 @@ EXPECT=<<EOF
"xrefs": [
{
"addr": 17,
"type": "CODE"
"type": "CODE",
"perm": "--x"
}
]
},
@ -163,7 +164,8 @@ EXPECT=<<EOF
"refs": [
{
"addr": 9,
"type": "CODE"
"type": "CODE",
"perm": "--x"
}
]
},
@ -186,7 +188,8 @@ EXPECT=<<EOF
"xrefs": [
{
"addr": 10,
"type": "CODE"
"type": "CODE",
"perm": "--x"
}
]
},
@ -210,7 +213,8 @@ EXPECT=<<EOF
"refs": [
{
"addr": 44,
"type": "DATA"
"type": "DATA",
"perm": "r--"
}
]
},
@ -233,7 +237,8 @@ EXPECT=<<EOF
"refs": [
{
"addr": 3,
"type": "CODE"
"type": "CODE",
"perm": "--x"
}
]
}
@ -285,7 +290,8 @@ jmp 3
"xrefs": [
{
"addr": 17,
"type": "CODE"
"type": "CODE",
"perm": "--x"
}
]
},
@ -326,7 +332,8 @@ jmp 3
"refs": [
{
"addr": 9,
"type": "CODE"
"type": "CODE",
"perm": "--x"
}
]
},
@ -349,7 +356,8 @@ jmp 3
"xrefs": [
{
"addr": 10,
"type": "CODE"
"type": "CODE",
"perm": "--x"
}
]
},
@ -373,7 +381,8 @@ jmp 3
"refs": [
{
"addr": 44,
"type": "DATA"
"type": "DATA",
"perm": "r--"
}
]
},
@ -396,7 +405,8 @@ jmp 3
"refs": [
{
"addr": 3,
"type": "CODE"
"type": "CODE",
"perm": "--x"
}
]
}
@ -411,7 +421,7 @@ aa
pdr @ entry.init0
EOF
EXPECT=<<EOF
| ; CODE XREF from entry.init0 @ 0x5bd4
| ; CODE XREF from entry.init0 @ 0x5bd4(x)
| 0x00005b40 488d3d21c701. lea rdi, loc._edata ; loc.__bss_start
| ; 0x22268
| 0x00005b47 488d351ac701. lea rsi, loc._edata ; loc.__bss_start

View File

@ -111,8 +111,8 @@ Ps xrefs > /dev/null
axq
EOF
EXPECT=<<EOF
0x00000000 -> 0x00000001 UNKNOWN
0x00000000 -> 0x00000001 UNKNOWN
0x00000000 -> 0x00000001 NULL:r--
0x00000000 -> 0x00000001 NULL:r--
EOF
RUN
@ -608,7 +608,7 @@ Po dream > /dev/null
axq
EOF
EXPECT=<<EOF
0x00000003 -> 0x00000009 CALL
0x00000003 -> 0x00000009 CALL:--x
EOF
RUN

View File

@ -402,7 +402,7 @@ EXPECT=<<EOF
\ 0x00005b08 ff150ac30100 call qword [reloc.__libc_start_main] ; [0x21e18:8]=0
0x00005b0e f4 hlt
0x00005b0f 90 nop
; CALL XREF from entry.fini0 @ 0x5ba8
; CALL XREF from entry.fini0 @ 0x5ba8(x)
/ 34: fcn.00005b0e ();
| 0x00005b10 488d3d51c701. lea rdi, loc._edata ; loc.__bss_start
|  ; 0x22268

View File

@ -390,19 +390,19 @@ EXPECT=<<EOF
--- From 0x560e97 ---
-- 1 --
| ; CODE XREF from fcn.00560e67 @ 0x560e80
| ; CODE XREF from fcn.00560e67 @ 0x560e80(x)
| 0x00560e96 0f31 rdtsc
0x560e96
| ; CODE XREF from fcn.00560e67 @ 0x560e80
| ; CODE XREF from fcn.00560e67 @ 0x560e80(x)
| 0x00560e96 0f31 rdtsc
-- 2 --
0x00560e95 ~ ba0f31e914 mov edx, 0x14e9310f
| ; CODE XREF from fcn.00560e67 @ 0x560e80
| ; CODE XREF from fcn.00560e67 @ 0x560e80(x)
| 0x00560e96 0f31 rdtsc
0x560e95
0x00560e95 ~ ba0f31e914 mov edx, 0x14e9310f
| ; CODE XREF from fcn.00560e67 @ 0x560e80
| ; CODE XREF from fcn.00560e67 @ 0x560e80(x)
| 0x00560e96 0f31 rdtsc
--- From 0x560e96 ---

View File

@ -409,7 +409,7 @@ aa
axt 0x400536
EOF
EXPECT=<<EOF
main 0x40056f [CALL] call sym.print
main 0x40056f [CALL:--x] call sym.print
EOF
RUN

View File

@ -7,7 +7,7 @@ aa
pd 1 @main
EOF
EXPECT=<<EOF
; DATA XREF from entry0 @ 0x40045d
; DATA XREF from entry0 @ 0x40045d(r)
/ 44: int main (int argc, char **argv, char **envp);
| ; var int64_t var_4h @ rbp-0x4
| 0x0040052d 55 push rbp ; dwarftest.c:4
@ -35,7 +35,7 @@ pd 13 @ main
EOF
EXPECT=<<EOF
;-- main:
; DATA XREF from entry0 @ 0x10c1
; DATA XREF from entry0 @ 0x10c1(r)
/ 139: int dbg.main (int argc, char **argv, char **envp);
| ; var Mammal *m @ rbp-0x18
| ; var Bird *b @ rbp-0x20
@ -66,7 +66,7 @@ pd 75 @ dbg.main
EOF
EXPECT=<<EOF
;-- rust::main::h523dcf5432fcfd88:
; DATA XREF from main @ 0x5b0d
; DATA XREF from main @ 0x5b0d(r)
/ 940: int dbg.main (int argc, char **argv);
| ; var int64_t var_8h @ rsp+0x8
| ; var int64_t var_10h @ rsp+0x10
@ -212,7 +212,7 @@ EOF
EXPECT=<<EOF
;-- rust::bubble_sort::h0777bc845caabc60:
;-- dbg.bubble_sort_i32_:
; CALL XREF from rust::main::h523dcf5432fcfd88 @ 0x5875 ; dbg.main
; CALL XREF from rust::main::h523dcf5432fcfd88 @ 0x5875(x) ; dbg.main
/ 614: dbg.bubble_sort<i32> (int64_t arg1, int64_t arg2);
| ; arg int64_t arg1 @ rdi
| ; arg int64_t arg2 @ rsi
@ -243,16 +243,16 @@ EXPECT=<<EOF
| 0x0000527f 4889b4249800. mov qword [var_98h], rsi ; arg2
| 0x00005287 48897c2448 mov qword [var_48h], rdi ; arg1
| 0x0000528c 4889742440 mov qword [var_40h], rsi ; arg2
| ; DATA XREF from core::fmt::builders::DebugTuple::finish::hfbbe40c195c334d6 @ 0x28b56
| ; DATA XREF from core::fmt::builders::DebugTuple::finish::hfbbe40c195c334d6 @ 0x28b56(r)
| 0x00005291 e8ea090000 call sym core::slice::_<impl [T]>::len::hbaf7153778228b73 ; dbg.len<i32>
| 0x00005296 4889442450 mov qword [n], rax
| 0x0000529b c644245f01 mov byte [swapped], 1
| ; CODE XREF from rust::bubble_sort::h0777bc845caabc60 @ 0x5441
| ; CODE XREF from rust::bubble_sort::h0777bc845caabc60 @ 0x5441(x)
| 0x000052a0 f644245f01 test byte [swapped], 1
| ,=< 0x000052a5 7508 jne 0x52af
| | 0x000052a7 4881c4b80000. add rsp, 0xb8
| | 0x000052ae c3 ret
| | ; CODE XREF from rust::bubble_sort::h0777bc845caabc60 @ 0x52a5
| | ; CODE XREF from rust::bubble_sort::h0777bc845caabc60 @ 0x52a5(x)
| `-> 0x000052af c644245f00 mov byte [swapped], 0
| 0x000052b4 488b442450 mov rax, qword [n]
| 0x000052b9 48c744246001. mov qword [var_60h], 1
@ -266,7 +266,7 @@ EXPECT=<<EOF
| 0x000052e5 4889442470 mov qword [iter], rax
| 0x000052ea 488b4c2430 mov rcx, qword [var_30h]
| 0x000052ef 48894c2478 mov qword [var_78h], rcx
| ; CODE XREF from rust::bubble_sort::h0777bc845caabc60 @ 0x5432
| ; CODE XREF from rust::bubble_sort::h0777bc845caabc60 @ 0x5432(x)
| 0x000052f4 488d7c2470 lea rdi, [iter] ; int64_t arg1
| 0x000052f9 e812130000 call sym core::iter::range::_<impl core::iter::traits::iterator::Iterator for core::ops::range::Range<A>>::next::h707e8283b20ce50a ; dbg.next<usize>
| 0x000052fe 488994248800. mov qword [var_88h], rdx
@ -275,9 +275,9 @@ EXPECT=<<EOF
| 0x00005316 4885c0 test rax, rax
| ,=< 0x00005319 7404 je 0x531f
| ,==< 0x0000531b eb00 jmp 0x531d
| || ; CODE XREF from rust::bubble_sort::h0777bc845caabc60 @ 0x531b
| || ; CODE XREF from rust::bubble_sort::h0777bc845caabc60 @ 0x531b(x)
| ,`--> 0x0000531d eb23 jmp 0x5342
| | | ; CODE XREF from rust::bubble_sort::h0777bc845caabc60 @ 0x5319
| | | ; CODE XREF from rust::bubble_sort::h0777bc845caabc60 @ 0x5319(x)
| | `-> 0x0000531f 488b442450 mov rax, qword [n]
| | 0x00005324 482d01000000 sub rax, 1
| | 0x0000532a 0f92c1 setb cl
@ -297,17 +297,17 @@ EOF
EXPECT=<<EOF
;-- method.Grid.init__:
;-- Grid::init():
; CALL XREF from dbg.main @ 0x10001ae8
; CALL XREF from dbg.main @ 0x10001ae8(x)
/ 64: dbg.init (Grid * const this);
| ; arg Grid * const this @ r3
| 0x100012bc 39030144 addi r8, r3, 0x144 ; arg1 ; void init(Grid * const this);
| 0x100012c0 38e30168 addi r7, r3, 0x168 ; arg1
| 0x100012c4 39400000 li r10, 0
| ; CODE XREF from Grid::init() @ 0x100012e8
| ; CODE XREF from Grid::init() @ 0x100012e8(x)
| .-> 0x100012c8 3928febc addi r9, r8, -0x144
| : 0x100012cc 38c00009 li r6, 9
| : 0x100012d0 7cc903a6 mtctr r6
| : ; CODE XREF from Grid::init() @ 0x100012dc
| : ; CODE XREF from Grid::init() @ 0x100012dc(x)
| .--> 0x100012d4 91490000 stw r10, 0(r9)
| :: 0x100012d8 39290024 addi r9, r9, 0x24
| `==< 0x100012dc 4200fff8 bdnz 0x100012d4
@ -330,7 +330,7 @@ pdf @ dbg.main
EOF
EXPECT=<<EOF
;-- main:
; DATA XREF from entry0 @ 0x2271
; DATA XREF from entry0 @ 0x2271(r)
/ 101: int dbg.main (int argc, char **argv, char **envp);
| ; arg int argc @ rdi
| ; arg char **argv @ rsi
@ -376,7 +376,7 @@ pd 20 @ dbg.palya
EOF
EXPECT=<<EOF
;-- P$MOZGKIGYO_$$_PALYA$SMALLINT$SMALLINT:
; CALL XREFS from main @ +0x1a87, +0x1c7d, +0x23f3, +0x3679
; CALL XREFS from main @ +0x1a87(x), +0x1c7d(x), +0x23f3(x), +0x3679(x)
/ 439: dbg.palya ();
| ; var SmallInt mag @ rbp-0x8
| ; var SmallInt szel @ rbp-0x10
@ -401,7 +401,7 @@ EXPECT=<<EOF
| | 0x004019bc 66816dec0100 sub word [i], 1
| | 0x004019c2 66666690 nop
| | 0x004019c6 6690 nop
| | ; CODE XREF from dbg.palya @ 0x4019ff
| | ; CODE XREF from dbg.palya @ 0x4019ff(x)
| | 0x004019c8 668145ec0100 add word [i], 1
| | 0x004019ce e82d280200 call sym.fpc_get_output
EOF

View File

@ -150,7 +150,8 @@ EXPECT=<<EOF
"xrefs": [
{
"addr": 17,
"type": "CODE"
"type": "CODE",
"perm": "--x"
}
]
},
@ -191,7 +192,8 @@ EXPECT=<<EOF
"xrefs": [
{
"addr": 10,
"type": "CODE"
"type": "CODE",
"perm": "--x"
}
]
},
@ -215,7 +217,8 @@ EXPECT=<<EOF
"refs": [
{
"addr": 44,
"type": "DATA"
"type": "DATA",
"perm": "r--"
}
]
},
@ -238,7 +241,8 @@ EXPECT=<<EOF
"refs": [
{
"addr": 3,
"type": "CODE"
"type": "CODE",
"perm": "--x"
}
]
}
@ -303,7 +307,8 @@ EXPECT=<<EOF
"refs": [
{
"addr": 9,
"type": "CODE"
"type": "CODE",
"perm": "--x"
}
]
},
@ -327,7 +332,8 @@ EXPECT=<<EOF
"refs": [
{
"addr": 44,
"type": "DATA"
"type": "DATA",
"perm": "r--"
}
]
},
@ -350,7 +356,8 @@ EXPECT=<<EOF
"refs": [
{
"addr": 3,
"type": "CODE"
"type": "CODE",
"perm": "--x"
}
]
}
@ -400,7 +407,8 @@ EXPECT=<<EOF
"xrefs": [
{
"addr": 17,
"type": "CODE"
"type": "CODE",
"perm": "--x"
}
]
},
@ -441,7 +449,8 @@ EXPECT=<<EOF
"refs": [
{
"addr": 9,
"type": "CODE"
"type": "CODE",
"perm": "--x"
}
]
},
@ -464,7 +473,8 @@ EXPECT=<<EOF
"xrefs": [
{
"addr": 10,
"type": "CODE"
"type": "CODE",
"perm": "--x"
}
]
},
@ -488,7 +498,8 @@ EXPECT=<<EOF
"refs": [
{
"addr": 44,
"type": "DATA"
"type": "DATA",
"perm": "r--"
}
]
},
@ -511,7 +522,8 @@ EXPECT=<<EOF
"refs": [
{
"addr": 3,
"type": "CODE"
"type": "CODE",
"perm": "--x"
}
]
}

View File

@ -92,7 +92,7 @@ s main
pdf
EOF
EXPECT=<<EOF
; DATA XREF from entry0 @ 0x40048d
; DATA XREF from entry0 @ 0x40048d(r)
/ 41: int main (int argc, char **argv, char **envp);
| ; var int64_t var_4h @ rbp-0x4
| 0x00400566 55 push rbp

View File

@ -4,15 +4,17 @@ CMDS=<<EOF
s sym.main
af
afx
?e --
pifc
EOF
EXPECT=<<EOF
c 0x00005124 -> 0x00005128 jump 0x5128
c 0x00005134 -> 0x00005138 jump 0x5138
C 0x00005138 -> 0x000050e0 call sym.pHello
C 0x0000513c -> 0x000050f8 call sym.pWorld
c 0x00005140 -> 0x00005144 jump 0x5144
c 0x00005150 -> 0x00005128 jump 0x5128
code 0x00005124 -> 0x00005128 jump 0x5128
code 0x00005134 -> 0x00005138 jump 0x5138
call 0x00005138 -> 0x000050e0 call sym.pHello
call 0x0000513c -> 0x000050f8 call sym.pWorld
code 0x00005140 -> 0x00005144 jump 0x5144
code 0x00005150 -> 0x00005128 jump 0x5128
--
call sym.pHello
call sym.pWorld
EOF

View File

@ -137,11 +137,11 @@ pd 1 @ sym.imp._TIFFFindField
EOF
EXPECT=<<EOF
| 0x00008dbd e80e000000 call sym._TIFFVGetField ; RELOC 32 _TIFFVGetField @ 0x00008dd0
sym._TIFFGetField 0x8dbd [CALL] call sym._TIFFVGetField
sym._TIFFGetField 0x8dbd [CALL:--x] call sym._TIFFVGetField
| 0x00008dde e8ad280000 call _TIFFFindField
;-- reloc._TIFFFindField:
;-- _TIFFFindField:
; CALL XREF from sym._TIFFVGetField @ 0x8dde
; CALL XREF from sym._TIFFVGetField @ 0x8dde(x)
0x0000b690 .dword 0x00000000 ; RELOC 32 _TIFFFindField
EOF
RUN

View File

@ -505,7 +505,7 @@ s sym.main
pdf
EOF
EXPECT=<<EOF
; CALL XREF from entry0 @ 0x10040
; CALL XREF from entry0 @ 0x10040(x)
/ (fcn) main 160
// int main (int argc, char **argv, char **envp);
| ; var int64_t var_14h @ s0-0x14
@ -520,7 +520,7 @@ EXPECT=<<EOF
| 0x00010164 2326f4fe sw a5, -20(s0)
| 0x00010168 9307f0ff li a5, -1
| 0x0001016c 2324f4fe sw a5, -24(s0)
| ; CODE XREFS from main @ 0x101c8, 0x101d8
| ; CODE XREFS from main @ 0x101c8(x), 0x101d8(x)
| ..-> 0x00010170 b7170200 lui a5, 0x21
| :: 0x00010174 1385874f addi a0, a5, 1272 ; const char *format
| :: 0x00010178 ef00c01f jal ra, dbg.printf
@ -537,7 +537,7 @@ EXPECT=<<EOF
| |:: 0x000101a4 ef00002d jal ra, dbg.puts
| |:: 0x000101a8 93070000 li a5, 0
| ,====< 0x000101ac 6f000003 j 0x101dc
| ||:: ; CODE XREF from main @ 0x10198
| ||:: ; CODE XREF from main @ 0x10198(x)
| |`---> 0x000101b0 032784fe lw a4, -24(s0)
| | :: 0x000101b4 8327c4fe lw a5, -20(s0)
| |,===< 0x000101b8 635af700 ble a5, a4, 0x101cc
@ -545,12 +545,12 @@ EXPECT=<<EOF
| ||:: 0x000101c0 13858752 addi a0, a5, 1320 ; const char *s
| ||:: 0x000101c4 ef00002b jal ra, dbg.puts
| ||`==< 0x000101c8 6ff09ffa j 0x10170
| || : ; CODE XREF from main @ 0x101b8
| || : ; CODE XREF from main @ 0x101b8(x)
| |`---> 0x000101cc b7170200 lui a5, 0x21
| | : 0x000101d0 13858753 addi a0, a5, 1336 ; const char *s
| | : 0x000101d4 ef00002a jal ra, dbg.puts
| | `=< 0x000101d8 6ff09ff9 j 0x10170
| | ; CODE XREF from main @ 0x101ac
| | ; CODE XREF from main @ 0x101ac(x)
| `----> 0x000101dc 13850700 mv a0, a5
| 0x000101e0 83308101 ld ra, 24(sp)
| 0x000101e4 03340101 ld s0, 16(sp)

View File

@ -21,13 +21,13 @@ EXPECT=<<EOF
| 0x00010b5c c25057 subl2 r0, r7
| 0x00010b5f ca0357 bicl2 $0x3, r7
| 0x00010b62 9e47ef539501. movab loc.__CTOR_LIST_END__[r7], r7
| ; CODE XREF from fcn.00010b2e @ 0x10b73
| ; CODE XREF from fcn.00010b2e @ 0x10b73(x)
| .-> 0x00010b6a d08650 movl (r6)+, r0
| : 0x00010b6d fb0060 calls $0x0, (r0)
| : 0x00010b70 d15657 cmpl r6, r7
| `=< 0x00010b73 12f504
| 0x00010b74 f504
| ; CODE XREF from fcn.00010b2e @ 0x10b50
| ; CODE XREF from fcn.00010b2e @ 0x10b50(x)
\ 0x00010b75 04
EOF
RUN

View File

@ -78,13 +78,13 @@ ax~selref
EOF
EXPECT=<<EOF
89
section.0.__TEXT.__text+20 0x100000db4 -> DATA -> 0x100001150 section.14.__DATA.__objc_selrefs
main+15 0x100000e5f -> DATA -> 0x100001158 section.14.__DATA.__objc_selrefs+8
main+45 0x100000e7d -> DATA -> 0x100001160 section.14.__DATA.__objc_selrefs+16
main+64 0x100000e90 -> DATA -> 0x100001168 section.14.__DATA.__objc_selrefs+24
main+86 0x100000ea6 -> DATA -> 0x100001158 section.14.__DATA.__objc_selrefs+8
main+116 0x100000ec4 -> DATA -> 0x100001160 section.14.__DATA.__objc_selrefs+16
main+135 0x100000ed7 -> DATA -> 0x100001168 section.14.__DATA.__objc_selrefs+24
section.0.__TEXT.__text+20 0x100000db4 > DATA:r-- > 0x100001150 section.14.__DATA.__objc_selrefs
main+15 0x100000e5f > DATA:r-- > 0x100001158 section.14.__DATA.__objc_selrefs+8
main+45 0x100000e7d > DATA:r-- > 0x100001160 section.14.__DATA.__objc_selrefs+16
main+64 0x100000e90 > DATA:r-- > 0x100001168 section.14.__DATA.__objc_selrefs+24
main+86 0x100000ea6 > DATA:r-- > 0x100001158 section.14.__DATA.__objc_selrefs+8
main+116 0x100000ec4 > DATA:r-- > 0x100001160 section.14.__DATA.__objc_selrefs+16
main+135 0x100000ed7 > DATA:r-- > 0x100001168 section.14.__DATA.__objc_selrefs+24
EOF
RUN
@ -92,9 +92,9 @@ NAME=aao hello-objc methods references
FILE=bins/mach0/hello-objc
CMDS=aao;ax~method
EXPECT=<<EOF
section.0.__TEXT.__text+20 0x100000db4 -> CODE -> 0x100000df0 method.Person.name
main+45 0x100000e7d -> CODE -> 0x100000e20 method.Person.setName:
main+116 0x100000ec4 -> CODE -> 0x100000e20 method.Person.setName:
section.0.__TEXT.__text+20 0x100000db4 > CODE:--x > 0x100000df0 method.Person.name
main+45 0x100000e7d > CODE:--x > 0x100000e20 method.Person.setName:
main+116 0x100000ec4 > CODE:--x > 0x100000e20 method.Person.setName:
EOF
RUN

View File

@ -175,42 +175,42 @@ e asm.demangle=false
pd 1
EOF
EXPECT=<<EOF
; CALL XREF from sym._init @ 0x8049008
; CALL XREF from QtPrivate::RefCount::deref() @ 0x8049349 ; method.QtPrivate::RefCount.deref__
; CALL XREF from QString::QString(char const*) @ 0x804939d ; method.QString.QString_char_const_
; CALL XREF from QString::~QString() @ 0x80493e5 ; method.QString.QString__
; CALL XREF from sym._fini @ 0x80495d4
; CALL XREF from sym._init @ 0x8049008(x)
; CALL XREF from QtPrivate::RefCount::deref() @ 0x8049349(x) ; method.QtPrivate::RefCount.deref__
; CALL XREF from QString::QString(char const*) @ 0x804939d(x) ; method.QString.QString_char_const_
; CALL XREF from QString::~QString() @ 0x80493e5(x) ; method.QString.QString__
; CALL XREF from sym._fini @ 0x80495d4(x)
/ 4: sym.__x86.get_pc_thunk.bx ();
| 0x08049140 mov ebx, dword [esp]
[0x08049140]> # sym.__x86.get_pc_thunk.bx ();
--------------------------------------------------------------.
| 0x8049140 |
| ; CALL XREF from sym._init @ 0x8049008 |
| ; CALL XREF from QtPrivate::RefCount::deref() @ 0x8049349 |
| ; method.QtPrivate::RefCount.deref__ |
| ; CALL XREF from QString::QString(char const*) @ 0x804939d |
| ; method.QString.QString_char_const_ |
| ; CALL XREF from QString::~QString() @ 0x80493e5 |
| ; method.QString.QString__ |
| ; CALL XREF from sym._fini @ 0x80495d4 |
| 4: sym.__x86.get_pc_thunk.bx (); |
| mov ebx, dword [esp] |
| ret |
`--------------------------------------------------------------'
-----------------------------------------------------------------.
| 0x8049140 |
| ; CALL XREF from sym._init @ 0x8049008(x) |
| ; CALL XREF from QtPrivate::RefCount::deref() @ 0x8049349(x) |
| ; method.QtPrivate::RefCount.deref__ |
| ; CALL XREF from QString::QString(char const*) @ 0x804939d(x) |
| ; method.QString.QString_char_const_ |
| ; CALL XREF from QString::~QString() @ 0x80493e5(x) |
| ; method.QString.QString__ |
| ; CALL XREF from sym._fini @ 0x80495d4(x) |
| 4: sym.__x86.get_pc_thunk.bx (); |
| mov ebx, dword [esp] |
| ret |
`-----------------------------------------------------------------'
; CALL XREF from sym._init @ 0x8049008
; CALL XREF from method.QtPrivate::RefCount.deref__ @ 0x8049349
; CALL XREF from method.QString.QString_char_const_ @ 0x804939d
; CALL XREF from method.QString.QString__ @ 0x80493e5
; CALL XREF from sym._fini @ 0x80495d4
; CALL XREF from sym._init @ 0x8049008(x)
; CALL XREF from method.QtPrivate::RefCount.deref__ @ 0x8049349(x)
; CALL XREF from method.QString.QString_char_const_ @ 0x804939d(x)
; CALL XREF from method.QString.QString__ @ 0x80493e5(x)
; CALL XREF from sym._fini @ 0x80495d4(x)
/ 4: sym.__x86.get_pc_thunk.bx ();
| 0x08049140 mov ebx, dword [esp]
| ; CODE XREFS from QtPrivate::RefCount::deref() @ 0x8049371, 0x804937e
| ; CODE XREFS from QtPrivate::RefCount::deref() @ 0x8049371(x), 0x804937e(x)
| 0x08049390 mov ebx, dword [var_4h]
| ; CODE XREFS from method.QtPrivate::RefCount.deref__ @ 0x8049371, 0x804937e
| ; CODE XREFS from method.QtPrivate::RefCount.deref__ @ 0x8049371(x), 0x804937e(x)
| 0x08049390 mov ebx, dword [var_4h]
EOF
RUN
@ -228,17 +228,17 @@ e asm.demangle=false
pd 1 @ sym.imp._Unwind_Resume
EOF
EXPECT=<<EOF
; CALL XREF from main @ +0x222
; CALL XREF from fcn.00001717 @ +0xbb
; CALL XREF from std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string<char*, void>(char*, char*, std::allocator<char> const&) @ +0x66 ; sym.std::__cxx11::basic_string_char__std::char_traits_char___std::allocator_char___::basic_string_char__void__char__char__std::allocator_char__const_
; CALL XREF from void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>(char*, char*, std::forward_iterator_tag) @ +0x116 ; sym.void_std::__cxx11::basic_string_char__std::char_traits_char___std::allocator_char___::_M_construct_char__char__char__std::forward_iterator_tag_
; CALL XREF from main @ +0x222(x)
; CALL XREF from fcn.00001717 @ +0xbb(x)
; CALL XREF from std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string<char*, void>(char*, char*, std::allocator<char> const&) @ +0x66(x) ; sym.std::__cxx11::basic_string_char__std::char_traits_char___std::allocator_char___::basic_string_char__void__char__char__std::allocator_char__const_
; CALL XREF from void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>(char*, char*, std::forward_iterator_tag) @ +0x116(x) ; sym.void_std::__cxx11::basic_string_char__std::char_traits_char___std::allocator_char___::_M_construct_char__char__char__std::forward_iterator_tag_
/ 6: sym.imp._Unwind_Resume ();
\ 0x00000f10 jmp dword [ebx + 0x70]
; CALL XREF from main @ +0x222
; CALL XREF from fcn.00001717 @ +0xbb
; CALL XREF from sym.std::__cxx11::basic_string_char__std::char_traits_char___std::allocator_char___::basic_string_char__void__char__char__std::allocator_char__const_ @ +0x66
; CALL XREF from sym.void_std::__cxx11::basic_string_char__std::char_traits_char___std::allocator_char___::_M_construct_char__char__char__std::forward_iterator_tag_ @ +0x116
; CALL XREF from main @ +0x222(x)
; CALL XREF from fcn.00001717 @ +0xbb(x)
; CALL XREF from sym.std::__cxx11::basic_string_char__std::char_traits_char___std::allocator_char___::basic_string_char__void__char__char__std::allocator_char__const_ @ +0x66(x)
; CALL XREF from sym.void_std::__cxx11::basic_string_char__std::char_traits_char___std::allocator_char___::_M_construct_char__char__char__std::forward_iterator_tag_ @ +0x116(x)
/ 6: sym.imp._Unwind_Resume ();
\ 0x00000f10 jmp dword [ebx + 0x70]
EOF