分析插件
After implementing disassembly plugin, you might have noticed that output is far from being good - no proper highlighting, no reference lines and so on. This is because radare2 requires every architecture plugin to provide also analysis information about every opcode. At the moment the implementation of disassembly and opcodes analysis is separated between two modules - RAsm and RAnal. Thus we need to write an analysis plugin too. The principle is very similar - you just need to create a C file and corresponding Makefile.
They structure of RAnal plugin looks like
Like with disassembly plugin there is a key function - mycpu_op
which scans the opcode and builds RAnalOp structure. On the other hand, in this example analysis plugins also performs uplifting to ESIL, which is enabled in .esil = true
statement. Thus, mycpu_op
obliged to fill the corresponding RAnalOp ESIL field for the opcodes. Second important thing for ESIL uplifting and emulation - register profile, like in debugger, which is set within set_reg_profile
function.
Makefile
anal_snes.c:
After compiling radare2 will list this plugin in the output:
snes_op_table.h: https://github.com/radare/radare2/blob/master/libr/asm/arch/snes/snes_op_table.h
Example:
最后更新于
这有帮助吗?