rizin icon indicating copy to clipboard operation
rizin copied to clipboard

ESIL to RZIL conversion

Open XVilka opened this issue 3 years ago • 5 comments

First stage

High-priority

  • [x] librz/analysis/p/analysis_avr.c https://github.com/rizinorg/rizin/pull/1890
  • [x] librz/analysis/p/analysis_arm_cs.c ARMv7 https://github.com/rizinorg/rizin/pull/2241
  • [x] librz/analysis/p/analysis_arm_cs.c ARMv8 https://github.com/rizinorg/rizin/pull/2354
  • [x] librz/analysis/p/analysis_ppc_cs.c https://github.com/rizinorg/rizin/pull/2823
  • [x] librz/analysis/p/analysis_x86_cs.c https://github.com/rizinorg/rizin/pull/2747 https://github.com/rizinorg/rizin/pull/3865
  • [ ] librz/analysis/p/analysis_mips_cs.c by @wargio https://github.com/rizinorg/rizin/pull/3508 (blocked on https://github.com/rizinorg/rizin/issues/4007)
  • [ ] librz/analysis/p/analysis_mips_gnu.c (should be merged into mips_cs and removed) by @wargio (blocked on https://github.com/rizinorg/rizin/issues/4007)
  • [ ] librz/analysis/p/analysis_riscv_cs.c (requires capstone auto-sync update, since it's grossly inaccurate right now) by @moste00

The rest

  • [x] librz/analysis/p/analysis_bf.c
  • [x] librz/analysis/p/analysis_6502.c
  • [x] librz/analysis/p/analysis_sh.c https://github.com/rizinorg/rizin/pull/2518
  • [x] librz/analysis/p/analysis_8051.c https://github.com/rizinorg/rizin/pull/2999
  • [x] librz/analysis/p/analysis_gb.c https://github.com/rizinorg/rizin/pull/3750
  • [x] librz/analysis/p/analysis_wasm.c REMOVED https://github.com/rizinorg/rizin/pull/3497
  • [x] librz/analysis/p/analysis_rsp.c REMOVED https://github.com/rizinorg/rizin/pull/3531
  • [x] librz/analysis/p/analysis_v810.c https://github.com/rizinorg/rizin/pull/4096
  • [x] librz/analysis/p/analysis_v850.c https://github.com/rizinorg/rizin/pull/4103
  • [x] librz/analysis/p/analysis_pic.c https://github.com/rizinorg/rizin/pull/4322
  • [ ] librz/analysis/p/analysis_h8300.c https://github.com/rizinorg/rizin/pull/4375
  • [ ] librz/analysis/p/analysis_sparc_cs.c https://github.com/rizinorg/rizin/pull/4521
  • [ ] librz/analysis/p/analysis_xtensa.c by @imbillow

Second stage

  • [ ] Migrate all analysis steps from ESIL to RZIL
  • [x] https://github.com/rizinorg/rizin/issues/3594
  • [ ] Debug/"emulation" engine based on RzIL instead of ESIL by default: https://github.com/rizinorg/rizin/issues/3676
  • [ ] Update Rizin book and documentation to refer to RZIL
  • [ ] Remove ESIL implementation
  • [ ] Remove ESIL documentation
  • [ ] Remove ESIL tests
  • [ ] Update GitHub labeler and other workflows
  • [ ] Close all ESIL issues in Rizin repositories

Cutter

  • [ ] Update ESIL configuration options/dialogs to use RzIL
  • [x] RzIL visualization https://github.com/rizinorg/cutter/issues/1133

Other

  • [ ] rz-ghidra (remove ESIL use)
  • [x] jsdec
  • [x] rz-retdec
  • [ ] rz-lang (Python RzAnalysis plugin API)
  • [ ] rizin-extras (probably remove plugins that rely on ESIL completely)
  • [ ] Cutter

RzAnalysis

$ rg -t c "esil" librz/core/ -l
librz/arch/serialize_analysis.c # isn't really used, relevant lines can be removed from the file
librz/arch/var.c
librz/arch/il/analysis_il_trace.c
librz/arch/op.c # isn't really used, relevant lines can be removed from the file
librz/arch/hint.c # isn't really used, relevant lines can be removed from the file
librz/arch/analysis.c # isn't really used, relevant lines can be removed from the file
librz/arch/fcn.c

RzDebug

librz/debug/p/debug_io.c
librz/debug/p/native/bt/generic-x64.c
librz/debug/p/native/bt/generic-x86.c
librz/debug/desil.c
librz/debug/trace.c

RzCore

$ rg -t c "esil" librz/core/ -l
librz/core/cprint.c # isn't really used, relevant lines can be removed from the file
librz/core/casm.c # isn't really used, relevant lines can be removed from the file
librz/core/cil.c
librz/core/analysis_objc.c 
librz/core/cdebug.c
librz/core/ctypes.c
librz/core/project_migrate.c # isn't really used, we should remove all ESIL-related information during the migration
librz/core/analysis_tp.c
librz/core/disasm.c 
librz/core/cmd_descs/cmd_descs.h # just remove no longer necessary command handlers
librz/core/tui/visual.c # isn't really used, relevant lines can be removed from the file
librz/core/cmd_descs/cmd_descs.c # just remove no longer necessary command handlers
librz/core/tui/esil.c # This one can be simply removed
librz/core/tui/biteditor.c # Should print RzIL instead
librz/core/tui/panels.c # Should be substituted with RzIL emulation
librz/core/cconfig.c # ESIL relevant options and callbacks could be removed, new options for RzIL should be created
librz/core/agraph.c # isn't really used, relevant lines can be removed from the file
librz/core/core_private.h # isn't really used, relevant lines can be removed from the file
librz/core/cesil.c # This one can be simply removed 
librz/core/cmd/cmd_debug.c
librz/core/cmd/cmd_search.c
librz/core/canalysis.c 
librz/core/cmd/cmd_search_rop.c
librz/core/cmd/cmd_print.c
librz/core/cmd/cmd_analysis.c

XVilka avatar Dec 09 '21 09:12 XVilka

As I see rsp plugin is untested and unmaintained. Maybe we should move it to the extras?

pelijah avatar Dec 26 '22 18:12 pelijah

Better first check if it can be made tested and working without too much effort.

thestr4ng3r avatar Dec 27 '22 10:12 thestr4ng3r

I want to work on this issue please assign me this issue!..

Gauravjadhav22 avatar Feb 03 '23 04:02 Gauravjadhav22

@Gauravjadhav22 go ahead. Look at how AVR was converted and I recommend taking RSP (librz/analysis/p/analysis_rsp.c) architecture - it's simple enough for a start.

XVilka avatar Feb 03 '23 04:02 XVilka

I looked at some code that uses ESIL, e.g. librz/analysis/var.c (and a trivial piece of code at librz/analysis/fcn.c) or librz/core/analysis_tp.c - the use of ESIL could be conditional, if ESIL is chosen, and can use a different code path/function if the RzIL is chosen.

These could be the first steps on switching from ESIL to RzIL without breaking compatibility for now.

XVilka avatar Sep 19 '23 04:09 XVilka