2014-03-12 02:23:50 +00:00
|
|
|
/* radare - LGPL - Copyright 2010-2014 - nibble, pancake */
|
2010-03-12 02:05:20 +00:00
|
|
|
|
|
|
|
#include <r_anal.h>
|
|
|
|
#include <r_util.h>
|
|
|
|
#include <r_list.h>
|
|
|
|
|
2014-09-21 23:39:24 +00:00
|
|
|
// This file contains the reversed api for querying xrefs.c which
|
|
|
|
// is implemented on top of sdb. Anyway, the sdbization is not
|
|
|
|
// complete because there's still r_anal_ref_new() which doesnt
|
|
|
|
// serializes with sdb_native
|
|
|
|
|
2010-09-28 11:58:03 +00:00
|
|
|
R_API RAnalRef *r_anal_ref_new() {
|
2010-06-13 22:57:40 +00:00
|
|
|
RAnalRef *ref = R_NEW (RAnalRef);
|
|
|
|
if (ref) {
|
|
|
|
ref->addr = -1;
|
2010-08-02 10:42:59 +00:00
|
|
|
ref->at = -1;
|
2010-09-28 11:58:03 +00:00
|
|
|
ref->type = R_ANAL_REF_TYPE_CODE;
|
2010-06-13 22:57:40 +00:00
|
|
|
}
|
2010-05-20 15:40:58 +00:00
|
|
|
return ref;
|
2010-03-12 02:05:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
2010-09-28 11:58:03 +00:00
|
|
|
|
|
|
|
R_API int r_anal_ref_add(RAnal *anal, ut64 addr, ut64 at, int type) {
|
2014-05-05 15:31:10 +00:00
|
|
|
r_anal_xrefs_set (anal, type, at, addr);
|
2013-07-23 15:11:51 +00:00
|
|
|
return R_TRUE;
|
2010-09-28 11:58:03 +00:00
|
|
|
}
|
|
|
|
|
2013-07-19 01:35:45 +00:00
|
|
|
R_API int r_anal_ref_del(RAnal *anal, ut64 at, ut64 addr) {
|
2014-05-05 15:31:10 +00:00
|
|
|
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);
|
2010-09-28 11:58:03 +00:00
|
|
|
return R_TRUE;
|
|
|
|
}
|
2010-09-28 16:05:31 +00:00
|
|
|
|
|
|
|
R_API RList *r_anal_xref_get(RAnal *anal, ut64 addr) {
|
2013-07-19 01:35:45 +00:00
|
|
|
return r_anal_xrefs_get (anal, addr);
|
|
|
|
}
|