Rizin
unix-like reverse engineering framework and cli tools
|
Go to the source code of this file.
Classes | |
struct | RzPseudoGrammar |
struct | RzPseudoDirect |
struct | RzPseudoReplace |
struct | RzPseudoConfig |
Macros | |
#define | RZ_PSEUDO_DEFINE_GRAMMAR(x, y) { .mnemonic = x, .mnemonic_length = sizeof(x) - 1, .grammar = y } |
#define | RZ_PSEUDO_DEFINE_DIRECT(x, y) { .expected = x, .pseudo = y } |
#define | RZ_PSEUDO_DEFINE_REPLACE(x, y, f) { .expected = x, .replace = y, .flag = f } |
#define | RZ_PSEUDO_DEFINE_CONFIG(d, l, r, m, t) |
#define | RZ_PSEUDO_DEFINE_CONFIG_NO_DIRECT(l, r, m, t) |
#define | RZ_PSEUDO_DEFINE_CONFIG_ONLY_LEXICON(l, m, t) |
Functions | |
static bool | rz_pseudo_convert (const RzPseudoConfig *config, const char *assembly, RzStrBuf *sb) |
This file contains a common code that can be used to convert any asm code into a pseudo code, via a generic grammar.
The grammar is quite simple; Let's take a simple example
Let's take the following assembly ; intel x86 asm ; rax = rax + 10 add rax, 10
The associated grammar will be "1 += 2" the number 1 will be changed to "rax" and 2 with "10"
another example:
; mips asm ; t0 = 4097 << 16 lui t0, 4097
The associated grammar will be "1 = 2 << #16" to notice the #
symbol. The #
symbol is used to ignore any set of chars after this till next whitespace/end of the line
the developer has to provide a tokenize method to split the assembly in various token strings and
Definition in file parse_common.c.
Definition at line 67 of file parse_common.c.
#define RZ_PSEUDO_DEFINE_CONFIG_NO_DIRECT | ( | l, | |
r, | |||
m, | |||
t | |||
) |
Definition at line 79 of file parse_common.c.
#define RZ_PSEUDO_DEFINE_CONFIG_ONLY_LEXICON | ( | l, | |
m, | |||
t | |||
) |
Definition at line 91 of file parse_common.c.
Definition at line 61 of file parse_common.c.
#define RZ_PSEUDO_DEFINE_GRAMMAR | ( | x, | |
y | |||
) | { .mnemonic = x, .mnemonic_length = sizeof(x) - 1, .grammar = y } |
Definition at line 58 of file parse_common.c.
Definition at line 64 of file parse_common.c.
|
static |
Definition at line 103 of file parse_common.c.
References free(), RzPseudoGrammar::grammar, i, IS_WHITESPACE, length, RzPseudoGrammar::mnemonic, RzPseudoGrammar::mnemonic_length, NULL, p, rp, rz_list_free(), rz_list_get_n(), rz_return_val_if_fail, rz_str_replace(), rz_strbuf_append(), rz_strbuf_append_n(), rz_strbuf_drain_nofree(), rz_strbuf_set(), rz_strbuf_setf(), sb, and autogen_x86imm::tmp.
Referenced by parse().