Rizin
unix-like reverse engineering framework and cli tools
|
#include <ctype.h>
#include <rz_util/rz_str.h>
#include <rz_list.h>
#include <rz_regex.h>
#include <rz_types.h>
#include <rz_util/rz_assert.h>
#include <rz_util/rz_log.h>
#include <rz_util/rz_strbuf.h>
#include <rz_vector.h>
#include <rz_util/rz_print.h>
#include <rz_analysis.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
Go to the source code of this file.
Macros | |
#define | DFLT_ROWS 16 |
#define | P(x) (p->cons && p->cons->context->pal.x) ? p->cons->context->pal.x |
#define | memcat(x, y) |
#define | P(x) (p->cons && p->cons->context->pal.x) ? p->cons->context->pal.x |
#define | Pal(x, y) (x->cons && x->cons->context->pal.y) ? x->cons->context->pal.y |
#define | PREOFF(x) (p && p->cons && p->cons->context && p->cons->context->pal.x) ? p->cons->context->pal.x |
#define | BD(a, b) getbytediff(p, fmt, (a)[i + j], (b)[i + j]) |
#define | CD(a, b) getchardiff(p, fmt, (a)[i + j], (b)[i + j]) |
#define | INC 5 |
Variables | |
static const char | hex [16] = "0123456789ABCDEF" |
static RzPrintIsInterruptedCallback | is_interrupted_cb = NULL |
static char | colorbuffer [64] |
static RzPrint | staticp |
#define INC 5 |
#define memcat | ( | x, | |
y | |||
) |
#define PREOFF | ( | x | ) | (p && p->cons && p->cons->context && p->cons->context->pal.x) ? p->cons->context->pal.x |
Definition at line 1133 of file print.c.
References a, b, Color_RESET, IS_PRINTABLE, p, and sprintf.
Definition at line 403 of file print.c.
References a, addr, Color_GREEN, Color_RESET, mod(), p, PFMT64d, PFMT64x, PREOFF, RZ_MAX, RZ_PRINT_FLAGS_ADDRDEC, RZ_PRINT_FLAGS_ADDRMOD, RZ_PRINT_FLAGS_COLOR, RZ_PRINT_FLAGS_COMPACT, RZ_PRINT_FLAGS_RAINBOW, RZ_PRINT_FLAGS_SEGOFF, rz_str_pad(), rz_strbuf_appendf(), s, sb, snprintf, ut64(), UT64_MAX, and w.
Referenced by rz_print_addr(), and rz_print_hexdump_str().
|
inlinestatic |
Definition at line 531 of file print.c.
References Color_RESET, setup::idx, IS_PRINTABLE, p, print_cursor_l(), print_cursor_r(), rz_print_byte_color(), RZ_PRINT_FLAGS_COLOR, rz_strbuf_append(), rz_strbuf_appendf(), and sb.
Referenced by rz_print_byte(), and rz_print_hexdump_str().
Definition at line 519 of file print.c.
References len, p, rz_print_have_cursor(), rz_strbuf_append(), and sb.
Referenced by print_byte(), rz_print_hexdiff_str(), and rz_print_hexdump_str().
Definition at line 525 of file print.c.
References len, p, rz_print_have_cursor(), rz_strbuf_append(), and sb.
Referenced by print_byte(), rz_print_hexdiff_str(), and rz_print_hexdump_str().
Definition at line 499 of file print.c.
References p, RZ_PRINT_FLAGS_SECTION, rz_strbuf_appendf(), s, and sb.
Referenced by rz_print_hexdump_str(), and rz_print_section_str().
Definition at line 1313 of file print.c.
References rz_cons_printable_palette_t::call, rz_cons_printable_palette_t::cjmp, Color_RESET, setup::idx, int, rz_cons_printable_palette_t::jmp, k, rz_cons_printable_palette_t::mov, rz_cons_printable_palette_t::nop, p, RUNE_LONG_LINE_HORIZ, RZ_PRINT_FLAGS_COLOR, cmd_descs_generate::str, and UTF_BLOCK.
Referenced by rz_print_fill().
Definition at line 489 of file print.c.
References addr, free(), p, print_addr(), rz_return_if_fail, rz_strbuf_drain_nofree(), rz_strbuf_init(), s, and sb.
Referenced by cmd_prc(), and rz_print_hexdump_emoji_handler().
Definition at line 552 of file print.c.
References free(), setup::idx, p, print_byte(), rz_return_if_fail, rz_strbuf_drain_nofree(), rz_strbuf_init(), s, and sb.
Referenced by rz_print_hexdump_emoji_handler().
Definition at line 269 of file print.c.
References Color_GREEN, Color_MAGENTA, Color_RED, Color_WHITE, Color_YELLOW, colorbuffer, IS_PRINTABLE, NULL, P, p, RZ_PRINT_FLAGS_COLOR, RZ_PRINT_FLAGS_NONHEX, RZ_PRINT_FLAGS_RAINBOW, and snprintf.
Referenced by annotated_hexdump(), and print_byte().
Definition at line 1233 of file print.c.
References i, len, p, printf(), and rz_return_if_fail.
Referenced by rz_cmd_print(), and rz_print_hexdump_hexpair_bytes_handler().
RZ_API const char* rz_print_color_op_type | ( | RZ_NONNULL RzPrint * | p, |
ut32 | analysis_type | ||
) |
Definition at line 1435 of file print.c.
References rz_cons_printable_palette_t::bin, rz_cons_printable_palette_t::call, rz_cons_printable_palette_t::cjmp, rz_cons_printable_palette_t::cmp, rz_cons_printable_palette_t::crypto, rz_cons_printable_palette_t::invalid, rz_cons_printable_palette_t::jmp, rz_cons_printable_palette_t::math, rz_cons_printable_palette_t::mov, rz_cons_printable_palette_t::nop, NULL, rz_cons_printable_palette_t::other, p, rz_cons_printable_palette_t::pop, rz_cons_printable_palette_t::push, rz_cons_printable_palette_t::ret, RZ_ANALYSIS_OP_TYPE_ACMP, RZ_ANALYSIS_OP_TYPE_ADD, RZ_ANALYSIS_OP_TYPE_AND, RZ_ANALYSIS_OP_TYPE_CALL, RZ_ANALYSIS_OP_TYPE_CAST, RZ_ANALYSIS_OP_TYPE_CCALL, RZ_ANALYSIS_OP_TYPE_CJMP, RZ_ANALYSIS_OP_TYPE_CMOV, RZ_ANALYSIS_OP_TYPE_CMP, RZ_ANALYSIS_OP_TYPE_CPL, RZ_ANALYSIS_OP_TYPE_CRET, RZ_ANALYSIS_OP_TYPE_CRYPTO, RZ_ANALYSIS_OP_TYPE_DIV, RZ_ANALYSIS_OP_TYPE_ICALL, RZ_ANALYSIS_OP_TYPE_IJMP, RZ_ANALYSIS_OP_TYPE_ILL, RZ_ANALYSIS_OP_TYPE_IO, RZ_ANALYSIS_OP_TYPE_IRCALL, RZ_ANALYSIS_OP_TYPE_IRJMP, RZ_ANALYSIS_OP_TYPE_JMP, RZ_ANALYSIS_OP_TYPE_LEA, RZ_ANALYSIS_OP_TYPE_LENGTH, RZ_ANALYSIS_OP_TYPE_LOAD, RZ_ANALYSIS_OP_TYPE_MASK, RZ_ANALYSIS_OP_TYPE_MJMP, RZ_ANALYSIS_OP_TYPE_MOD, RZ_ANALYSIS_OP_TYPE_MOV, RZ_ANALYSIS_OP_TYPE_MUL, RZ_ANALYSIS_OP_TYPE_NEW, RZ_ANALYSIS_OP_TYPE_NOP, RZ_ANALYSIS_OP_TYPE_NOT, RZ_ANALYSIS_OP_TYPE_NULL, RZ_ANALYSIS_OP_TYPE_OR, RZ_ANALYSIS_OP_TYPE_POP, RZ_ANALYSIS_OP_TYPE_PUSH, RZ_ANALYSIS_OP_TYPE_RCALL, RZ_ANALYSIS_OP_TYPE_RET, RZ_ANALYSIS_OP_TYPE_RJMP, RZ_ANALYSIS_OP_TYPE_ROL, RZ_ANALYSIS_OP_TYPE_ROR, RZ_ANALYSIS_OP_TYPE_RPUSH, RZ_ANALYSIS_OP_TYPE_SAL, RZ_ANALYSIS_OP_TYPE_SAR, RZ_ANALYSIS_OP_TYPE_SHL, RZ_ANALYSIS_OP_TYPE_SHR, RZ_ANALYSIS_OP_TYPE_STORE, RZ_ANALYSIS_OP_TYPE_SUB, RZ_ANALYSIS_OP_TYPE_SWI, RZ_ANALYSIS_OP_TYPE_SWITCH, RZ_ANALYSIS_OP_TYPE_TRAP, RZ_ANALYSIS_OP_TYPE_UCALL, RZ_ANALYSIS_OP_TYPE_UCCALL, RZ_ANALYSIS_OP_TYPE_UCJMP, RZ_ANALYSIS_OP_TYPE_UJMP, RZ_ANALYSIS_OP_TYPE_UNK, RZ_ANALYSIS_OP_TYPE_UPUSH, RZ_ANALYSIS_OP_TYPE_XOR, rz_return_val_if_fail, rz_cons_printable_palette_t::swi, rz_cons_printable_palette_t::trap, rz_cons_printable_palette_t::ucall, and rz_cons_printable_palette_t::ujmp.
Referenced by rz_print_colorize_asm_str().
RZ_API RZ_OWN RzStrBuf* rz_print_colorize_asm_str | ( | RZ_BORROW RzPrint * | p, |
const RzAsmTokenString * | toks | ||
) |
Colorizes a tokenized asm string.
p | The RzPrint struct. Used to retrieve the color palette. |
toks | The tokenized asm string. |
opt | Options for colorizing. E.g. reset background color, an address to highlight etc. |
Definition at line 1613 of file print.c.
References color, Color_RESET, Color_RESET_NOBG, rz_cons_printable_palette_t::func_var_type, RzAsmToken::len, rz_cons_printable_palette_t::meta, NULL, rz_cons_printable_palette_t::num, RzAsmToken::number, RzAsmTokenString::op_type, rz_cons_printable_palette_t::other, out, p, rz_cons_printable_palette_t::reg, RZ_ASM_TOKEN_META, 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_print_color_op_type(), rz_return_val_if_fail, rz_strbuf_append(), rz_strbuf_append_n(), rz_strbuf_free(), rz_strbuf_get(), rz_strbuf_new(), rz_vector_foreach, rz_warn_if_reached, RzAsmToken::start, RzAsmTokenString::str, RzAsmTokenString::tokens, RzAsmToken::type, and RzAsmToken::val.
Referenced by rz_asm_colorize_asm_str().
Definition at line 166 of file print.c.
References len, p, and rz_print_have_cursor().
Referenced by rz_print_hexdump_bits_handler().
Definition at line 152 of file print.c.
References len, p, rz_return_val_if_fail, and to.
Referenced by rz_print_hexdump_str().
Definition at line 1346 of file print.c.
References addr, syscall_preprocessing::arr, Color_INVERT, Color_RESET, i, INC, k, p, PFMT64x, printHistBlock(), RUNE_LINE_VERT, RZ_PRINT_FLAGS_COLOR, RZ_PRINT_FLAGS_OFFSET, rz_return_if_fail, step(), useUtf8, ut64(), and UT64_MAX.
Referenced by cmd_print_bars(), and search_similar_pattern_in().
Definition at line 101 of file print.c.
References free(), NULL, p, and RZ_FREE.
Referenced by gprobe_getinformation(), run_old_command(), and rz_core_fini().
Definition at line 133 of file print.c.
References from, len, p, rz_num_minmax_swap_i(), and to.
Referenced by print_cursor_l(), print_cursor_r(), and rz_print_cursor().
RZ_API RZ_OWN char* rz_print_hexdiff_str | ( | RZ_NONNULL RzPrint * | p, |
ut64 | aa, | ||
RZ_NONNULL const ut8 * | _a, | ||
ut64 | ba, | ||
RZ_NONNULL const ut8 * | _b, | ||
int | len, | ||
int | scndcol | ||
) |
Print hexdump diff between _a
and _b
.
p | RzPrint instance. |
aa | Address of first buffer. |
_a | First buffer. |
ba | Address of second buffer. |
_b | Second buffer. |
len | Diff length. |
scndcol | True If core->cons->columns > 123 ? |
Definition at line 1172 of file print.c.
References a, b, BD, CD, color, free(), i, len, M(), min, NULL, p, PFMT64x, print_cursor_l(), print_cursor_r(), RZ_MIN, RZ_PRINT_FLAGS_COLOR, RZ_PRINT_FLAGS_DIFFOUT, rz_return_val_if_fail, rz_strbuf_append(), rz_strbuf_appendf(), rz_strbuf_drain(), rz_strbuf_new(), and sb.
Referenced by rz_core_print_hexdiff(), and rz_core_print_hexdump_diff_str().
RZ_API RZ_OWN char* rz_print_hexdump_str | ( | RZ_NONNULL RzPrint * | p, |
ut64 | addr, | ||
RZ_NONNULL const ut8 * | buf, | ||
int | len, | ||
int | base, | ||
int | step, | ||
size_t | zoomsz | ||
) |
Prints a hexdump of buf
at addr
.
p | RzPrint instance |
addr | Address of the buffer |
buf | Buffer to print |
len | Print only this many bytes |
base | Byte print format ? (-10,-1,8,10,16,32,64) |
step | Word size ? |
zoomsz | Zoom size ? |
Definition at line 573 of file print.c.
References a, addr, b, bytes, c, checkSparse(), color, Color_INVERT, Color_MAGENTA, Color_RESET, delta, test_evm::end, free(), hex, i, k, len, n, NULL, off, p, Pal, PFMT64d, PFMT64x, print_addr(), print_byte(), print_cursor_l(), print_cursor_r(), print_section(), rz_mem_swaporcopy(), RZ_MIN, rz_print_cursor_pointer(), RZ_PRINT_FLAGS_ALIGN, RZ_PRINT_FLAGS_COLOR, RZ_PRINT_FLAGS_COMPACT, RZ_PRINT_FLAGS_HDROFF, RZ_PRINT_FLAGS_HEADER, RZ_PRINT_FLAGS_NONASCII, RZ_PRINT_FLAGS_NONHEX, RZ_PRINT_FLAGS_OFFSET, RZ_PRINT_FLAGS_REFS, RZ_PRINT_FLAGS_SEGOFF, RZ_PRINT_FLAGS_SPARSE, RZ_PRINT_FLAGS_STYLE, RZ_PRINT_FLAGS_UNALLOC, rz_print_set_screenbounds(), rz_read_ble16(), rz_read_ble32(), rz_read_ble64(), rz_read_ble8(), rz_read_le16(), rz_read_le32(), rz_read_le64(), rz_return_val_if_fail, rz_strbuf_append(), rz_strbuf_appendf(), rz_strbuf_drain(), rz_strbuf_new(), s, sb, snprintf, st16, st8, step(), ut64(), UT64_MAX, and w.
Referenced by cmd_pxr(), gprobe_getinformation(), hit(), run_old_command(), rz_core_print_dump_str(), rz_core_print_hexdump(), and rz_core_print_hexdump_or_hexdiff_str().
Definition at line 318 of file print.c.
References addr, c, Color_MAGENTA, Color_RED, Color_RESET, Color_WHITE, i, IS_PRINTABLE, isAllZeros(), len, p, Pal, PFMT64x, rp, RZ_MIN, RZ_PRINT_FLAGS_COLOR, RZ_PRINT_FLAGS_HEADER, and step().
Referenced by rz_print_hexdump_hexii_handler().
Definition at line 172 of file print.c.
References calloc(), Color_GREEN, Color_INVERT, Color_MAGENTA, Color_RED, Color_RESET, Color_RESET_NOBG, Color_WHITE, Color_YELLOW, colors, d, dst, i, IS_PRINTABLE, memcat, memcpy(), n, P, p, rz_hex_pair2bin(), RZ_MAX, RZ_MIN, RZ_PRINT_FLAGS_COLOR, s, and cmd_descs_generate::str.
Referenced by ds_print_show_bytes(), rz_core_visual_bit_editor(), and rz_core_visual_esil().
Definition at line 1519 of file print.c.
Referenced by rz_cmd_print(), and rz_core_print_dump_str().
Definition at line 45 of file print.c.
References is_interrupted_cb.
Referenced by rz_search_pattern().
RZ_API RZ_OWN char* rz_print_jsondump_str | ( | RZ_NONNULL RzPrint * | p, |
RZ_NONNULL const ut8 * | buf, | ||
int | len, | ||
int | wordsize | ||
) |
Print dump in json format.
p | RzPrint instance |
buf | Buffer to print to |
len | Print only this many bytes |
wordsize | Size of a word in bits |
Definition at line 1583 of file print.c.
References i, len, NULL, p, pj_a(), pj_end(), pj_free(), pj_n(), pj_new(), pj_string(), rz_read_ble(), rz_return_val_if_fail, cmd_descs_generate::str, strdup(), and ut64().
Referenced by rz_core_print_dump_str(), rz_core_print_hexdump_or_hexdiff_str(), and rz_core_print_jsondump().
Definition at line 56 of file print.c.
References libc_eprintf(), libc_printf(), memset(), NULL, nullprinter(), p, rz_io_bind_init, RZ_NEW0, RZ_PRINT_FLAGS_ADDRMOD, RZ_PRINT_FLAGS_COLOR, RZ_PRINT_FLAGS_HEADER, and RZ_PRINT_FLAGS_OFFSET.
Referenced by gprobe_getinformation(), run_old_command(), rz_core_init(), and rz_main_rz_find().
Definition at line 1259 of file print.c.
References i, p, pc, RUNE_LONG_LINE_HORIZ, RZ_MAX, RZ_MIN, RZ_PRINT_FLAGS_HEADER, staticp, and UTF_BLOCK.
Referenced by cmd_print_bars(), desc_list_visual_cb(), and rz_cmd_help().
Definition at line 1283 of file print.c.
References Color_GREEN, Color_RESET, max, min, mul(), p, RUNE_LONG_LINE_HORIZ, RZ_PRINT_FLAGS_COLOR, ut64(), and UTF_BLOCK.
Referenced by flagbar_foreach().
Definition at line 1562 of file print.c.
References i, p, rz_print_rowoff(), and UT32_MAX.
Referenced by cursor_nextrow(), and cursor_prevrow().
Definition at line 1553 of file print.c.
References i, p, and UT32_MAX.
Referenced by cursor_nextrow(), cursor_prevrow(), and rz_print_row_at_off().
Definition at line 511 of file print.c.
References NULL, p, print_section(), rz_return_val_if_fail, rz_strbuf_drain_nofree(), rz_strbuf_init(), and sb.
Referenced by rz_core_print_hexdump_byline_str(), and rz_print_hexdump_bits_handler().
Definition at line 117 of file print.c.
References p.
Referenced by cb_asmsubsec(), cb_color(), cb_decoff(), cb_scr_bgfill(), cb_scrrainbow(), rz_core_visual(), and setcursor().
RZ_API void rz_print_set_is_interrupted_cb | ( | RzPrintIsInterruptedCallback | cb | ) |
Definition at line 52 of file print.c.
References cb, and is_interrupted_cb.
Referenced by rz_cons_new().
Sets screen_bounds member of p
to addr
if the cursor is not visible on the screen.
p | RzPrint instance |
addr | Address to set screen_bounds if not visible |
This function will only calculate the screen_bounds if the current value of screen_bounds is 1. It caches the number of rows visible on the first call to this function. The cache is invalidated when screen_bounds is set.
Definition at line 376 of file print.c.
References addr, p, and rz_return_if_fail.
Referenced by ds_print_offset(), and rz_print_hexdump_str().
|
static |
Definition at line 267 of file print.c.
Referenced by rz_print_byte_color().
|
static |
Definition at line 21 of file print.c.
Referenced by capstone.CsInsn::__repr__(), cmd_analysis_esil(), hex2char(), hexdump(), i4004_get_ins_len(), old_transform_op(), readline_callback(), replace_asm_test(), rtr_visual(), rz_asm_op_set_hexbuf(), rz_assembly_of_hex_handler(), rz_bv_as_hex_string(), rz_core_assembly_of_hex(), rz_core_esil_of_hex(), rz_core_io_cache_print(), rz_core_seek_base(), rz_core_transform_op(), rz_core_write_block_op_at(), rz_esil_of_hex_handler(), rz_num_tail(), rz_num_tailff(), rz_print_hexdump_str(), rz_reg_arenas_write_hex_handler(), rz_test_load_asm_test_file(), rz_test_run_asm_test(), rz_write_block_handler(), rzil_print_register_bitv(), write_op_val(), z80_ed_branch_index_res(), z80_fddd_branch_index_res(), and z80_op_24_branch_index_res().
|
static |
Definition at line 43 of file print.c.
Referenced by rz_print_is_interrupted(), and rz_print_set_is_interrupted_cb().
|
static |
Definition at line 1254 of file print.c.
Referenced by rz_print_progressbar().