Rizin
unix-like reverse engineering framework and cli tools
|
#include "rz_util/rz_print.h"
#include <rz_vector.h>
#include <rz_util/rz_strbuf.h>
#include <rz_regex.h>
#include <rz_util/rz_assert.h>
#include <rz_list.h>
#include <stdio.h>
#include <rz_core.h>
#include <rz_types.h>
#include <rz_util.h>
#include <rz_asm.h>
#include <spp.h>
#include <config.h>
Go to the source code of this file.
Macros | |
#define | USE_R2 1 |
#define | isavrseparator(x) |
#define | STAGES 5 |
Typedefs | |
typedef int(* | Ase) (RzAsm *a, RzAsmOp *op, const char *buf) |
Variables | |
static char * | directives [] |
static RzAsmPlugin * | asm_static_plugins [] = { RZ_ASM_STATIC_PLUGINS } |
#define isavrseparator | ( | x | ) |
#define STAGES 5 |
|
static |
Definition at line 810 of file asm.c.
Referenced by rz_asm_massemble().
|
static |
Definition at line 538 of file asm.c.
References rz_strbuf_get().
Referenced by rz_asm_disassemble().
|
static |
Creates a token and adds it to the token string vector toks
.
toks | The token string to which the token is added. |
i | The start index if the token. |
l | The length of the token. |
type | The type of the token. |
token_val | The token value if it was a number otherwise should be 0. |
Definition at line 1381 of file asm.c.
References asm_token_create(), i, RZ_LOG_WARN, rz_return_if_fail, rz_vector_push(), rz_warn_if_reached, and type.
Referenced by rz_asm_tokenize_asm_regex(), and tokenize_asm_generic().
|
static |
Creates a token and returns it.
start | Index in the asm string of the token. |
len | The length in bytes of the token. |
type | The token type. |
val | The value of the token (should be 0 if token has no value). |
Definition at line 1352 of file asm.c.
References len, RzAsmToken::len, NULL, RzAsmToken::number, RZ_ASM_TOKEN_NUMBER, RZ_NEW0, rz_return_val_if_fail, RzAsmToken::start, start, type, RzAsmToken::type, val, and RzAsmToken::val.
Referenced by add_token().
|
static |
Definition at line 612 of file asm.c.
References a, h, and has_bits().
Referenced by findAssembler().
|
static |
Definition at line 1426 of file asm.c.
References error(), i, RzAsmToken::len, NULL, PFMT32d, RZ_LOG_WARN, rz_return_if_fail, rz_strbuf_get(), rz_vector_foreach, rz_vector_len(), RzAsmToken::start, RzAsmTokenString::str, and RzAsmTokenString::tokens.
Referenced by rz_asm_tokenize_asm_regex().
|
static |
Definition at line 1416 of file asm.c.
References a, b, and rz_return_val_if_fail.
Referenced by rz_asm_tokenize_asm_regex().
Definition at line 619 of file asm.c.
References a, assemblerMatches(), h, and NULL.
Referenced by rz_asm_assemble().
|
static |
Checks if the first character of c
is an alphanumeric character OR if it is a hex prefix.
c | The character string. |
Definition at line 45 of file asm.c.
References c, is_num(), isalpha, and rz_return_val_if_fail.
Referenced by seek_to_end_of_token(), and tokenize_asm_generic().
Checks if the first character of c
is a digit character OR if the first two chars are a hex prefix.
c | The character string. |
Definition at line 30 of file asm.c.
References c, isxdigit, rz_num_is_hex_prefix(), and rz_return_val_if_fail.
Referenced by is_alpha_num(), rz_asm_tokenize_asm_regex(), and seek_to_end_of_token().
Definition at line 71 of file asm.c.
References found, i, RZ_REG_TYPE_LAST, and rz_return_val_if_fail.
Referenced by tokenize_asm_generic().
|
static |
Checks if indicies s, e overlap with other tokens start/end.
toks | Tokens to compare to. |
s | Start index of token into asm string. |
e | End index of token into asm string (points to last char of token). |
Definition at line 1402 of file asm.c.
References e, RzAsmToken::len, rz_return_val_if_fail, rz_vector_foreach, s, RzAsmToken::start, and x.
Referenced by rz_asm_tokenize_asm_regex().
Definition at line 97 of file asm.c.
References free(), out, p, rz_parse_pseudocode(), rz_strbuf_get(), rz_strbuf_set(), and s.
Referenced by rz_asm_disassemble(), and rz_asm_mdisassemble().
|
static |
Definition at line 256 of file asm.c.
References a, and RZ_LOG_ERROR.
Referenced by rz_asm_free(), and rz_asm_use().
|
static |
Definition at line 676 of file asm.c.
References directives, i, replace_directives_for(), and cmd_descs_generate::str.
Referenced by rz_asm_rasm_assemble().
|
static |
Definition at line 640 of file asm.c.
References _, free(), NULL, p, rz_strbuf_append(), rz_strbuf_appendf(), rz_strbuf_drain(), rz_strbuf_free(), rz_strbuf_new(), sb, and cmd_descs_generate::str.
Referenced by replace_directives().
RZ_API bool rz_asm_add | ( | RzAsm * | a, |
RzAsmPlugin * | p | ||
) |
Definition at line 333 of file asm.c.
References a, p, rz_asm_is_valid(), and rz_list_append().
Referenced by __lib_asm_cb(), and rz_asm_new().
Definition at line 697 of file asm.c.
References a, b, findAssembler(), free(), memset(), NULL, rz_asm_op_set_asm(), rz_asm_op_set_buf(), rz_parse_pseudocode(), rz_return_val_if_fail, rz_str_case(), rz_strbuf_get(), strdup(), and autogen_x86imm::tmp.
Referenced by rz_asm_massemble().
RZ_DEPRECATE RZ_API RZ_OWN RzStrBuf* rz_asm_colorize_asm_str | ( | RZ_BORROW RzStrBuf * | asm_str, |
RZ_BORROW RzPrint * | p, | ||
RZ_NULLABLE const RzAsmParseParam * | param, | ||
RZ_NULLABLE const RzAsmTokenString * | toks | ||
) |
Colors a given asm string and returns it. If toks
is not NULL it uses the tokens to color the asm string accordingly. If toks
is NULL it parses the asm string generically into tokens and colorizes it afterwards. param
can be set to alter the generic parsing method.
DEPRECATED: This is only a helper method until all plugins set RzAsmOp.asm_toks. Please check if this is already the case before using this function. If you want to implement the token parsing of the asm string take a look at the Hexagon plugin for an example.
asm_str | The plain asm string. |
p | The RzPrint object which holds the color palette to use. |
param | Parsing parameter for the generic parsing method (can be NULL). |
toks | Already present token string for asm_str (can be NULL). |
Definition at line 1741 of file asm.c.
References RzAsmTokenString::op_type, p, rz_asm_token_string_free(), rz_asm_tokenize_asm_string(), and rz_print_colorize_asm_str().
Referenced by ds_build_op_str(), print_rop(), rz_cmd_disassembly_all_possible_opcodes_handler(), rz_cmd_disassembly_all_possible_opcodes_treeview_handler(), rz_core_disasm_instruction(), rz_core_disasm_pdi_with_buf(), rz_core_print_disasm_all(), rz_core_visual_bit_editor(), and rz_core_visual_esil().
Definition at line 1187 of file asm.c.
References a, NULL, sdb_get(), and cmd_descs_generate::str.
Referenced by core_analysis_bytes_desc(), ds_print_comments_right(), ds_show_comments_describe(), rz_analyze_opcode_handler(), rz_core_analysis_bytes(), rz_list_mne_handler(), and rz_main_rz_asm().
Definition at line 543 of file asm.c.
References __isInvalid(), a, b, calloc(), count, free(), len, mod(), parseHeap(), rz_asm_op_init(), rz_asm_op_set_asm(), rz_asm_op_set_buf(), RZ_MAX, rz_mem_copybits_delta(), RZ_MIN, rz_read_le16(), rz_read_le32(), rz_return_val_if_fail, rz_strbuf_set(), sdb_fmt(), and autogen_x86imm::tmp.
Referenced by __core_cmd_search_asm_byteswap(), __fix_cursor_down(), construct_rop_gadget(), core_analysis_bytes_desc(), cursor_nextrow(), cursor_prevrow(), do_ref_search(), ds_disassemble(), fix_cursor(), handle_forward_disassemble(), print_rop(), rasm_disasm(), rz_analysis_xrefs_from_list_handler(), rz_asm_mdisassemble(), rz_cmd_disassembly_all_possible_opcodes_handler(), rz_cmd_disassembly_all_possible_opcodes_treeview_handler(), rz_cmd_print(), rz_cmd_sizes_of_n_instructions_handler(), rz_core_analysis_bytes(), rz_core_analysis_hasrefs_to_depth(), rz_core_analysis_op(), rz_core_asm_back_disassemble(), rz_core_asm_back_disassemble_all(), rz_core_asm_bwdisassemble(), rz_core_asm_strsearch(), rz_core_cmp_disasm(), rz_core_disasm_instruction(), rz_core_disasm_pdi_with_buf(), rz_core_op_str(), rz_core_print_disasm(), rz_core_print_disasm_all(), rz_core_print_disasm_instructions_with_buf(), rz_core_search_rop(), rz_core_seek_opcode_backward(), rz_core_visual_bit_editor(), rz_core_visual_cmd(), rz_core_visual_disasm_down(), rz_core_visual_esil(), setprintmode(), and step_until_inst().
Definition at line 315 of file asm.c.
References a, free(), NULL, plugin_fini(), rz_list_free(), rz_syscall_free(), and sdb_free().
Referenced by __as_free(), rz_core_fini(), and rz_egg_free().
Definition at line 1213 of file asm.c.
References a, addr, b, NULL, rz_asm_code_free(), rz_asm_massemble(), and rz_asm_set_pc().
RZ_API RZ_OWN RzAsmParseParam* rz_asm_get_parse_param | ( | RZ_NULLABLE const RzReg * | reg, |
ut32 | ana_op_type | ||
) |
Does all kinds of NULL checks on the parameters and returns an initialized RzAsmParseParam or NULL on failure.
reg | The RzReg which holds the reg_set. |
Definition at line 1763 of file asm.c.
References RzAsmParseParam::ana_op_type, NULL, reg, RzAsmParseParam::reg_sets, and RZ_NEW.
Referenced by ds_build_op_str(), print_rop(), rz_cmd_disassembly_all_possible_opcodes_handler(), rz_cmd_disassembly_all_possible_opcodes_treeview_handler(), rz_core_disasm_instruction(), rz_core_disasm_pdi_with_buf(), rz_core_print_disasm_all(), rz_core_visual_bit_editor(), and rz_core_visual_esil().
RZ_API void rz_asm_list_directives | ( | void | ) |
Definition at line 687 of file asm.c.
References directives, i, and printf().
Referenced by rasm_show_help().
Definition at line 814 of file asm.c.
References __dup_val(), __flag_free_kv(), a, rz_asm_code_t::assembly, rz_asm_code_t::bytes, calloc(), rz_asm_code_t::code_align, rz_asm_code_t::code_offset, rz_asm_code_t::data_offset, rz_asm_code_t::equs, fail, free(), i, setup::idx, IS_SEPARATOR, isavrseparator, isspace, rz_asm_code_t::len, malloc(), memcpy(), memset(), NULL, num, off, p, pc, PFMT64x, realloc(), rz_asm_assemble(), rz_asm_code_equ_replace(), rz_asm_code_free(), rz_asm_code_new(), rz_asm_code_set_equ(), rz_asm_op_fini(), rz_asm_op_init(), rz_asm_op_set_hex(), rz_asm_pseudo_align(), rz_asm_pseudo_arch(), rz_asm_pseudo_bits(), rz_asm_pseudo_byte(), rz_asm_pseudo_fill(), rz_asm_pseudo_incbin(), rz_asm_pseudo_int16(), rz_asm_pseudo_int32(), rz_asm_pseudo_int64(), rz_asm_pseudo_org(), rz_asm_pseudo_string(), rz_asm_set_big_endian(), rz_asm_set_bits(), rz_asm_set_cpu(), rz_asm_set_pc(), RZ_ASM_SYNTAX_ATT, RZ_ASM_SYNTAX_INTEL, rz_asm_use(), RZ_BETWEEN, rz_buf_free(), rz_buf_size(), rz_buf_to_string(), rz_hex_str2bin(), RZ_LOG_DEBUG, RZ_LOG_ERROR, rz_str_closer_chr(), rz_str_ncpy(), rz_str_newf(), rz_str_replace(), rz_str_replace_char(), rz_str_startswith(), rz_str_trim(), rz_strbuf_get(), rz_strbuf_length(), rz_syscall_get_num(), rz_syscall_setup(), snprintf, sp, STAGES, cmd_descs_generate::str, strdup(), ut64(), and val.
Referenced by readline_callback(), rz_asm_from_string(), rz_asm_rasm_assemble(), rz_cmd_debug(), rz_core_asm_search(), rz_core_esil_of_assembly(), rz_core_hex_of_assembly(), rz_core_write_assembly(), rz_core_write_assembly_fill(), and rz_egg_assemble_asm().
Definition at line 743 of file asm.c.
References a, rz_asm_code_t::assembly, rz_asm_code_t::bytes, setup::idx, len, rz_asm_code_t::len, malloc(), memcpy(), NULL, op, parseHeap(), pc, rz_asm_code_free(), rz_asm_code_new(), rz_asm_disassemble(), rz_asm_op_fini(), rz_asm_op_init(), rz_asm_set_pc(), rz_return_val_if_fail, rz_strbuf_append(), rz_strbuf_drain(), rz_strbuf_get(), rz_strbuf_new(), and ut64().
Referenced by rasm_disasm(), rz_asm_mdisassemble_hexstr(), rz_asm_to_string(), rz_core_asm_bwdisassemble(), and rz_core_assembly_of_hex().
Definition at line 783 of file asm.c.
References a, rz_asm_code_t::assembly, free(), len, malloc(), NULL, p, rz_asm_mdisassemble(), rz_hex_str2bin(), rz_parse_pseudocode(), autogen_x86imm::tmp, and ut64().
Definition at line 1247 of file asm.c.
References a, NULL, and rz_return_val_if_fail.
Referenced by rz_convert_mne_handler(), and rz_list_mne_handler().
Definition at line 1255 of file asm.c.
References a, free(), i, n, and rz_return_val_if_fail.
Referenced by rz_convert_mne_handler().
Definition at line 262 of file asm.c.
References a, asm_static_plugins, free(), i, NULL, RZ_ARRAY_SIZE, rz_asm_add(), RZ_ASM_SYNTAX_INTEL, rz_list_newf(), RZ_NEW0, and RZ_SYS_BITS.
Referenced by __as_new(), rz_core_init(), and rz_egg_new().
Definition at line 107 of file asm.c.
References rz_asm_code_t::code_align, input(), NULL, and rz_num_math().
Referenced by rz_asm_massemble().
Definition at line 129 of file asm.c.
References a, input(), rz_asm_use(), and RZ_LOG_ERROR.
Referenced by rz_asm_massemble().
Definition at line 137 of file asm.c.
References a, input(), NULL, rz_asm_set_bits(), RZ_LOG_ERROR, and rz_num_math().
Referenced by rz_asm_massemble().
Definition at line 189 of file asm.c.
References free(), i, input(), int, len, malloc(), NULL, num, rz_asm_op_set_buf(), rz_num_math(), rz_str_replace_char(), rz_str_word_count(), rz_str_word_get0(), and rz_str_word_set0().
Referenced by rz_asm_massemble().
Definition at line 227 of file asm.c.
References count, free(), input(), NULL, rz_buf_free(), rz_buf_new_with_string(), rz_file_slurp(), RZ_LOG_ERROR, rz_num_math(), rz_str_replace_char(), rz_str_word_get0(), rz_str_word_set0(), and skip().
Referenced by rz_asm_massemble().
Definition at line 177 of file asm.c.
References a, input(), and rz_asm_pseudo_intN().
Referenced by rz_asm_massemble().
Definition at line 181 of file asm.c.
References a, input(), and rz_asm_pseudo_intN().
Referenced by rz_asm_massemble().
Definition at line 185 of file asm.c.
References a, input(), and rz_asm_pseudo_intN().
Referenced by rz_asm_massemble().
Definition at line 150 of file asm.c.
References a, i, input(), n, NULL, RZ_LOG_ERROR, rz_num_math(), rz_strbuf_get(), rz_write_ble16(), rz_write_ble32(), rz_write_ble64(), s, st16, st32, and ut64().
Referenced by rz_asm_pseudo_int16(), rz_asm_pseudo_int32(), and rz_asm_pseudo_int64().
Definition at line 145 of file asm.c.
References a, input(), NULL, rz_asm_set_pc(), and rz_num_math().
Referenced by rz_asm_massemble().
Definition at line 112 of file asm.c.
References input(), len, rz_str_unescape(), and rz_strbuf_set().
Referenced by rz_asm_massemble().
Definition at line 1270 of file asm.c.
References a, free(), NULL, out, proc, replace_directives(), rz_asm_massemble(), rz_return_val_if_fail, rz_strbuf_get(), rz_strbuf_init(), rz_strbuf_new(), spp_eval(), spp_proc_set(), and strdup().
Referenced by rasm_asm().
Definition at line 496 of file asm.c.
References a, b, RZ_LOG_DEBUG, rz_return_val_if_fail, RZ_SYS_ENDIAN_BI, RZ_SYS_ENDIAN_BIG, RZ_SYS_ENDIAN_LITTLE, and RZ_SYS_ENDIAN_NONE.
Referenced by cb_asmarch(), cb_bigendian(), rz_asm_massemble(), rz_egg_assemble_asm(), and rz_main_rz_asm().
RZ_DEPRECATE RZ_API int rz_asm_set_bits | ( | RzAsm * | a, |
int | bits | ||
) |
Definition at line 488 of file asm.c.
References a, bits(), and has_bits().
Referenced by __as_set_archbits(), cb_asmbits(), rz_asm_massemble(), rz_asm_pseudo_bits(), rz_asm_set_arch(), rz_asm_setup(), rz_egg_assemble_asm(), and rz_main_rz_asm().
RZ_DEPRECATE RZ_API void rz_asm_set_cpu | ( | RzAsm * | a, |
const char * | cpu | ||
) |
Definition at line 477 of file asm.c.
References a, cpu, free(), NULL, and strdup().
Referenced by cb_asmarch(), cb_asmcpu(), rz_asm_massemble(), rz_asm_use(), and rz_main_rz_asm().
Definition at line 533 of file asm.c.
Referenced by construct_rop_gadget(), core_analysis_bytes_desc(), core_analysis_bytes_esil(), core_analysis_bytes_size(), do_ref_search(), getpcfromstack(), handle_forward_disassemble(), print_rop(), rasm_asm(), rasm_disasm(), readline_callback(), rz_analysis_xrefs_from_list_handler(), rz_asm_from_string(), rz_asm_massemble(), rz_asm_mdisassemble(), rz_asm_pseudo_org(), rz_asm_to_string(), rz_cmd_debug(), rz_cmd_disassembly_all_possible_opcodes_handler(), rz_cmd_disassembly_all_possible_opcodes_treeview_handler(), rz_core_analysis_bytes(), rz_core_analysis_esil(), rz_core_analysis_hasrefs_to_depth(), rz_core_analysis_op(), rz_core_asm_back_disassemble(), rz_core_asm_back_disassemble_all(), rz_core_asm_bwdisassemble(), rz_core_asm_strsearch(), rz_core_assembly_of_hex(), rz_core_cmp_disasm(), rz_core_disasm_instruction(), rz_core_disasm_pdi_with_buf(), rz_core_esil_of_assembly(), rz_core_esil_step(), rz_core_hex_of_assembly(), rz_core_op_str(), rz_core_print_disasm(), rz_core_print_disasm_all(), rz_core_print_disasm_instructions_with_buf(), rz_core_search_rop(), rz_core_visual_disasm_down(), rz_core_write_assembly(), rz_core_write_assembly_fill(), and step_until_inst().
Definition at line 518 of file asm.c.
References a, RZ_ASM_SYNTAX_ATT, RZ_ASM_SYNTAX_INTEL, RZ_ASM_SYNTAX_JZ, RZ_ASM_SYNTAX_MASM, RZ_ASM_SYNTAX_REGNUM, and benchmark::syntax.
Referenced by cb_asmsyntax(), rz_core_print_disasm(), rz_egg_assemble_asm(), and rz_main_rz_asm().
Definition at line 283 of file asm.c.
References a, arch, bits(), rz_asm_set_bits(), rz_asm_use(), and rz_return_val_if_fail.
Definition at line 290 of file asm.c.
References a, f, NULL, rz_parse_free(), rz_parse_new(), rz_parse_use(), and rz_return_val_if_fail.
Referenced by rz_main_rz_asm().
Definition at line 303 of file asm.c.
References a, f, NULL, rz_parse_free(), rz_parse_new(), and rz_parse_use().
Referenced by rz_main_rz_asm().
Definition at line 1227 of file asm.c.
References RZ_ASM_SYNTAX_ATT, RZ_ASM_SYNTAX_INTEL, RZ_ASM_SYNTAX_JZ, RZ_ASM_SYNTAX_MASM, RZ_ASM_SYNTAX_REGNUM, and rz_return_val_if_fail.
Referenced by cb_asmsyntax(), and rz_main_rz_asm().
Definition at line 1200 of file asm.c.
References a, addr, b, NULL, rz_asm_code_free(), rz_asm_mdisassemble(), rz_asm_set_pc(), and rz_return_val_if_fail.
RZ_API void rz_asm_token_pattern_free | ( | void * | p | ) |
Definition at line 1333 of file asm.c.
References free(), p, RzAsmTokenPattern::pattern, RzAsmTokenPattern::regex, and rz_regex_free().
Referenced by get_token_patterns().
RZ_API RZ_OWN RzAsmTokenString* rz_asm_token_string_clone | ( | RZ_OWN RZ_NONNULL RzAsmTokenString * | toks | ) |
Definition at line 1315 of file asm.c.
References free(), NULL, RzAsmTokenString::op_type, RZ_NEW0, rz_return_val_if_fail, rz_strbuf_get(), rz_strbuf_new(), rz_vector_clone(), RzAsmTokenString::str, and RzAsmTokenString::tokens.
RZ_API void rz_asm_token_string_free | ( | RZ_OWN RzAsmTokenString * | toks | ) |
Definition at line 1306 of file asm.c.
References free(), rz_strbuf_free(), and rz_vector_free().
Referenced by rz_asm_colorize_asm_str().
RZ_API RZ_OWN RzAsmTokenString* rz_asm_token_string_new | ( | const char * | asm_str | ) |
Definition at line 1295 of file asm.c.
References NULL, RZ_NEW0, rz_return_val_if_fail, rz_strbuf_new(), rz_vector_new(), and s.
Referenced by rz_asm_tokenize_asm_regex(), and tokenize_asm_generic().
RZ_API RZ_OWN RzAsmTokenString* rz_asm_tokenize_asm_regex | ( | RZ_BORROW RzStrBuf * | asm_str, |
RzPVector * | patterns | ||
) |
Splits an asm string into tokens by using the given regex patterns.
str | The asm string. |
patterns | RzList<RzAsmTokenPattern> with the regex patterns describing each token type. |
Definition at line 1472 of file asm.c.
References add_token(), check_token_coverage(), cmp_tokens(), i, is_num(), regress::m, NULL, overlaps_with_token(), clang-format::patterns, RzAsmTokenPattern::regex, rz_asm_token_string_new(), rz_pvector_foreach, rz_regex_exec(), rz_return_val_if_fail, rz_strbuf_get(), rz_vector_sort(), s, st64, cmd_descs_generate::str, RzAsmTokenString::tokens, and RzAsmTokenPattern::type.
Referenced by hexagon_reverse_opcode().
RZ_DEPRECATE RZ_API RZ_OWN RzAsmTokenString* rz_asm_tokenize_asm_string | ( | RZ_BORROW RzStrBuf * | asm_str, |
RZ_NULLABLE const RzAsmParseParam * | param | ||
) |
Parses an asm string generically. It parses the string like: <mnemmonic> <op>, <op>. Every <op> (which is not a number) is parsed as a register. Unless a register profile is given. In this case <op> is only parsed as register if it occurs in the register profile. Otherwise as UNKNOWN.
DEPRECATED: Please implement your custom parsing method and set RzAsmOp.asm_toks. Check out the Hexagon plugin for an example implementation.
Definition at line 1718 of file asm.c.
References NULL, rz_return_val_if_fail, and tokenize_asm_generic().
Referenced by rz_asm_colorize_asm_str().
Puts an Asm plugin in use and disables the previous one.
a | Current RzAsm struct. |
name | Name of the asm plugin to enable. |
Definition at line 429 of file asm.c.
References a, rz_core_t::config, free(), h, NULL, plugin_fini(), rz_asm_set_cpu(), rz_config_lock(), RZ_LOG_ERROR, rz_path_system(), RZ_SDB_OPCODES, rz_str_newf(), sdb_free(), sdb_new(), set_plugin_configs(), and unset_plugins_config().
Referenced by __as_set_archbits(), cb_asmarch(), rz_asm_massemble(), rz_asm_pseudo_arch(), rz_asm_set_arch(), rz_asm_setup(), rz_core_bin_apply_all_info(), rz_core_init(), rz_egg_assemble_asm(), and rz_main_rz_asm().
RZ_LIB_VERSION | ( | rz_asm | ) |
|
static |
Seeks to the end of the token at str
+ i
and returns the length of it.
str | The asm string. |
i | Index into str where the token starts. |
type | Type of the token. |
Definition at line 1523 of file asm.c.
References i, is_alpha_num(), is_num(), is_operator(), is_separator(), RZ_ASM_TOKEN_MNEMONIC, RZ_ASM_TOKEN_NUMBER, RZ_ASM_TOKEN_OPERATOR, RZ_ASM_TOKEN_REGISTER, RZ_ASM_TOKEN_SEPARATOR, RZ_ASM_TOKEN_UNKNOWN, rz_num_is_hex_prefix(), rz_return_val_if_fail, rz_warn_if_reached, cmd_descs_generate::str, and type.
Referenced by tokenize_asm_generic().
Copies all config nodes in pcfg
to the config in rz_asm
.
rz_asm | Pointer to RzAsm struct. |
pcfg | Pointer to the plugins RzConfig struct. |
Definition at line 386 of file asm.c.
References rz_list_iter_t::data, n, rz_config_add_node(), rz_config_node_clone(), RZ_LOG_WARN, and rz_return_if_fail.
Referenced by rz_asm_use().
|
static |
Parses an asm string into tokens.
param->regsets
must be set if this function is expected to detect register names.
asm_str | The asm string. |
param | Several parameter which alter the parsing. |
Definition at line 1573 of file asm.c.
References add_token(), free(), i, is_alpha_num(), is_number(), is_operator(), is_register(), is_separator(), isalpha, isxdigit, NULL, RZ_ASM_TOKEN_MNEMONIC, RZ_ASM_TOKEN_NUMBER, RZ_ASM_TOKEN_OPERATOR, RZ_ASM_TOKEN_REGISTER, RZ_ASM_TOKEN_SEPARATOR, rz_asm_token_string_new(), RZ_ASM_TOKEN_UNKNOWN, rz_num_is_hex_prefix(), rz_return_val_if_fail, rz_str_ndup(), rz_strbuf_get(), rz_strbuf_is_empty(), seek_to_end_of_token(), and cmd_descs_generate::str.
Referenced by rz_asm_tokenize_asm_string().
Deletes all copies of pcfg
nodes in the RzConfig from rz_asm
.
rz_asm | Pointer to RzAsm struct. |
pcfg | Pointer to the plugins RzConfig struct. |
Definition at line 406 of file asm.c.
References rz_list_iter_t::data, n, rz_config_rm(), RZ_LOG_WARN, and rz_return_if_fail.
Referenced by rz_asm_use().
|
static |
Definition at line 95 of file asm.c.
Referenced by rz_asm_new().
|
static |
Definition at line 89 of file asm.c.
Referenced by replace_directives(), and rz_asm_list_directives().