anal_xtensa: initial ESIL support

This commit is contained in:
Vlad Ivanov 2016-09-01 23:50:28 +03:00 committed by radare
parent 0a1e99ce04
commit 19d4154e39
9 changed files with 1340 additions and 18 deletions

View File

@ -31,8 +31,11 @@ OBJLIBS+=hint.o anal.o data.o xrefs.o esil.o sign.o
OBJLIBS+=anal_ex.o switch.o state.o cycles.o
OBJLIBS+=esil_stats.o esil_trace.o flirt.o labels.o
OBJLIBS+=esil2reil.o pin.o
ASMOBJS+=$(LTOP)/asm/arch/xtensa/gnu/xtensa-modules.o
ASMOBJS+=$(LTOP)/asm/arch/xtensa/gnu/xtensa-isa.o
ASMOBJS+=$(LTOP)/asm/arch/xtensa/gnu/elf32-xtensa.o
OBJS=${STATIC_OBJS} ${OBJLIBS}
OBJS=${STATIC_OBJS} ${OBJLIBS} ${ASMOBJS}
test tests: tests-esil

View File

@ -511,3 +511,10 @@ R_API void r_anal_build_range_on_hints(RAnal *a) {
}
}
}
R_API void r_anal_bind(RAnal *anal, RAnalBind *b) {
if (b) {
b->anal = anal;
b->get_fcn_in = r_anal_get_fcn_in;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,7 @@ include ../../global.mk
NAME=r_asm
DEPS=r_syscall r_lang r_util r_parse
DEPS+=r_flags r_cons r_reg r_anal
DEPS+=r_flags r_cons r_reg
CFLAGS+=-DCORELIB -Iarch/include -Iarch -I../../shlr
CURDIR=p/

View File

@ -1398,6 +1398,7 @@ R_API int r_core_init(RCore *core) {
r_io_bind (core->io, &(core->fs->iob));
r_io_bind (core->io, &(core->bin->iob));
r_flag_bind (core->flags, &(core->anal->flb));
r_anal_bind (core->anal, &(core->parser->analb));
core->file = NULL;
core->files = r_list_new ();

View File

@ -622,6 +622,13 @@ typedef struct r_anal_t {
RList /*RAnalRange*/ *bits_ranges;
} RAnal;
typedef RAnalFunction *(* RAnalGetFcnIn)(RAnal *anal, ut64 addr, int type);
typedef struct r_anal_bind_t {
RAnal *anal;
RAnalGetFcnIn get_fcn_in;
} RAnalBind;
typedef struct r_anal_hint_t {
ut64 addr;
ut64 ptr;
@ -1149,6 +1156,7 @@ R_API int r_anal_set_big_endian(RAnal *anal, int boolean);
R_API char *r_anal_strmask (RAnal *anal, const char *data);
R_API void r_anal_trace_bb(RAnal *anal, ut64 addr);
R_API const char *r_anal_fcn_type_tostring(int type);
R_API void r_anal_bind(RAnal *b, RAnalBind *bnd);
/* fcnsign */
R_API int r_anal_set_triplet(RAnal *anal, const char *os, const char *arch, int bits);

View File

@ -29,6 +29,7 @@ typedef struct r_parse_t {
RAnalHint *hint; // weak anal ref
RList *parsers;
RAnalVarList varlist;
RAnalBind analb;
} RParse;
typedef struct r_parse_plugin_t {

View File

@ -1,7 +1,7 @@
include ../config.mk
NAME=r_parse
DEPS=r_flags r_util r_anal r_syscall r_reg
DEPS=r_flags r_util r_syscall r_reg
# indirect dependencies
DEPS+=r_cons

View File

@ -168,7 +168,7 @@ static int filter(RParse *p, RFlag *f, char *data, char *str, int len, bool big_
}
off = r_num_math (NULL, ptr);
if (off > 0xff) {
fcn = r_anal_get_fcn_in (p->anal, off, 0);
fcn = p->analb.get_fcn_in (p->anal, off, 0);
if (fcn && fcn->addr == off) {
*ptr = 0;
// hack to realign pointer for colours