radare2/libr/anal/ref.c
nobody@no.org 32afcd8215 Fixed some ref/xref issues.
Add refs for conditional jumps.

Fixed issue with saving of refs/xrefs to projects

Fixed determination of jump target's enclosing function

Reenabled display of jump target's enclosing function for condition jumps.

Fixed another issue with call refs introduced earlier.
2014-05-06 03:02:39 +04:00

49 lines
1.3 KiB
C

/* radare - LGPL - Copyright 2010-2014 - nibble, pancake */
#include <r_anal.h>
#include <r_util.h>
#include <r_list.h>
// XXX this .c wraps a reversed xrefs.c api.. this is dupping code. we must merge apis!
// NOTE: This file uses the xrefs api which is sdb based
R_API RAnalRef *r_anal_ref_new() {
RAnalRef *ref = R_NEW (RAnalRef);
if (ref) {
ref->addr = -1;
ref->at = -1;
ref->type = R_ANAL_REF_TYPE_CODE;
}
return ref;
}
R_API RList *r_anal_ref_list_new() {
RList *list = r_list_new ();
list->free = &r_anal_ref_free;
return list;
}
R_API void r_anal_ref_free(void *ref) {
free (ref);
}
// TODO: use sdb or hashmap for fucks sake
R_API int r_anal_ref_add(RAnal *anal, ut64 addr, ut64 at, int type) {
r_anal_xrefs_set (anal, type, at, addr);
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);
return R_TRUE;
}
R_API RList *r_anal_xrefs_get (RAnal *anal, ut64 addr);
// XXX: MAJOR SLOWDOWN PLZ FIX
R_API RList *r_anal_xref_get(RAnal *anal, ut64 addr) {
return r_anal_xrefs_get (anal, addr);
}