From a7121abf8ca579ec2a185eadd474fc962496416c Mon Sep 17 00:00:00 2001 From: pancake Date: Wed, 15 Nov 2023 18:46:17 +0100 Subject: [PATCH] Add the missing esil.null plugin --- README.md | 4 +-- dist/plugins-cfg/plugins.android.cfg | 1 + dist/plugins-cfg/plugins.bin.cfg | 1 + dist/plugins-cfg/plugins.cs4.cfg | 1 + dist/plugins-cfg/plugins.def.cfg | 1 + dist/plugins-cfg/plugins.emscripten.cfg | 1 + dist/plugins-cfg/plugins.ios-store.cfg | 1 + dist/plugins-cfg/plugins.ios.cfg | 1 + dist/plugins-cfg/plugins.mingw.cfg | 1 + dist/plugins-cfg/plugins.nocs.cfg | 1 + dist/plugins-cfg/plugins.nogpl.cfg | 1 + dist/plugins-cfg/plugins.static.cfg | 1 + dist/plugins-cfg/plugins.static.nogpl.cfg | 1 + dist/plugins-cfg/plugins.termux.cfg | 1 + dist/plugins-cfg/plugins.tiny.cfg | 1 + dist/plugins-cfg/plugins.vinix.cfg | 1 + dist/plugins-cfg/plugins.wasi.cfg | 1 + libr/bp/meson.build | 4 +-- libr/esil/meson.build | 1 + libr/esil/p/esil_null.c | 32 +++++++++++++++++++++++ libr/esil/p/null.mk | 9 +++++++ libr/include/r_bp.h | 1 + libr/include/r_esil.h | 1 + libr/meson.build | 2 +- 24 files changed, 65 insertions(+), 5 deletions(-) create mode 100644 libr/esil/p/esil_null.c create mode 100644 libr/esil/p/null.mk diff --git a/README.md b/README.md index 2dc86a95bf..0d2593ec85 100644 --- a/README.md +++ b/README.md @@ -172,8 +172,8 @@ MCORE, mcs96, RSP, SuperH-4, VAX, KVX, Am29000, LOONGARCH, JDH8, s390x. ## File Formats ELF, Mach-O, Fatmach-O, PE, PE+, MZ, COFF, XCOFF, OMF, TE, XBE, SEP64, BIOS/UEFI, -Dyldcache, DEX, ART, CGC, Java class, Android boot image, Plan9 executables, -ZIMG, MBN/SBL bootloader, ELF coredump, MDMP (Windows minidump), PDP11, XTAC, +Dyldcache, DEX, ART, Java class, Android boot image, Plan9 executables, Amiga HUNK, +ZIMG, MBN/SBL bootloader, ELF coredump, MDMP (Windows minidump), PDP11, XTAC, CGC, WASM (WebAssembly binary), Commodore VICE emulator, QNX, WAD, OFF, TIC-80, GB/GBA, NDS and N3DS, and mount several filesystems like NTFS, FAT, HFS+, EXT,... diff --git a/dist/plugins-cfg/plugins.android.cfg b/dist/plugins-cfg/plugins.android.cfg index 2d1bbce000..cd775cebf1 100644 --- a/dist/plugins-cfg/plugins.android.cfg +++ b/dist/plugins-cfg/plugins.android.cfg @@ -15,6 +15,7 @@ arch.wasm arch.x86_cs arch.x86_nz esil.dummy +esil.null bin.any bin.bios bin.elf diff --git a/dist/plugins-cfg/plugins.bin.cfg b/dist/plugins-cfg/plugins.bin.cfg index a2b3a50a1d..91de10e01a 100644 --- a/dist/plugins-cfg/plugins.bin.cfg +++ b/dist/plugins-cfg/plugins.bin.cfg @@ -6,6 +6,7 @@ io.default bin.any bin.elf bin.elf64 +esil.null bin.java bin.dex bin.le diff --git a/dist/plugins-cfg/plugins.cs4.cfg b/dist/plugins-cfg/plugins.cs4.cfg index 1bbfe175f4..34085f03bd 100644 --- a/dist/plugins-cfg/plugins.cs4.cfg +++ b/dist/plugins-cfg/plugins.cs4.cfg @@ -189,6 +189,7 @@ debug.winkd egg.exec egg.xor esil.dummy +esil.null fs.ext2 fs.fat fs.fb diff --git a/dist/plugins-cfg/plugins.def.cfg b/dist/plugins-cfg/plugins.def.cfg index 57433f0be5..60f4128283 100644 --- a/dist/plugins-cfg/plugins.def.cfg +++ b/dist/plugins-cfg/plugins.def.cfg @@ -197,6 +197,7 @@ debug.rap debug.winkd egg.exec egg.xor +esil.null esil.dummy fs.ext2 fs.fat diff --git a/dist/plugins-cfg/plugins.emscripten.cfg b/dist/plugins-cfg/plugins.emscripten.cfg index 47589d2edf..a29bee395a 100644 --- a/dist/plugins-cfg/plugins.emscripten.cfg +++ b/dist/plugins-cfg/plugins.emscripten.cfg @@ -57,6 +57,7 @@ debug.native debug.rap egg.exec egg.xor +esil.null esil.dummy fs.posix io.bfdbg diff --git a/dist/plugins-cfg/plugins.ios-store.cfg b/dist/plugins-cfg/plugins.ios-store.cfg index 8bfa47532d..933678c506 100644 --- a/dist/plugins-cfg/plugins.ios-store.cfg +++ b/dist/plugins-cfg/plugins.ios-store.cfg @@ -11,6 +11,7 @@ arch.java arch.mips_cs arch.null arch.x86_nz +esil.null esil.dummy bin.any bin.bios diff --git a/dist/plugins-cfg/plugins.ios.cfg b/dist/plugins-cfg/plugins.ios.cfg index 872f481739..a0b3199337 100644 --- a/dist/plugins-cfg/plugins.ios.cfg +++ b/dist/plugins-cfg/plugins.ios.cfg @@ -12,6 +12,7 @@ arch.mips_cs arch.null arch.x86_cs arch.x86_nz +esil.null esil.dummy bin.any bin.bios diff --git a/dist/plugins-cfg/plugins.mingw.cfg b/dist/plugins-cfg/plugins.mingw.cfg index 5ea22ce160..0d4effe360 100644 --- a/dist/plugins-cfg/plugins.mingw.cfg +++ b/dist/plugins-cfg/plugins.mingw.cfg @@ -69,6 +69,7 @@ arch.xtensa arch.z80 asm.null bin.any +esil.null esil.dummy bin.tic bin.wasm diff --git a/dist/plugins-cfg/plugins.nocs.cfg b/dist/plugins-cfg/plugins.nocs.cfg index 9bca586996..9831d0a2ae 100644 --- a/dist/plugins-cfg/plugins.nocs.cfg +++ b/dist/plugins-cfg/plugins.nocs.cfg @@ -55,6 +55,7 @@ arch.xap arch.xtensa arch.z80 asm.null +esil.null esil.dummy bin.any bin.s390 diff --git a/dist/plugins-cfg/plugins.nogpl.cfg b/dist/plugins-cfg/plugins.nogpl.cfg index 4c0c071651..0625704456 100644 --- a/dist/plugins-cfg/plugins.nogpl.cfg +++ b/dist/plugins-cfg/plugins.nogpl.cfg @@ -28,6 +28,7 @@ arch.ws arch.x86_nz arch.xap arch.xcore_cs +esil.null esil.dummy bin.any bin.bf diff --git a/dist/plugins-cfg/plugins.static.cfg b/dist/plugins-cfg/plugins.static.cfg index e3f8646498..b608ddbba0 100644 --- a/dist/plugins-cfg/plugins.static.cfg +++ b/dist/plugins-cfg/plugins.static.cfg @@ -42,6 +42,7 @@ arch.propeller arch.null arch.i4004 esil.dummy +esil.null arch.arm arch.any_as asm.null diff --git a/dist/plugins-cfg/plugins.static.nogpl.cfg b/dist/plugins-cfg/plugins.static.nogpl.cfg index 75b735aa18..98d62c828d 100644 --- a/dist/plugins-cfg/plugins.static.nogpl.cfg +++ b/dist/plugins-cfg/plugins.static.nogpl.cfg @@ -34,6 +34,7 @@ arch.xap arch.xcore_cs asm.null esil.dummy +esil.null bin.any bin.nro bin.nso diff --git a/dist/plugins-cfg/plugins.termux.cfg b/dist/plugins-cfg/plugins.termux.cfg index 19e2407ed7..7d46aa2809 100644 --- a/dist/plugins-cfg/plugins.termux.cfg +++ b/dist/plugins-cfg/plugins.termux.cfg @@ -44,6 +44,7 @@ arch.x86_nz arch.xcore_cs arch.z80 asm.null +esil.null esil.dummy bin.any bin.tic diff --git a/dist/plugins-cfg/plugins.tiny.cfg b/dist/plugins-cfg/plugins.tiny.cfg index 8ab0d1a421..bd52de7799 100644 --- a/dist/plugins-cfg/plugins.tiny.cfg +++ b/dist/plugins-cfg/plugins.tiny.cfg @@ -10,6 +10,7 @@ arch.mips_cs arch.null arch.x86_cs arch.x86_nz +esil.null esil.dummy bin.any bin.bios diff --git a/dist/plugins-cfg/plugins.vinix.cfg b/dist/plugins-cfg/plugins.vinix.cfg index a8d20339de..a5a5144104 100644 --- a/dist/plugins-cfg/plugins.vinix.cfg +++ b/dist/plugins-cfg/plugins.vinix.cfg @@ -5,6 +5,7 @@ arch.x86_cs arch.x86_nz bin.any esil.dummy +esil.null bin.bios bin.elf bin.elf64 diff --git a/dist/plugins-cfg/plugins.wasi.cfg b/dist/plugins-cfg/plugins.wasi.cfg index 3eb5019578..9338fe233c 100644 --- a/dist/plugins-cfg/plugins.wasi.cfg +++ b/dist/plugins-cfg/plugins.wasi.cfg @@ -16,6 +16,7 @@ arch.wasm arch.x86_cs arch.x86_nz arch.z80 +esil.null esil.dummy crypto.base64 crypto.xor diff --git a/libr/bp/meson.build b/libr/bp/meson.build index 944d7a38b1..2106c30800 100644 --- a/libr/bp/meson.build +++ b/libr/bp/meson.build @@ -4,6 +4,7 @@ r_bp_sources = [ 'bp_plugin.c', 'bp_traptrace.c', 'bp_watch.c', + 'p/bp_null.c', 'p/bp_arm.c', 'p/bp_bf.c', 'p/bp_mips.c', @@ -22,8 +23,7 @@ r_bp = library('r_bp', r_bp_sources, soversion: r2_libversion ) -r_bp_dep = declare_dependency(link_with: r_bp, - include_directories: [platform_inc]) +r_bp_dep = declare_dependency(link_with: r_bp, include_directories: [platform_inc]) if get_option('blob') r_bp_static = static_library('r_bp_static', r_bp_sources, diff --git a/libr/esil/meson.build b/libr/esil/meson.build index ecb7ea34d6..944802994b 100644 --- a/libr/esil/meson.build +++ b/libr/esil/meson.build @@ -4,6 +4,7 @@ r_esil_sources = [ 'esil_plugin.c', 'esil_stats.c', 'esil_trace.c', + 'p/esil_null.c', 'p/esil_dummy.c', ] esil_extra_inc = include_directories('..', '../include') diff --git a/libr/esil/p/esil_null.c b/libr/esil/p/esil_null.c new file mode 100644 index 0000000000..6f3479334a --- /dev/null +++ b/libr/esil/p/esil_null.c @@ -0,0 +1,32 @@ +/* radare2 - LGPL - Copyright 2023 - pancake */ + +#define R_LOG_ORIGIN "esil.null" + +#include +#include + +static void *r_esil_null_init(REsil *esil) { + return NULL; +} + +static void r_esil_null_fini(REsil *esil, void *user) { + // do nothing +} + +REsilPlugin r_esil_plugin_null = { + .meta = { + .name = "null", + .desc = "null esil plugin", + .license = "MIT", + }, + .init = r_esil_null_init, + .fini = r_esil_null_fini +}; + +#ifndef R2_PLUGIN_INCORE +R_API RLibStruct radare_plugin = { + .type = R_LIB_TYPE_ESIL, + .data = &r_esil_plugin_null, + .version = R2_VERSION +}; +#endif diff --git a/libr/esil/p/null.mk b/libr/esil/p/null.mk new file mode 100644 index 0000000000..f233691e7b --- /dev/null +++ b/libr/esil/p/null.mk @@ -0,0 +1,9 @@ +OBJ_ESIL_NULL=esil_null.o + +STATIC_OBJ+=${OBJ_ESIL_NULL} +TARGET_ESIL_NULL=esil_null.${EXT_SO} + +ALL_TARGETS+=${TARGET_ESIL_NULL} + +${TARGET_ESIL_NULL}: ${OBJ_ESIL_NULL} + ${CC} $(call libname,esil_null) ${LDFLAGS} ${CFLAGS} -o esil_null.${EXT_SO} ${OBJ_ESIL_NULL} diff --git a/libr/include/r_bp.h b/libr/include/r_bp.h index d2f3cec992..b87f295a28 100644 --- a/libr/include/r_bp.h +++ b/libr/include/r_bp.h @@ -174,6 +174,7 @@ extern RBreakpointPlugin r_bp_plugin_mips; extern RBreakpointPlugin r_bp_plugin_ppc; extern RBreakpointPlugin r_bp_plugin_sh; extern RBreakpointPlugin r_bp_plugin_bf; +extern RBreakpointPlugin r_bp_plugin_null; extern RBreakpointPlugin r_bp_plugin_riscv; #endif #ifdef __cplusplus diff --git a/libr/include/r_esil.h b/libr/include/r_esil.h index e9b0630782..536f1f87b3 100644 --- a/libr/include/r_esil.h +++ b/libr/include/r_esil.h @@ -389,6 +389,7 @@ R_API void r_esil_trace_restore(REsil *esil, int idx); R_API ut64 r_esil_trace_loopcount(REsilTrace *etrace, ut64 addr); R_API void r_esil_trace_loopcount_increment(REsilTrace *etrace, ut64 addr); +extern REsilPlugin r_esil_plugin_null; extern REsilPlugin r_esil_plugin_dummy; #ifdef __cplusplus diff --git a/libr/meson.build b/libr/meson.build index 24916d61ad..d0dafdd883 100644 --- a/libr/meson.build +++ b/libr/meson.build @@ -251,7 +251,7 @@ if no_user_plugins 'xbe', 'xcoff64', 'xnu_kernelcache', - 'xtac' + 'xtac', 'z64', 'zimg', ]