Add ax-*, fix ax- and doc for axf (reported by @dweinstein)

This commit is contained in:
pancake 2015-07-08 20:43:02 +02:00
parent 3ef6f65a13
commit db5e4b0997
3 changed files with 29 additions and 7 deletions

View File

@ -54,6 +54,7 @@ This release comes with contributions from the following people:
- Anton Devil
- Asger Hautop Drewsen
- Clement Vuchener
- David Weinstein
- Elias Boutaleb
- Gabriel Corona
- James Sullivan1

View File

@ -35,12 +35,12 @@ R_API int r_anal_ref_add(RAnal *anal, ut64 addr, ut64 at, int type) {
return R_TRUE;
}
R_API int r_anal_ref_del(RAnal *anal, ut64 at, ut64 addr) {
r_anal_xrefs_deln (anal, R_ANAL_REF_TYPE_NULL, at, addr);
r_anal_xrefs_deln (anal, R_ANAL_REF_TYPE_CODE, at, addr);
r_anal_xrefs_deln (anal, R_ANAL_REF_TYPE_CALL, at, addr);
r_anal_xrefs_deln (anal, R_ANAL_REF_TYPE_DATA, at, addr);
r_anal_xrefs_deln (anal, R_ANAL_REF_TYPE_STRING, at, addr);
R_API int r_anal_ref_del(RAnal *anal, ut64 from, ut64 to) {
r_anal_xrefs_deln (anal, R_ANAL_REF_TYPE_NULL, from, to);
r_anal_xrefs_deln (anal, R_ANAL_REF_TYPE_CODE, from, to);
r_anal_xrefs_deln (anal, R_ANAL_REF_TYPE_CALL, from, to);
r_anal_xrefs_deln (anal, R_ANAL_REF_TYPE_DATA, from, to);
r_anal_xrefs_deln (anal, R_ANAL_REF_TYPE_STRING, from, to);
return R_TRUE;
}

View File

@ -38,6 +38,7 @@ static void var_help(RCore *core, char ch) {
"afv-", " [idx]", "delete variable at the given index",
"afvg", " [idx] [addr]", "define var get reference",
"afvs", " [idx] [addr]", "define var set reference",
"afx", "[-] [from] [to]", "manipulate function xrefs",
NULL};
if (ch=='a' || ch=='A' || ch=='v') {
r_core_cmd_help (core, help_msg);
@ -1964,7 +1965,27 @@ static boolt cmd_anal_refs(RCore *core, const char *input) {
NULL };
switch (input[0]) {
case '-':
r_anal_ref_del (core->anal, r_num_math (core->num, input+1), core->offset);
{ // "ax-"
const char *inp;
ut64 a, b;
for (inp=input+1;*inp && IS_WHITESPACE(*inp); inp++);
if (!strcmp (inp, "*")) {
r_anal_xrefs_init (core->anal);
} else {
char *p = strdup (inp);
char *q = strchr (p, ' ');
a = r_num_math (core->num, p);
if (q) {
*q++ = 0;
b = r_num_math (core->num, q);
} else {
b = UT64_MAX;
b = core->offset;
}
r_anal_ref_del (core->anal, b, a);
free (p);
}
}
break;
case 'k':
if (input[1]==' ') {