Add the RAnal.mnemonics() callback in RAnalBind for the arm.v35 ##anal

This commit is contained in:
pancake 2022-05-07 21:19:04 +02:00 committed by pancake
parent e90b684e15
commit 04ee6f377e
3 changed files with 14 additions and 0 deletions

View File

@ -215,6 +215,13 @@ R_API int r_anal_add(RAnal *anal, RAnalPlugin *foo) {
return true;
}
R_API char *r_anal_mnemonics(RAnal *anal, int id, bool json) {
if (anal->cur && anal->cur->mnemonics) {
return anal->cur->mnemonics (anal, id, json);
}
return NULL;
}
R_API bool r_anal_use(RAnal *anal, const char *name) {
RListIter *it;
RAnalPlugin *h;
@ -701,6 +708,7 @@ R_API void r_anal_bind(RAnal *anal, RAnalBind *b) {
b->encode = (RAnalEncode)r_anal_opasm;
b->decode = (RAnalDecode)r_anal_op;
b->opinit = r_anal_op_init;
b->mnemonics = r_anal_mnemonics;
b->opfini = r_anal_op_fini;
b->use = r_anal_use;
}

View File

@ -1236,6 +1236,9 @@ R_API char *r_asm_mnemonics(RAsm *a, int id, bool json) {
if (a->cur->mnemonics) {
return a->cur->mnemonics (a, id, json);
}
if (a->analb.anal && a->analb.mnemonics) {
return a->analb.mnemonics (a->analb.anal, id, json);
}
return NULL;
}

View File

@ -907,6 +907,7 @@ typedef struct r_anal_op_t {
typedef RAnalFunction *(* RAnalGetFcnIn)(RAnal *anal, ut64 addr, int type);
typedef RAnalHint *(* RAnalGetHint)(RAnal *anal, ut64 addr);
typedef char *(* RAnalMnemonics)(RAnal *anal, int id, bool json);
typedef int (* RAnalEncode)(RAnal *anal, ut64 addr, const char *s, const ut8 *data, int len);
typedef int (* RAnalDecode)(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *data, int len, RAnalOpMask mask);
typedef void (* RAnalOpInit)(RAnalOp *op);
@ -917,6 +918,7 @@ typedef struct r_anal_bind_t {
RAnal *anal;
RAnalGetFcnIn get_fcn_in;
RAnalGetHint get_hint;
RAnalMnemonics mnemonics;
RAnalEncode encode;
RAnalDecode decode;
RAnalOpInit opinit;
@ -1605,6 +1607,7 @@ R_API RAnalOp *r_anal_op_new(void);
R_API void r_anal_op_free(void *op);
R_API void r_anal_op_init(RAnalOp *op);
R_API void r_anal_op_fini(RAnalOp *op);
R_API char *r_anal_mnemonics(RAnal *anal, int id, bool json);
R_API int r_anal_op_reg_delta(RAnal *anal, ut64 addr, const char *name);
R_API bool r_anal_op_is_eob(RAnalOp *op);
R_API RList *r_anal_op_list_new(void);