Rizin
unix-like reverse engineering framework and cli tools
|
Go to the source code of this file.
Macros | |
#define | NOPTR 0 |
#define | PTRSEEK 1 |
#define | PTRBACK 2 |
#define | NULLPTR 3 |
#define | STRUCTPTR 100 |
#define | NESTEDSTRUCT 1 |
#define | STRUCTFLAG 10000 |
#define | NESTDEPTH 14 |
#define | ARRAYINDEX_COEF 10000 |
#define | MUSTSEE (mode & RZ_PRINT_MUSTSEE && mode & RZ_PRINT_ISFIELD && !(mode & RZ_PRINT_JSON)) |
#define | ISQUIET (mode & RZ_PRINT_QUIET) |
#define | MUSTSET (mode & RZ_PRINT_MUSTSET && mode & RZ_PRINT_ISFIELD && setval) |
#define | SEEVALUE (mode & RZ_PRINT_VALUE) |
#define | MUSTSEEJSON (mode & RZ_PRINT_JSON && mode & RZ_PRINT_ISFIELD) |
#define | MUSTSEESTRUCT (mode & RZ_PRINT_STRUCT) |
#define | THRESHOLD (-4444) |
#define | EXT(T) (sign ? (signed T)(addr) : (unsigned T)(addr)) |
#define | MINUSONE ((void *)(size_t)-1) |
#define | ISSTRUCT (tmp == '?' || (tmp == '*' && *(arg + 1) == '?')) |
#define | ISPOINTED ((slide % STRUCTFLAG) / STRUCTPTR <= (oldslide % STRUCTFLAG) / STRUCTPTR) |
#define | ISNESTED ((slide % STRUCTPTR) <= (oldslide % STRUCTPTR)) |
#define ISPOINTED ((slide % STRUCTFLAG) / STRUCTPTR <= (oldslide % STRUCTFLAG) / STRUCTPTR) |
#define ISSTRUCT (tmp == '?' || (tmp == '*' && *(arg + 1) == '?')) |
|
static |
Definition at line 2795 of file format.c.
References fields, free(), RZ_BASE_TYPE_KIND_ATOMIC, RZ_BASE_TYPE_KIND_ENUM, RZ_BASE_TYPE_KIND_STRUCT, RZ_BASE_TYPE_KIND_TYPEDEF, RZ_BASE_TYPE_KIND_UNION, rz_return_if_fail, rz_strbuf_append(), rz_strbuf_appendf(), rz_type_as_format(), rz_type_db_format_get(), rz_warn_if_reached, type, and type_to_format_pair().
Referenced by base_type_to_format_unfold().
|
static |
Definition at line 2850 of file format.c.
References base_type_to_format_no_unfold(), fields, free(), rz_type_struct_member_t::name, rz_type_union_member_t::name, RZ_BASE_TYPE_KIND_ATOMIC, RZ_BASE_TYPE_KIND_ENUM, RZ_BASE_TYPE_KIND_STRUCT, RZ_BASE_TYPE_KIND_TYPEDEF, RZ_BASE_TYPE_KIND_UNION, rz_return_if_fail, rz_strbuf_append(), rz_strbuf_appendf(), rz_type_as_format(), rz_type_get_base_type(), rz_type_is_atomic(), rz_type_is_identifier(), rz_vector_foreach, rz_warn_if_reached, type, rz_type_struct_member_t::type, rz_type_union_member_t::type, type_to_format_pair(), and type_to_identifier().
Referenced by rz_base_type_as_format(), and type_to_format_pair().
Definition at line 1917 of file format.c.
References k, rz_list_append(), rz_return_val_if_fail, rz_str_newf(), and v.
Referenced by rz_type_db_format_all().
|
static |
Definition at line 1816 of file format.c.
Referenced by rz_type_format_data_internal().
Definition at line 1829 of file format.c.
References NULL, strdup(), and type.
Referenced by rz_type_format_data_internal().
RZ_API RZ_OWN char* rz_base_type_as_format | ( | const RzTypeDB * | typedb, |
RZ_NONNULL RzBaseType * | type | ||
) |
Represents the RzBaseType as a pf
format string.
Produces the pair of of <format> <fields>. If the type is atomic it searches if the type database has predefined format assigned to it and uses it.
typedb | Types Database instance |
type | RzBaseType type |
Definition at line 2941 of file format.c.
References base_type_to_format_unfold(), fields, free(), NULL, rz_return_val_if_fail, rz_str_trim_tail(), rz_strbuf_appendf(), rz_strbuf_drain(), rz_strbuf_new(), and type.
Referenced by rz_type_format().
Definition at line 58 of file format.c.
References addr, int, len, NULL, num, rz_num_math(), s, updateAddr(), and ut64().
Referenced by rz_type_format_data_internal().
|
static |
Definition at line 1394 of file format.c.
References MUSTSEE, MUSTSEEJSON, MUSTSET, rz_reg_item_t::name, outbuf, p, PFMT64d, PFMT64x, RZ_REG_TYPE_ANY, rz_strbuf_appendf(), and SEEVALUE.
Referenced by rz_type_format_data_internal().
Represents the RzType as a pf
format string.
Different from the similar function for the RzBaseType, since the latter shows the pair of <format> <fields>, while this implementation produces only the <format> part.
typedb | Types Database instance |
type | RzType type |
Definition at line 3005 of file format.c.
References NULL, rz_return_val_if_fail, rz_strbuf_drain(), rz_strbuf_new(), rz_type_is_callable_ptr(), rz_type_is_char_ptr(), rz_type_is_void_ptr(), RZ_TYPE_KIND_CALLABLE, strdup(), type, and type_to_format().
Referenced by base_type_to_format_no_unfold(), base_type_to_format_unfold(), rz_core_analysis_var_display(), rz_core_types_link_print(), and set_fcn_args_info().
Represents the RzType as a pf
format string pair.
Different from the similar rz_type_as_format
and similar to the rz_base_type_as_format
since the latter shows the pair of <format> <fields>.
typedb | Types Database instance |
type | RzType type |
Definition at line 3075 of file format.c.
References fields, free(), NULL, rz_return_val_if_fail, rz_str_trim_tail(), rz_strbuf_appendf(), rz_strbuf_drain(), rz_strbuf_free(), rz_strbuf_new(), type, and type_to_format_pair().
Referenced by rz_core_print_disasm().
|
static |
Definition at line 1193 of file format.c.
References RzStrEscOptions::dot_nl, dst, RzStrEscOptions::esc_bslash, p, rz_return_if_fail, rz_str_byte_escape(), RzStrEscOptions::show_asciidot, and src.
Referenced by rz_type_format_nulltermstring().
Definition at line 1925 of file format.c.
References format_collect_cb(), formats, rz_type_db_t::formats, free(), NULL, rz_list_newf(), and rz_return_val_if_fail.
Referenced by cmd_print_format().
Definition at line 1932 of file format.c.
References rz_type_db_t::formats, and rz_return_if_fail.
Referenced by cmd_print_format().
Definition at line 1901 of file format.c.
References rz_type_db_t::formats, found, NULL, and rz_return_val_if_fail.
Referenced by base_type_to_format_no_unfold(), cmd_print_format(), rz_type_format_data_internal(), rz_type_format_struct(), rz_type_format_struct_size(), save_atomic_type(), and type_to_format().
Definition at line 1912 of file format.c.
References rz_type_db_t::formats, rz_return_if_fail, and strdup().
Referenced by cmd_print_format(), and rz_core_bin_export_info().
RZ_API RZ_OWN char* rz_type_format | ( | RZ_NONNULL const RzTypeDB * | typedb, |
RZ_NONNULL const char * | name | ||
) |
Represents the RzBaseType as a pf
format string.
Produces the pair of of <format> <fields>. If the type is atomic it searches if the type database has predefined format assigned to it and uses it.
typedb | Types Database instance |
name | RzBaseType type name |
Definition at line 2965 of file format.c.
References NULL, rz_base_type_as_format(), rz_return_val_if_fail, and rz_type_db_get_base_type().
Referenced by rz_core_types_print_all(), rz_core_types_show_format(), rz_type_format_struct(), rz_type_format_struct_size(), type_format_print(), type_format_print_hexstring(), type_format_print_value(), and type_format_print_variable().
|
static |
Definition at line 901 of file format.c.
References addr, rz_io_bind_t::io, rz_type_db_t::iob, IS_PRINTABLE, ISQUIET, MUSTSEE, MUSTSEEJSON, MUSTSET, outbuf, PFMT64x, rz_io_bind_t::read_at, rz_strbuf_append(), rz_strbuf_appendf(), SEEVALUE, and ut64().
Referenced by rz_type_format_data_internal().
|
static |
Definition at line 1339 of file format.c.
References addr, bitfield, free(), MUSTSEE, MUSTSEEJSON, NULL, outbuf, PFMT64x, rz_strbuf_appendf(), rz_type_db_enum_get_bitfield(), and SEEVALUE.
Referenced by rz_type_format_data_internal().
|
static |
Definition at line 167 of file format.c.
References ARRAYINDEX_COEF, comma, i, ISQUIET, MUSTSEE, MUSTSEEJSON, MUSTSEESTRUCT, MUSTSET, outbuf, PFMT64x, rz_strbuf_append(), rz_strbuf_appendf(), and SEEVALUE.
Referenced by rz_type_format_data_internal().
|
static |
Definition at line 320 of file format.c.
References ARRAYINDEX_COEF, i, IS_PRINTABLE, ISQUIET, MUSTSEE, MUSTSEEJSON, MUSTSEESTRUCT, MUSTSET, outbuf, PFMT64x, rz_strbuf_append(), rz_strbuf_appendf(), and SEEVALUE.
Referenced by rz_type_format_data_internal().
RZ_API RZ_OWN char* rz_type_format_data | ( | const RzTypeDB * | typedb, |
RzPrint * | p, | ||
ut64 | seek, | ||
const ut8 * | b, | ||
const int | len, | ||
const char * | formatname, | ||
int | mode, | ||
const char * | setval, | ||
char * | ofield | ||
) |
Definition at line 2749 of file format.c.
References b, len, outbuf, p, rz_strbuf_drain(), rz_strbuf_new(), rz_type_format_data_internal(), and seek().
Referenced by cmd_print_format(), ds_print_meta_infos(), and rz_core_bin_export_info().
|
static |
Definition at line 1937 of file format.c.
References addr, arg(), args, ARRAYINDEX_COEF, b, rz_type_target_t::big_endian, rz_type_target_t::bits, bytes, calloc(), test_evm::end, eprintf, free(), get_args_offset(), get_format_type(), i, setup::idx, rz_io_bind_t::io, rz_type_db_t::iob, IS_DIGIT, IS_WHITECHAR, ISQUIET, ISSTRUCT, len, memcpy(), memset(), MINUSONE, MUSTSEE, MUSTSEEJSON, MUSTSEESTRUCT, cmd_descs_generate::nargs, NESTEDSTRUCT, NOPTR, NULL, NULLPTR, rz_type_db_t::num, outbuf, p, PFMT64d, PFMT64u, PFMT64x, PTRBACK, PTRSEEK, rz_io_bind_t::read_at, RZ_FREE, rz_get_size(), rz_num_math(), rz_print_format_register(), rz_str_newf(), rz_str_rchr(), rz_str_word_get0(), rz_str_word_set0_stack(), rz_strbuf_append(), rz_strbuf_appendf(), rz_type_db_format_get(), rz_type_format_10bytes(), rz_type_format_bitfield(), rz_type_format_byte(), rz_type_format_char(), rz_type_format_decchar(), rz_type_format_double(), rz_type_format_enum(), rz_type_format_float(), rz_type_format_hex(), rz_type_format_hexflag(), rz_type_format_hexpairs(), rz_type_format_int(), rz_type_format_nulltermstring(), rz_type_format_nulltermwidestring(), rz_type_format_num(), rz_type_format_octal(), rz_type_format_quadword(), rz_type_format_string(), rz_type_format_struct(), rz_type_format_struct_size(), rz_type_format_time(), rz_type_format_u128(), rz_type_format_uleb(), rz_type_format_word(), rz_wstr_clen(), s, seek(), SEEVALUE, snprintf, strdup(), STRUCTFLAG, STRUCTPTR, rz_type_db_t::target, THRESHOLD, times, autogen_x86imm::tmp, type, updateAddr(), and ut64().
Referenced by rz_type_format_data(), and rz_type_format_struct().
|
static |
Definition at line 386 of file format.c.
References ARRAYINDEX_COEF, i, ISQUIET, MUSTSEE, MUSTSEEJSON, MUSTSEESTRUCT, MUSTSET, outbuf, PFMT64x, rz_strbuf_append(), rz_strbuf_appendf(), and SEEVALUE.
Referenced by rz_type_format_data_internal().
|
static |
Definition at line 1048 of file format.c.
References addr, ARRAYINDEX_COEF, i, ISQUIET, MUSTSEE, MUSTSEEJSON, MUSTSEESTRUCT, MUSTSET, NULL, outbuf, PFMT64x, rz_mem_swaporcopy(), rz_strbuf_append(), rz_strbuf_appendf(), SEEVALUE, updateAddr(), and ut64().
Referenced by rz_type_format_data_internal().
|
static |
Definition at line 1364 of file format.c.
References addr, MUSTSEE, MUSTSEEJSON, MUSTSEESTRUCT, NULL, outbuf, PFMT64d, PFMT64x, rz_strbuf_appendf(), rz_type_db_enum_member_by_val(), and SEEVALUE.
Referenced by rz_type_format_data_internal().
|
static |
Definition at line 994 of file format.c.
References addr, ARRAYINDEX_COEF, i, ISQUIET, MUSTSEE, MUSTSEEJSON, MUSTSEESTRUCT, MUSTSET, NULL, outbuf, PFMT64x, rz_strbuf_append(), rz_strbuf_appendf(), SEEVALUE, updateAddr(), and ut64().
Referenced by rz_type_format_data_internal().
|
static |
Definition at line 583 of file format.c.
References addr, ARRAYINDEX_COEF, i, ISQUIET, MUSTSEE, MUSTSEEJSON, MUSTSEESTRUCT, MUSTSET, NULL, outbuf, PFMT64d, PFMT64x, rz_strbuf_append(), rz_strbuf_appendf(), SEEVALUE, updateAddr(), UT32_MAX, ut64(), and UT64_MAX.
Referenced by rz_type_format_data_internal().
|
static |
Definition at line 826 of file format.c.
References addr, ARRAYINDEX_COEF, i, ISQUIET, MUSTSEE, MUSTSEEJSON, MUSTSEESTRUCT, MUSTSET, NULL, outbuf, PFMT64d, PFMT64x, rz_strbuf_append(), rz_strbuf_appendf(), SEEVALUE, updateAddr(), UT32_MAX, and ut64().
Referenced by rz_type_format_data_internal().
|
static |
Definition at line 947 of file format.c.
References i, IS_PRINTABLE, ISQUIET, MUSTSEE, MUSTSEEJSON, MUSTSEESTRUCT, MUSTSET, outbuf, PFMT64x, rz_strbuf_append(), rz_strbuf_appendf(), and SEEVALUE.
Referenced by rz_type_format_data_internal().
|
static |
Definition at line 665 of file format.c.
References addr, ARRAYINDEX_COEF, i, ISQUIET, MUSTSEE, MUSTSEEJSON, MUSTSEESTRUCT, MUSTSET, NULL, outbuf, PFMT64d, PFMT64x, rz_strbuf_append(), rz_strbuf_appendf(), SEEVALUE, st32, st64, updateAddr(), and ut64().
Referenced by rz_type_format_data_internal().
|
static |
Definition at line 1202 of file format.c.
References addr, buflen, rz_io_t::cached, eprintf, free(), i, rz_io_bind_t::io, rz_type_db_t::iob, IS_PRINTABLE, rz_io_bind_t::is_valid_offset, ISQUIET, len, map(), rz_io_bind_t::map_get, rz_io_bind_t::map_get_paddr, MUSTSEE, MUSTSEEJSON, MUSTSEESTRUCT, MUSTSET, NULL, outbuf, p, PFMT64x, rz_io_bind_t::read_at, RZ_MIN, RZ_PERM_R, RZ_PRINT_FLAGS_UNALLOC, rz_str_escape_utf8_for_json(), rz_str_nlen(), rz_strbuf_append(), rz_strbuf_appendf(), rz_type_byte_escape(), SEEVALUE, strdup(), ut64(), UT64_MAX, and rz_io_t::va.
Referenced by rz_type_format_data_internal().
|
static |
Definition at line 1297 of file format.c.
References eprintf, free(), i, IS_PRINTABLE, ISQUIET, len, MUSTSEE, MUSTSEEJSON, MUSTSET, outbuf, PFMT64d, PFMT64x, rz_strbuf_append(), rz_strbuf_appendf(), rz_wstr_clen(), SEEVALUE, and strdup().
Referenced by rz_type_format_data_internal().
|
static |
Definition at line 1433 of file format.c.
References addr, ARRAYINDEX_COEF, bytes, i, ISQUIET, MUSTSEE, MUSTSEEJSON, MUSTSEESTRUCT, MUSTSET, NULL, outbuf, PFMT64x, rz_strbuf_append(), rz_strbuf_appendf(), rz_type_format_num_specifier(), SEEVALUE, updateAddr(), and ut64().
Referenced by rz_type_format_data_internal().
|
static |
Definition at line 1417 of file format.c.
References addr, bytes, EXT, outbuf, PFMT64d, PFMT64u, and rz_strbuf_appendf().
Referenced by rz_type_format_num().
|
static |
Definition at line 753 of file format.c.
References addr, ARRAYINDEX_COEF, i, ISQUIET, MUSTSEE, MUSTSEEJSON, MUSTSEESTRUCT, MUSTSET, NULL, outbuf, PFMT64d, PFMT64o, PFMT64x, rz_strbuf_append(), rz_strbuf_appendf(), SEEVALUE, updateAddr(), and ut64().
Referenced by rz_type_format_data_internal().
|
static |
Definition at line 92 of file format.c.
References ARRAYINDEX_COEF, i, ISQUIET, MUSTSEE, MUSTSEEJSON, MUSTSEESTRUCT, MUSTSET, NULL, outbuf, PFMT64d, PFMT64x, rz_strbuf_append(), rz_strbuf_appendf(), SEEVALUE, st64, updateAddr(), UT32_MAX, and ut64().
Referenced by rz_type_format_data_internal().
|
static |
Definition at line 452 of file format.c.
References addr, free(), rz_io_bind_t::io, rz_type_db_t::iob, ISQUIET, MUSTSEE, MUSTSEEJSON, MUSTSEESTRUCT, outbuf, PFMT64d, PFMT64x, rz_io_bind_t::read_at, rz_str_utf16_encode(), rz_strbuf_append(), rz_strbuf_appendf(), SEEVALUE, UT32_MAX, ut64(), and UT64_MAX.
Referenced by rz_type_format_data_internal().
|
static |
Definition at line 1775 of file format.c.
References b, eprintf, free(), len, MUSTSEE, NESTDEPTH, outbuf, p, RZ_STR_ISEMPTY, rz_strbuf_appendf(), rz_type_db_format_get(), rz_type_format(), rz_type_format_data_internal(), rz_type_format_struct_size(), seek(), SEEVALUE, snprintf, strdup(), STRUCTFLAG, and STRUCTPTR.
Referenced by rz_type_format_data_internal().
Definition at line 1515 of file format.c.
References args, rz_type_target_t::bits, test_evm::end, f, free(), i, setup::idx, n, NULL, RZ_LOG_ERROR, rz_num_math(), rz_str_rchr(), rz_str_word_get0(), rz_str_word_set0_stack(), rz_type_db_format_get(), rz_type_format(), strdup(), rz_type_db_t::target, times, and autogen_x86imm::tmp.
Referenced by cmd_print_format(), rz_core_bin_export_info(), rz_type_format_data_internal(), and rz_type_format_struct().
|
static |
Definition at line 493 of file format.c.
References addr, ARRAYINDEX_COEF, ASCTIME_BUF_MINLEN, free(), i, ISQUIET, malloc(), MUSTSEE, MUSTSEEJSON, MUSTSEESTRUCT, MUSTSET, NULL, outbuf, PFMT64x, rz_asctime_r(), rz_gmtime_r(), rz_strbuf_append(), rz_strbuf_appendf(), SEEVALUE, updateAddr(), and ut64().
Referenced by rz_type_format_data_internal().
|
static |
Definition at line 70 of file format.c.
References test_evm::end, ISQUIET, MUSTSEEJSON, outbuf, PFMT64x, rz_read_ble64(), rz_strbuf_append(), rz_strbuf_appendf(), SEEVALUE, and ut64().
Referenced by rz_type_format_data_internal().
|
static |
Definition at line 234 of file format.c.
References ARRAYINDEX_COEF, free(), i, ISQUIET, MUSTSEE, MUSTSEEJSON, MUSTSEESTRUCT, MUSTSET, NULL, outbuf, PFMT64d, PFMT64x, rz_hex_bin2strdup(), rz_num_math(), rz_strbuf_append(), rz_strbuf_appendf(), rz_uleb128_decode(), rz_uleb128_encode(), s, SEEVALUE, autogen_x86imm::tmp, ut64(), and value.
Referenced by rz_type_format_data_internal().
|
static |
Definition at line 1105 of file format.c.
References addr, ARRAYINDEX_COEF, i, ISQUIET, MUSTSEE, MUSTSEEJSON, MUSTSEESTRUCT, MUSTSET, outbuf, PFMT64d, PFMT64x, rz_read_ble16(), rz_strbuf_append(), rz_strbuf_appendf(), SEEVALUE, and ut64().
Referenced by rz_type_format_data_internal().
Definition at line 2974 of file format.c.
References PFMT64d, rz_strbuf_append(), rz_strbuf_appendf(), rz_type_db_format_get(), RZ_TYPE_IDENTIFIER_KIND_ENUM, RZ_TYPE_IDENTIFIER_KIND_STRUCT, RZ_TYPE_KIND_ARRAY, RZ_TYPE_KIND_IDENTIFIER, RZ_TYPE_KIND_POINTER, and type.
Referenced by rz_type_as_format().
|
static |
Definition at line 3025 of file format.c.
References base_type_to_format_unfold(), fields, PFMT64d, rz_return_val_if_fail, rz_strbuf_append(), rz_strbuf_appendf(), rz_type_db_get_base_type(), rz_type_identifier(), rz_type_is_callable_ptr_nested(), RZ_TYPE_KIND_ARRAY, RZ_TYPE_KIND_CALLABLE, RZ_TYPE_KIND_IDENTIFIER, RZ_TYPE_KIND_POINTER, and type.
Referenced by base_type_to_format_no_unfold(), base_type_to_format_unfold(), and rz_type_as_format_pair().
Definition at line 2778 of file format.c.
References NULL, RZ_TYPE_KIND_ARRAY, RZ_TYPE_KIND_CALLABLE, RZ_TYPE_KIND_IDENTIFIER, RZ_TYPE_KIND_POINTER, rz_warn_if_reached, and type.
Referenced by base_type_to_format_unfold().
Definition at line 33 of file format.c.
References addr, f, len, rz_mem_swaporcopy(), rz_read_ble32(), rz_read_ble64(), THRESHOLD, and ut64().
Referenced by rz_get_size(), rz_type_format_data_internal(), rz_type_format_double(), rz_type_format_float(), rz_type_format_hex(), rz_type_format_hexflag(), rz_type_format_int(), rz_type_format_num(), rz_type_format_octal(), rz_type_format_quadword(), and rz_type_format_time().