This introduces the ability to split asm strings into tokens and assign a type to them. This means: * Each asm strings is assigned a list of tokens. Each token points to a sub-string. * A token has a type attached which describes it (e.g. register token, operator token, mnemonic token etc.) * A generic parsing method is introduced which splits an asm string into tokens. The pattern it parses is `<mnem> <op> <op> ...`. * Instead of the generic method, plugins can create the token strings on their own. * An API method was introduced to help plugins implement their own parsing methods via regex patterns. * Custom token strings are stored in `RzAsmOp.asm_toks` Additionally the coloring of asm strings is now exclusively done via the token strings. * For this a function was added to colorize tokenized asm strings according to their token types.
353 B
353 B
NAME=tbz
FILE=bins/other/tbz.arm64
ARGS=-a arm -b64 -m 0x100000000
CMDS=pi 4
EXPECT=<<EOF
tbz x0, 0x20, 0x100004000
tbz x0, 0x20, 0xffff8004
tbnz x0, 0x20, 0x100004008
tbnz x0, 0x20, 0xffff800c
EOF
RUN
NAME=color pi
FILE=bins/elf/analysis/x64-loop
CMDS=e scr.color=1 ; pi 1
EXPECT=<<EOF
xor ebp, ebp
EOF
RUN
FILE=bins/other/tbz.arm64
ARGS=-a arm -b64 -m 0x100000000
CMDS=pi 4
EXPECT=<<EOF
tbz x0, 0x20, 0x100004000
tbz x0, 0x20, 0xffff8004
tbnz x0, 0x20, 0x100004008
tbnz x0, 0x20, 0xffff800c
EOF
RUN
NAME=color pi
FILE=bins/elf/analysis/x64-loop
CMDS=e scr.color=1 ; pi 1
EXPECT=<<EOF
xor ebp, ebp
EOF
RUN