rizinorg / rizin

UNIX-like reverse engineering framework and command-line toolset.
https://rizin.re
GNU Lesser General Public License v3.0
2.63k stars 352 forks source link

RzIL public API for core plugins #3145

Open ogre2007 opened 1 year ago

ogre2007 commented 1 year ago

Is your feature request related to a problem? Please describe. If one wants to implement some work related to RZIL, but without intention to implement analysis plugin that will help with lifting (rz_analysis.h), there is no means to do it without digging into core_private.h or cmd_descs.h headers, that is private and not accessible by default. It provides useful things - Init and start VM on current addr for core pointer, print vm state and so on. Public headers in rz_il.h provide only low-level VM procs rz_core.h includes useful procs, but only for ESIL, and not RZIL

Describe the solution you'd like Expose and describe useful RZIL API in public header rz_core.h, as its already done for ESIL, or implement it in some other way.

rz_core.h
/*cil.c */
// TODO : They should have been there, but require `static` vars inside canalysis.c
//      : Keep esil in canalysis.c, and split the rzil in cil.c
RZ_API void rz_core_analysis_esil(RzCore *core, ut64 addr, ut64 size, RZ_NULLABLE RzAnalysisFunction *fcn);
RZ_API bool rz_core_esil_cmd(RzAnalysisEsil *esil, const char *cmd, ut64 a1, ut64 a2);
RZ_API int rz_core_esil_step(RzCore *core, ut64 until_addr, const char *until_expr, ut64 *prev_addr, bool stepOver);
RZ_API int rz_core_esil_step_back(RzCore *core);
RZ_API bool rz_core_esil_dumpstack(RzAnalysisEsil *esil);
RZ_API bool rz_core_esil_continue_back(RZ_NONNULL RzCore *core);
RZ_API void rz_core_analysis_esil_step_over(RZ_NONNULL RzCore *core);
RZ_API void rz_core_analysis_esil_reinit(RZ_NONNULL RzCore *core);
RZ_API void rz_core_analysis_esil_deinit(RZ_NONNULL RzCore *core);
RZ_API void rz_core_analysis_esil_init_mem(RZ_NONNULL RzCore *core, RZ_NULLABLE const char *name, ut64 addr, ut32 size);
RZ_API void rz_core_analysis_esil_init_mem_del(RZ_NONNULL RzCore *core, RZ_NULLABLE const char *name, ut64 addr, ut32 size);
RZ_API void rz_core_analysis_esil_init_regs(RZ_NONNULL RzCore *core);

upd: Such useful functions is already defined in cil.c, but they are not exposed in rz_core.

XVilka commented 8 months ago

It will be done as a part of the ongoing transition (see the Second stage) since the first stage is almost complete now: https://github.com/rizinorg/rizin/issues/2080