mirror of
https://github.com/radareorg/radare2.git
synced 2024-12-11 23:16:05 +00:00
afxj and axtj using pj.c ##json
This commit is contained in:
parent
e24612ac41
commit
81bbf019fe
@ -2946,8 +2946,14 @@ static int cmd_anal_fcn(RCore *core, const char *input) {
|
||||
case '\0': // "afx"
|
||||
case 'j': // "afxj"
|
||||
case ' ': // "afx "
|
||||
{
|
||||
PJ *pj = pj_new ();
|
||||
if (input[2] == 'j') {
|
||||
r_cons_printf ("[");
|
||||
//r_cons_printf ("[");
|
||||
pj_a (pj);
|
||||
}
|
||||
if (!pj) {
|
||||
return false;
|
||||
}
|
||||
// list xrefs from current address
|
||||
{
|
||||
@ -2959,8 +2965,13 @@ static int cmd_anal_fcn(RCore *core, const char *input) {
|
||||
RList *refs = r_anal_fcn_get_refs (core->anal, fcn);
|
||||
r_list_foreach (refs, iter, ref) {
|
||||
if (input[2] == 'j') {
|
||||
r_cons_printf ("{\"type\":\"%c\",\"from\":%"PFMT64u",\"to\":%"PFMT64u"}%s",
|
||||
ref->type, ref->at, ref->addr, iter->n? ",": "");
|
||||
pj_o (pj);
|
||||
pj_ks (pj, "type", r_anal_ref_type_tostring (ref->type));
|
||||
pj_kn (pj, "from", ref->at);
|
||||
pj_kn (pj, "to", ref->addr);
|
||||
pj_end (pj);
|
||||
//r_cons_printf ("{\"type\":\"%c\",\"from\":%"PFMT64u",\"to\":%"PFMT64u"}%s",
|
||||
// ref->type, ref->at, ref->addr, iter->n? ",": "");
|
||||
} else {
|
||||
r_cons_printf ("%c 0x%08" PFMT64x " -> 0x%08" PFMT64x "\n",
|
||||
ref->type, ref->at, ref->addr);
|
||||
@ -2972,9 +2983,13 @@ static int cmd_anal_fcn(RCore *core, const char *input) {
|
||||
}
|
||||
}
|
||||
if (input[2] == 'j') {
|
||||
r_cons_printf ("]\n");
|
||||
pj_end (pj);
|
||||
r_cons_printf ("%s\n", pj_string (pj));
|
||||
//r_cons_printf ("]\n");
|
||||
}
|
||||
pj_free (pj);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
eprintf ("Wrong command. Look at af?\n");
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user