mirror of
https://github.com/radareorg/radare2.git
synced 2024-12-11 15:04:23 +00:00
Fix #1561 - 'afv' working again
This commit is contained in:
parent
a004393b32
commit
e5de1a3ae7
@ -254,7 +254,7 @@ R_API int r_anal_var_list(RAnal *a, RAnalFunction *fcn, int kind, ut64 addr, int
|
||||
if (!a|| !fcn)
|
||||
return 0;
|
||||
if (!kind) kind = 'v'; // by default show vars
|
||||
varlist = sdb_get (DB, sdb_fmt (0, "fcn.0x%08"PFMT64x".%c", fcn->addr, kind), 0);
|
||||
varlist = sdb_get (DB, sdb_fmt (0, "fcn.0x%"PFMT64x".%c", fcn->addr, kind), 0);
|
||||
if (varlist) {
|
||||
count = sdb_alen (varlist);
|
||||
char *next, *ptr = varlist;
|
||||
@ -263,31 +263,31 @@ R_API int r_anal_var_list(RAnal *a, RAnalFunction *fcn, int kind, ut64 addr, int
|
||||
struct VarType vt;
|
||||
char *word = sdb_anext (ptr, &next);
|
||||
char *vardef = sdb_get (DB, sdb_fmt (1,
|
||||
"var.0x%08"PFMT64x".%c.%s",
|
||||
"var.0x%"PFMT64x".%c.%s",
|
||||
fcn->addr, kind, word), 0);
|
||||
int delta = atoi (word+2);
|
||||
if (vardef) {
|
||||
sdb_fmt_init (&vt, SDB_VARTYPE_FMT);
|
||||
sdb_fmt_tobin (vardef, SDB_VARTYPE_FMT, &vt);
|
||||
sdb_fmt_init (&vt, SDB_VARTYPE_FMT);
|
||||
sdb_fmt_tobin (vardef, SDB_VARTYPE_FMT, &vt);
|
||||
|
||||
a->printf ("%s %s %s @ %s%s%d\n",
|
||||
kind=='v'?"var":"arg",
|
||||
vt.type, vt.name, a->reg->name[R_REG_NAME_BP],
|
||||
(kind=='v')?"-":"+",
|
||||
delta);
|
||||
//a->printf (" - (%s)(%s) = %d\n", vt.type, vt.name, vt.size);
|
||||
a->printf ("%s %s %s @ %s%s%d\n",
|
||||
kind=='v'?"var":"arg",
|
||||
vt.type, vt.name, a->reg->name[R_REG_NAME_BP],
|
||||
(kind=='v')?"-":"+",
|
||||
delta);
|
||||
//a->printf (" - (%s)(%s) = %d\n", vt.type, vt.name, vt.size);
|
||||
#if 0
|
||||
a->printf (".t %s @ %s%s%d # name: %s\n",
|
||||
vt.type, a->reg->name[R_REG_NAME_BP],
|
||||
(kind=='v')?"-":"+",
|
||||
delta, vt.name);
|
||||
a->printf (".t %s @ %s%s%d # name: %s\n",
|
||||
vt.type, a->reg->name[R_REG_NAME_BP],
|
||||
(kind=='v')?"-":"+",
|
||||
delta, vt.name);
|
||||
#endif
|
||||
|
||||
sdb_fmt_free (&vt, SDB_VARTYPE_FMT);
|
||||
free (vardef);
|
||||
} else {
|
||||
eprintf ("Cannot find '%s'\n", word);
|
||||
}
|
||||
sdb_fmt_free (&vt, SDB_VARTYPE_FMT);
|
||||
free (vardef);
|
||||
} else {
|
||||
eprintf ("Cannot find '%s'\n", word);
|
||||
}
|
||||
ptr = next;
|
||||
} while (next);
|
||||
}
|
||||
|
@ -476,12 +476,12 @@ static int cmd_anal_fcn(RCore *core, const char *input) {
|
||||
} else eprintf("No function defined at 0x%08"PFMT64x"\n", addr);
|
||||
}
|
||||
break;
|
||||
case 'a':
|
||||
case 'A':
|
||||
case 'v':
|
||||
case 'a': // "afa"
|
||||
case 'A': // "afA"
|
||||
case 'v': // "afv"
|
||||
var_cmd (core, input+1);
|
||||
break;
|
||||
case 'c':
|
||||
case 'c': // "afc"
|
||||
{
|
||||
RAnalFunction *fcn;
|
||||
if ((fcn = r_anal_get_fcn_in (core->anal, core->offset, 0)) != NULL) {
|
||||
@ -489,7 +489,7 @@ static int cmd_anal_fcn(RCore *core, const char *input) {
|
||||
} else eprintf ("Error: Cannot find function at 0x08%"PFMT64x"\n", core->offset);
|
||||
}
|
||||
break;
|
||||
case 'C':
|
||||
case 'C': // "afC"
|
||||
if (input[2]=='?') {
|
||||
int i;
|
||||
for (i=0; ; i++) {
|
||||
@ -524,7 +524,7 @@ static int cmd_anal_fcn(RCore *core, const char *input) {
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'b':
|
||||
case 'b': // "afb"
|
||||
if (input[2] == 'b') {
|
||||
anal_fcn_add_bb (core, input+3);
|
||||
} else {
|
||||
@ -534,7 +534,7 @@ static int cmd_anal_fcn(RCore *core, const char *input) {
|
||||
else eprintf ("Cannot find function to set bits\n");
|
||||
}
|
||||
break;
|
||||
case 'n':
|
||||
case 'n': // "afn"
|
||||
if (input[2]=='a') { // afna autoname
|
||||
char *name = r_core_anal_fcn_autoname (core, core->offset);
|
||||
if (name) {
|
||||
@ -570,7 +570,7 @@ static int cmd_anal_fcn(RCore *core, const char *input) {
|
||||
break;
|
||||
#if FCN_OLD
|
||||
/* this is undocumented and probably have no uses. plz discuss */
|
||||
case 'e':
|
||||
case 'e': // "afe"
|
||||
{
|
||||
RAnalFunction *fcn;
|
||||
ut64 off = core->offset;
|
||||
@ -681,7 +681,7 @@ static int cmd_anal_fcn(RCore *core, const char *input) {
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case '?':{
|
||||
case '?':{ // "af?"
|
||||
const char* help_msg[] = {
|
||||
"Usage:", "af", "",
|
||||
"af", " @[addr]", "analyze functions (start at addr)",
|
||||
|
Loading…
Reference in New Issue
Block a user