7 #include "../core_private.h"
10 #define PIDX (RZ_ABS(core->printidx % NPF))
31 #define CMD_REGISTERS "?== true `e cfg.debug`; ?! dr=; ?? ar="
32 #define CMD_REGISTERS_REFS "?== true `e cfg.debug`; ?! drr; ?? arr"
51 #define PRINT_HEX_FORMATS 10
52 #define PRINT_3_FORMATS 2
53 #define PRINT_4_FORMATS 7
54 #define PRINT_5_FORMATS 8
77 "prc",
"prc=a",
"pxAv",
"pxx",
"p=e $r-2",
"pk 64"
81 "pca",
"pcA",
"p8",
"pcc",
"pss",
"pcp",
"pcd",
"pcj"
139 rz_config_hold_s(hold,
"asm.hint.pos",
"asm.cmt.col",
"asm.offset",
"asm.lines",
140 "asm.indent",
"asm.bytes",
"asm.comments",
"asm.dwarf",
"asm.usercomments",
"asm.instr",
NULL);
238 case 64:
return "pxq";
break;
239 case 32:
return "pxw";
break;
249 if (
tab &&
tab->name[0] ==
':') {
250 return tab->name + 1;
287 if (!
p->consbind.get_size) {
290 (void)
p->consbind.get_size(&scr_rows);
303 "a",
"code analysis",
304 "c",
"toggle cursor",
305 "d",
"debugger / emulator",
306 "e",
"toggle configurations",
307 "i",
"insert / write",
308 "m",
"moving around (seeking)",
309 "p",
"print commands and modes",
310 "v",
"view management",
315 "?",
"show visual help menu",
316 "??",
"show this help",
317 "$",
"set the program counter to the current offset + cursor",
318 "&",
"rotate asm.bits between 8, 16, 32 and 64 applying hints",
319 "%",
"in cursor mode finds matching pair, otherwise toggle autoblocksz",
320 "^",
"seek to the beginning of the function",
321 "!",
"enter into the visual panels mode",
322 "TAB",
"switch to the next print mode (or element in cursor mode)",
323 "_",
"enter the flag/comment/functions/.. hud (same as VF_)",
324 "=",
"set cmd.vprompt (top row)",
325 "|",
"set cmd.cprompt (right column)",
326 ".",
"seek to program counter",
327 "#",
"toggle decompiler comments in disasm (see pdd* from jsdec)",
328 "\\",
"toggle visual split mode",
329 "\"",
"toggle the column mode (uses pC..)",
330 "/",
"in cursor mode search in current block",
332 ")",
"toggle emu.str",
333 ":cmd",
"run rizin command",
334 ";[-]cmt",
"add/remove comment",
335 "0",
"seek to beginning of current function",
336 "[1-9]",
"follow jmp/call identified by shortcut (like ;[1])",
337 ",file",
"add a link to the text file",
338 "/*+-[]",
"change block size, [] = resize hex.cols",
339 "<,>",
"seek aligned to block size (in cursor slurp or dump files)",
340 "a/A",
"(a)ssemble code, visual (A)ssembler",
341 "b",
"browse evals, symbols, flags, mountpoints, evals, classes, ...",
342 "B",
"toggle breakpoint",
343 "c/C",
"toggle (c)ursor and (C)olors",
344 "d[f?]",
"define function, data, code, ..",
345 "D",
"enter visual diff mode (set diff.from/to)",
346 "f/F",
"set/unset or browse flags. f- to unset, F to browse, ..",
347 "hjkl",
"move around (or HJKL) (left-down-up-right)",
348 "i",
"insert hex or string (in hexdump) use tab to toggle",
349 "I",
"insert hexpair block ",
350 "mK/'K",
"mark/go to Key (any key)",
351 "n/N",
"seek next/prev function/flag/hit (scr.nkey)",
352 "g",
"go/seek to given offset (g[g/G]<enter> to seek begin/end of file)",
353 "O",
"toggle asm.pseudo and asm.esil",
354 "p/P",
"rotate print modes (hex, disasm, debug, words, buf)",
355 "q",
"back to rizin shell",
356 "r",
"toggle call/jmp/lea hints",
357 "R",
"randomize color palette (ecr)",
358 "sS",
"step / step over",
359 "tT",
"tt new tab, t[1-9] switch to nth tab, t= name tab, t- close tab",
360 "uU",
"undo/redo seek",
361 "v",
"visual function/vars code analysis menu",
362 "V",
"(V)iew interactive ascii art graph (agfv)",
363 "wW",
"seek cursor to next/prev word",
364 "xX",
"show xrefs/refs of current function from/to data/code",
365 "yY",
"copy and paste selection",
366 "Z",
"shift-tab rotate print modes",
367 "Enter",
"follow address of jump/call",
372 "F2",
"toggle breakpoint",
373 "F4",
"run to cursor",
384 #define USE_THREADS 1
390 while (retries > 0) {
391 int nb =
bits == 64 ? 8 :
bits == 32 ? 64
395 if ((core->
rasm->
cur->bits & nb) == nb) {
421 if (core && core->
vmode) {
475 free(system_hud_dir);
486 if (!res && homehud) {
499 p = strchr(res,
';');
533 int i, max_length = 0, padding = 0;
544 padding = max_length - (strlen(
help[
i]));
546 pal_args_color,
help[
i],
548 pal_help_color,
help[
i + 1], pal_reset);
581 " \\ toggle horizonal split mode\n"
582 " tt create a new tab (same as t+)\n"
583 " t= give a name to the current tab\n"
584 " t- close current tab\n"
585 " th select previous tab (same as tj)\n"
586 " tl select next tab (same as tk)\n"
587 " t[1-9] select nth tab\n"
588 " C -> rotate scr.color=0,1,2,3\n"
589 " R -> rotate color theme with ecr command which honors scr.randpal\n");
595 " pP -> change to the next/previous print mode (hex, dis, ..)\n"
596 " TAB -> rotate between all the configurations for the current print mode\n");
602 " E toggle asm.hint.lea\n"
603 " & rotate asm.bits=16,32,64\n");
614 " i -> insert bits, bytes or text depending on view\n"
615 " a -> assemble instruction and write the bytes in the current offset\n"
616 " A -> visual assembler\n"
617 " + -> increment value of byte\n"
618 " - -> decrement value of byte\n");
624 " $ -> set the program counter (PC register)\n"
627 " B -> toggle breakpoint\n"
628 " :dc -> continue\n");
634 " g type flag/offset/register name to seek\n"
635 " hl seek to the next/previous byte\n"
636 " jk seek to the next row (core.offset += hex.cols)\n"
637 " JK seek one page down\n"
638 " ^ seek to the beginning of the current map\n"
639 " $ seek to the end of the current map\n"
640 " c toggle cursor mode (use hjkl to move and HJKL to select a range)\n"
641 " mK/'K mark/go to Key (any key)\n");
647 " df -> define function\n"
648 " du -> undefine function\n"
649 " dc -> define as code\n"
650 " dw -> define as dword (32bit)\n"
651 " dw -> define as qword (64bit)\n"
652 " dd -> define current block or selected bytes as data\n"
653 " V -> view graph (same as press the 'space' key)\n");
702 bool restore_seek =
true;
703 bool cursor_moved =
false;
704 if (core->
offset != newaddr) {
717 restore_seek =
false;
769 if (!strcmp(
buf,
"q")) {
909 const char *
keys =
"{}[]()<>";
915 if ((
const char *)
p >
keys) {
925 for (
i =
d - 1;
i >= 0;
i--) {
926 if (core->
block[
i] == ch) {
989 for (;
i >= 0;
i--) {
1005 char str[128],
buf[
sizeof(
str) * 2 + 1];
1014 if (
e >
buf && *
e ==
'"') {
1018 }
else if (
len < 1) {
1035 eprintf(
"Cannot find bytes.\n");
1120 if (minop == maxop) {
1124 return addr - minop;
1143 for (
i = 0;
i <
sizeof(
buf);
i++) {
1152 if (midflags >= RZ_MIDFLAGS_REALIGN) {
1154 if (skip_bytes && base +
i + skip_bytes < target) {
1155 i += skip_bytes - 1;
1162 if (target <= base +
i +
len) {
1167 return target > 4 ? target - 4 : 0;
1181 for (
i = 0;
i < numinstrs;
i++) {
1183 start_addr = *prev_addr;
1197 for (
i = 0;
i < numinstrs;
i++) {
1207 if (
f &&
f->offset ==
off &&
f->offset > 0) {
1217 line->buffer.index =
line->buffer.length = strlen(
line->buffer.data);
1229 line->offset_hist_index--;
1241 line->offset_hist_index++;
1256 if (!strcmp(
buf,
"g") || !strcmp(
buf,
"G")) {
1259 if (
buf[0] ==
'.') {
1274 return addr - prev_addr;
1288 if (!strcmp(
buf,
"-")) {
1290 }
else if (!strcmp(
buf,
"!")) {
1324 bool xrefsMode = fcnInsteadOfAddr;
1359 xrefsMode ?
"fcn." :
"addr.", xref_to ?
"x" :
"", address);
1362 if (!xrefs || rz_list_empty(xrefs)) {
1383 rz_list_foreach (xrefs,
iter, xrefi) {
1384 ut64 xaddr1 = xref_to ? xrefi->
from : xrefi->
to;
1385 ut64 xaddr2 = xref_to ? xrefi->
to : xrefi->
from;
1394 if (
count > maxcount) {
1400 cur_ref_addr = xaddr1;
1415 if (strlen(
name) >
w - 45) {
1426 idx, cstr, xaddr2, xaddr1,
1428 xref_to ?
"x" :
"",
name, cmt);
1459 if (++
count >= rows) {
1471 for (;
i < 9;
i++) {
1503 }
else if (ch ==
'?') {
1506 " jk - select next or previous item (use arrows)\n"
1507 " JK - step 10 rows\n"
1508 " pP - rotate between various print modes\n"
1509 " : - run rizin command\n"
1510 " / - highlight given word\n"
1511 " ? - show this help message\n"
1512 " <> - '<' for xrefs and '>' for refs\n"
1513 " TAB - toggle between address and function references\n"
1514 " xX - switch to refs or xrefs\n"
1515 " q - quit this view\n"
1516 " \\n - seek to this xref");
1520 }
else if (ch == 9) {
1521 xrefsMode = !xrefsMode;
1524 }
else if (ch ==
'p') {
1531 }
else if (ch ==
'P') {
1538 }
else if (ch ==
'/') {
1539 rz_core_cmd0(core,
"?i highlight;e scr.highlight=`yp`");
1541 }
else if (ch ==
'x' || ch ==
'<') {
1543 xrefsMode = !xrefsMode;
1545 }
else if (ch ==
'X' || ch ==
'>') {
1547 xrefsMode = !xrefsMode;
1549 }
else if (ch ==
'J') {
1552 }
else if (ch ==
'g') {
1555 }
else if (ch ==
'G') {
1558 }
else if (ch ==
';') {
1559 add_comment(core, cur_ref_addr,
"\nEnter comment for reference:\n");
1561 }
else if (ch ==
'.') {
1564 }
else if (ch ==
'j') {
1567 }
else if (ch ==
'K') {
1570 }
else if (ch ==
'k') {
1576 }
else if (ch ==
' ' || ch ==
'\n' || ch ==
'\r' || ch ==
'l') {
1579 ret =
follow_ref(core, xrefs, ch - 0x30, xref_to);
1580 }
else if (ch !=
'q' && ch !=
'Q' && ch !=
'h') {
1589 void SetWindow(
int Width,
int Height) {
1597 Rect.Bottom = Height - 1;
1598 Rect.Right = Width - 1;
1600 HANDLE Handle = GetStdHandle(STD_OUTPUT_HANDLE);
1601 SetConsoleScreenBufferSize(Handle, coord);
1602 SetConsoleWindowInfo(Handle,
TRUE, &Rect);
1611 if (dir && *dir && prj && *prj) {
1626 char *comment, *
cwd, *cmtfile;
1628 comment = prev_cmt ?
strdup(prev_cmt) :
NULL;
1636 if (!comment || !*comment) {
1652 eprintf(
"Could not open '%s'.\n", cwf);
1662 eprintf(
"No commafile found.\n");
1675 if (use_ocur &&
p->ocur == -1) {
1677 }
else if (!use_ocur) {
1686 p->cur += aop->
size;
1706 ut32 roff, next_roff;
1744 p->cur += cols > 0 ? cols : 3;
1751 if (
p->row_offsets) {
1770 core->
block + next_roff, 32);
1786 ut32 roff, prev_roff;
1826 p->cur -= cols > 0 ? cols : 4;
1834 if (
p->row_offsets) {
1848 if (prev_addr > core->
offset) {
1859 prev_sz = roff - prev_roff;
1862 ut64 cur = prev_roff + res;
1863 if (cur ==
p->cur) {
1868 p->cur = prev_roff +
delta;
1899 int offscreen = (core->
cons->
rows - 3) *
p->cols;
1910 if ((!cur_is_visible && !is_close) || (!cur_is_visible &&
p->cur == 0)) {
1915 }
else if ((!cur_is_visible && is_close) || !off_is_visible) {
1924 if (
p->ocur != -1) {
1927 res |= off_is_visible;
1929 }
else if (core->
print->
cur >= offscreen) {
1932 if (
p->ocur != -1) {
1947 if (
p->ocur != -1) {
1976 if (ch !=
'h' && arrows ==
'h') {
1979 }
else if (ch !=
'l' && arrows ==
'l') {
1982 }
else if (ch !=
'j' && arrows ==
'j') {
1985 }
else if (ch !=
'k' && arrows ==
'k') {
1992 ut8 chs[2] = { ch, 0 };
2019 char hexpair[3] = {
__nib, ch, 0 };
2051 " tab - toggle between ascii and hex columns\n"
2052 " q (or alt-q) - quit insert mode\n"
2054 " r - remove byte in cursor\n"
2055 " R - insert byte in cursor\n"
2056 " [0-9a-f] - insert hexpairs in hex column\n"
2057 " hjkl - move around\n"
2059 " arrows - move around\n"
2060 " alt-q - quit insert mode\n",
2068 const char *browsemsg =
2071 " _ hud mode (V_)\n"
2072 " 1 bit editor (vd1)\n"
2074 " a analysis classes\n"
2078 " e eval var configurations\n"
2079 " E esil debugger mode\n"
2191 if (ch >
'0' && ch <=
'9') {
2253 }
else if (
x < 20) {
2255 }
else if (
x < 24) {
2258 }
else if (y == 2) {
2260 visual_closetab(core);
2262 visual_newtab(core);
2264 visual_nexttab(core);
2280 if (ch ==
'l' && och == 6) {
2282 }
else if (ch ==
'h' && och == 2) {
2338 }
while (--wheelspeed > 0);
2367 if (
f == t &&
f == 0) {
2388 rz_cons_printf(
"\nFile has been opened in read-only mode. Use -w flag, oo+ or e io.cache=true\n");
2397 strcpy(
buf,
"\"wa ");
2425 #define I core->cons
2430 I->line->contents =
NULL;
2437 #define I core->cons
2442 if (
buf && !strcmp(
buf,
"|")) {
2536 if (!strcmp(
n,
"-")) {
2538 }
else if (*
n ==
'.') {
2550 }
else if (*
n ==
'-') {
2579 visual_nthtab(core, ch -
'0' - 1);
2585 visual_prevtab(core);
2591 visual_nexttab(core);
2594 visual_tabname(core);
2597 visual_closetab(core);
2609 visual_newtab(core);
2614 visual_closetab(core);
2637 }
else if (
PIDX == 2) {
2640 }
else if (core->
seltab == 1) {
2646 rz_cons_printf(
"\nFile has been opened in read-only mode. Use -w flag, oo+ or e io.cache=true\n");
2654 strcpy(
buf,
"wow ");
2671 strcpy(
buf,
"\"w ");
2682 strcpy(
buf,
"wow ");
2740 }
else if (rz_list_empty(fun->
bbs)) {
2741 rz_cons_message(
"No basic blocks in this function. You may want to use 'afb+'.");
2745 eprintf(
"\rRendering graph...");
2757 for (
i = 0;
i < distance;
i++) {
2761 for (
i = 0;
i < distance;
i++) {
2767 distance = -distance;
2777 for (
i = 0;
i < distance;
i++) {
2781 for (
i = 0;
i < distance;
i++) {
2787 distance = -distance;
2795 for (
i = 0;
i < distance;
i++) {
2804 for (
i = 0;
i < distance;
i++) {
2839 for (
i = 0;
i < distance;
i++) {
2859 int delta = hexCols * (
h / 4);
2871 for (
i = 0;
i < distance;
i++) {
2880 for (
i = 0;
i < distance;
i++) {
2884 int times = wheelspeed;
2906 for (
i = 0;
i < distance;
i++) {
2963 if (key_s && *key_s) {
2971 if (key_s && *key_s) {
3116 rz_core_cmd0(core,
"?i highlight;e scr.highlight=`yp`");
3143 eprintf(
"No range selected. Use HJKL.\n");
3226 add_comment(core, core->
offset,
"Enter a comment: ('-' to remove, '!' to use cfg.editor)\n");
3265 a_len = strlen(
a) + 4;
3267 int padsize = (
w / 2) - a_len;
3268 int title_size = 12;
3271 title_size = strlen(title);
3272 padsize -= strlen(title) / 2;
3273 const char *halfpad =
rz_str_pad(
' ', padsize);
3278 padsize = (
w / 2) - title_size - strlen(
b) - 4;
3279 const char *halfpad = padsize > 1 ?
rz_str_pad(
' ', padsize) :
"";
3289 static ut64 oldpc = 0;
3292 char pos[512], bar[512], pcs[32];
3322 new_sz =
RZ_MIN(new_sz, 16 * 1024);
3323 if (new_sz > bsize) {
3337 if (curpc && curpc !=
UT64_MAX && curpc != oldpc) {
3341 if ((curpc < core->
offset) || (curpc > (core->
offset + follow))) {
3344 }
else if (follow < 0) {
3364 rz_flag_space_pop(core->
flags);
3370 if (
f->offset ==
addr || !
f->offset) {
3382 }
else if (
delta < 0) {
3401 if (cmd_visual && *cmd_visual) {
3427 if (!sz || pa > sz) {
3430 pc = (pa * 100) / sz;
3441 title =
rz_str_newf(
"[%s + %d> * INSERT MODE *\n",
3444 char pm[32] =
"[XADVC]";
3446 for (
i = 0;
i < 6;
i++) {
3471 const int tabsCount = __core_visual_tab_count(core);
3472 if (tabsCount > 0) {
3474 char *tabstring = __core_visual_tab_string(core, kolor);
3484 for (
i = 0;
i < tabsCount;
i++) {
3495 rz_cons_print(title);
3545 if (scrollbar == 2) {
3549 if (scrollbar > 2) {
3554 if (
w < 10 ||
h < 3) {
3577 bool hadMatch =
false;
3578 for (
i = 0;
i <
h;
i++) {
3580 if (word && *word) {
3611 if (
w < 10 ||
h < 4) {
3626 int slen = strlen(
s) + 1;
3631 int linew = (
w - (slen * 2)) + 1;
3636 bool hadMatch =
false;
3637 for (
i = 0;
i < linew + 1;
i++) {
3652 for (
i = 0;
i < linew;
i++) {
3654 if (word && *word) {
3656 ut64 nex =
from + (block * (
i + strlen(word) + 1));
3677 const char *vi, *vcmd, *cmd_str;
3693 int split_w = 12 + 4 + hex_cols + (hex_cols * 3);
3697 bool vsplit = (vi && *vi);
3728 if (vcmd && *vcmd) {
3735 static char debugstr[512];
3736 const char *pxw =
NULL;
3738 int size = (
h * 16) / 2;
3748 snprintf(debugstr,
sizeof(debugstr),
3760 if (cmd_str && *cmd_str) {
3813 if (midflags || midbb) {
3814 int skip_bytes_flag = 0, skip_bytes_bb = 0;
3815 if (midflags >= RZ_MIDFLAGS_REALIGN) {
3821 if (skip_bytes_flag) {
3822 *cols = skip_bytes_flag;
3824 if (skip_bytes_bb && skip_bytes_bb < *cols) {
3825 *cols = skip_bytes_bb;
3829 *cols =
op->size > 1 ?
op->size : 1;
3836 return cons->term_xterm;
3857 const char *teefile;
3868 eprintf(
"Cannot create Visual context. Use scr.fix_{columns|rows}\n");
3875 core->
vmode =
false;
3877 if (!strncmp(
input,
"im", 2)) {
3896 static char debugstr[512];
3900 rz_core_visual_tab_update(core);
3915 if (cmdvhex && *cmdvhex) {
3917 "?0 ; f+ tmp ; sr %s @e: cfg.seek.silent=true ; %s ; ?1 ; %s ; ?1 ; "
3918 "s tmp @e: cfg.seek.silent=true ; f- tmp ; pd $r",
3921 debugstr[
sizeof(debugstr) - 1] = 0;
3924 const char sign = (
delta < 0) ?
'+' :
'-';
3927 "diq ; ?0 ; f+ tmp ; sr %s @e: cfg.seek.silent=true ; %s %d @ $$%c%d;"
3929 "?1 ; s tmp @e: cfg.seek.silent=true ; f- tmp ; afal ; pd $r",
3930 reg, pxa ?
"pxa" : pxw,
size, sign, absdelta,
3950 if (scrseek != 0LL) {
3968 }
else if (ch == 0x1b) {
3972 if (chrs[0] ==
'[') {
3975 if (chrs[1] >=
'A' && chrs[1] <=
'D') {
3993 if (ch == -1 || ch == 4) {
4013 core->
vmode =
false;
RZ_API int rz_core_visual_graph(RzCore *core, RzAGraph *g, RzAnalysisFunction *_fcn, int is_interactive)
RZ_API int rz_analysis_archinfo(RzAnalysis *analysis, int query)
RZ_API void rz_asm_op_fini(RzAsmOp *op)
RZ_API void rz_asm_op_init(RzAsmOp *op)
RZ_API int rz_asm_set_pc(RzAsm *a, ut64 pc)
RZ_API int rz_asm_disassemble(RzAsm *a, RzAsmOp *op, const ut8 *buf, int len)
static int dis(RzAsm *a, RzAsmOp *op, const ut8 *buf, int len)
RZ_API RzBinObject * rz_bin_cur_object(RzBin *bin)
RZ_API RZ_BORROW RzBinSection * rz_bin_get_section_at(RzBinObject *o, ut64 off, int va)
Find the binary section at offset off.
static RzList * maps(RzBinFile *bf)
RzBinInfo * info(RzBinFile *bf)
int bits(struct state *s, int need)
RZ_API ut64 rz_analysis_block_get_op_addr_in(RzAnalysisBlock *bb, ut64 off)
RZ_API RzAnalysisBlock * rz_analysis_find_most_relevant_block_in(RzAnalysis *analysis, ut64 off)
RZ_API RzAnalysisOp * rz_core_analysis_op(RzCore *core, ut64 addr, int mask)
RZ_API void rz_core_debug_breakpoint_toggle(RZ_NONNULL RzCore *core, ut64 addr)
Toggle breakpoint.
RZ_IPI void rz_core_debug_continue(RzCore *core)
RZ_IPI void rz_core_debug_sync_bits(RzCore *core)
RZ_API bool rz_core_debug_continue_until(RzCore *core, ut64 addr, ut64 to)
RZ_IPI void rz_core_debug_single_step_in(RzCore *core)
RZ_IPI void rz_core_debug_single_step_over(RzCore *core)
RZ_API bool rz_core_file_resize_delta(RzCore *core, st64 delta)
RZ_IPI int rz_core_analysis_set_reg(RzCore *core, const char *regname, ut64 val)
RZ_API int rz_core_write_hexpair(RzCore *core, ut64 addr, const char *pairs)
RZ_API bool rz_core_write_at(RzCore *core, ut64 addr, const ut8 *buf, int size)
RZ_API int rz_core_block_read(RzCore *core)
RZ_API bool rz_core_dump(RzCore *core, const char *file, ut64 addr, ut64 size, int append)
RZ_API int rz_core_cmd0(RzCore *core, const char *cmd)
RZ_API int rz_core_cmd(RzCore *core, const char *cstr, int log)
RZ_API char * rz_core_cmd_strf(RzCore *core, const char *fmt,...)
RZ_API int rz_core_cmdf(RzCore *core, const char *fmt,...)
RZ_API char * rz_core_cmd_str(RzCore *core, const char *cmd)
Executes a rizin command and returns the stdout as a string.
RZ_API bool rz_cmd_state_output_init(RZ_NONNULL RzCmdStateOutput *state, RzOutputMode mode)
Initialize a RzCmdStateOutput structure and its inner fields based on the provided mode.
RZ_API void rz_cmd_state_output_fini(RZ_NONNULL RzCmdStateOutput *state)
Clear the inner fields of RzCmdStateOutput structure, but do not free it.
RZ_API void rz_core_theme_nextpal(RzCore *core, RzConsPalSeekMode mode)
RZ_IPI void rz_core_flag_describe(RzCore *core, ut64 addr, bool strict_offset, RzCmdStateOutput *state)
RZ_API void rz_core_gadget_print(RzCore *core)
Prints or displays the print gadgets while in visual mode.
RZ_API ut64 rz_config_get_i(RzConfig *cfg, RZ_NONNULL const char *name)
RZ_API bool rz_config_get_b(RzConfig *cfg, RZ_NONNULL const char *name)
RZ_API RzConfigNode * rz_config_set(RzConfig *cfg, RZ_NONNULL const char *name, const char *value)
RZ_API RzConfigNode * rz_config_set_i(RzConfig *cfg, RZ_NONNULL const char *name, const ut64 i)
RZ_API RZ_BORROW const char * rz_config_get(RzConfig *cfg, RZ_NONNULL const char *name)
RZ_API RzConfigNode * rz_config_set_b(RzConfig *cfg, RZ_NONNULL const char *name, bool value)
RZ_API bool rz_config_toggle(RzConfig *cfg, RZ_NONNULL const char *name)
RZ_API void rz_cons_clear00(void)
RZ_API bool rz_cons_set_cup(bool enable)
RZ_API void rz_cons_set_raw(bool is_raw)
RZ_API int rz_cons_get_size(int *rows)
RZ_API bool rz_cons_enable_mouse(const bool enable)
RZ_API void rz_cons_column(int c)
RZ_API RzCons * rz_cons_singleton(void)
RZ_API void rz_cons_strcat(const char *str)
RZ_API void rz_cons_newline(void)
RZ_API int rz_cons_printf(const char *format,...)
RZ_API void rz_cons_reset_colors(void)
RZ_API void rz_cons_echo(const char *msg)
RZ_API void rz_cons_visual_flush(void)
RZ_API bool rz_cons_get_click(int *x, int *y)
RZ_API void rz_cons_goto_origin_reset(void)
RZ_API void rz_cons_show_cursor(int cursor)
RZ_API void rz_cons_flush(void)
RZ_API bool rz_cons_is_breaked(void)
RZ_API void rz_cons_println(const char *str)
RZ_API void rz_cons_gotoxy(int x, int y)
RZ_API void rz_cons_clear(void)
RZ_API void rz_cons_reset(void)
RZ_API void rz_core_reg_update_flags(RzCore *core)
Update or create flags for all registers where it makes sense.
RZ_API bool rz_core_reg_set_by_role_or_name(RzCore *core, const char *name, ut64 num)
set on rz_core_reg_default()
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void count
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags cmd
RZ_API int rz_line_hist_cmd_down(RzLine *line)
RZ_API const char * rz_line_readline(void)
RZ_API int rz_line_hist_cmd_up(RzLine *line)
RZ_API int rz_line_set_hist_callback(RzLine *line, RzLineHistoryUpCb up, RzLineHistoryDownCb down)
RZ_API int rz_line_hist_add(const char *line)
RZ_API int rz_core_flag_in_middle(RzCore *core, ut64 at, int oplen, int *midflags)
RZ_API int rz_core_bb_starts_in_middle(RzCore *core, ut64 at, int oplen)
RZ_API ut64 rz_debug_reg_get(RzDebug *dbg, const char *name)
size_t map(int syms, int left, int len)
RZ_DEPRECATE RZ_API RzAnalysisFunction * rz_analysis_get_fcn_in(RzAnalysis *analysis, ut64 addr, int type)
RZ_API RzFlagItem * rz_flag_get_at(RzFlag *f, ut64 off, bool closest)
RZ_API RzFlagItem * rz_flag_set(RzFlag *f, const char *name, ut64 off, ut32 size)
RZ_API bool rz_flag_unset_name(RzFlag *f, const char *name)
RZ_API bool rz_flag_unset_off(RzFlag *f, ut64 off)
void skip(file *in, unsigned n)
RZ_API RzAnalysisHint * rz_analysis_hint_get(RzAnalysis *a, ut64 addr)
RZ_API void rz_analysis_hint_set_bits(RzAnalysis *a, ut64 addr, int bits)
RZ_API void rz_analysis_hint_free(RzAnalysisHint *h)
RZ_API void rz_config_hold_restore(RzConfigHold *h)
Restore whatever config options were previously saved in h.
RZ_API RzConfigHold * rz_config_hold_new(RzConfig *cfg)
Create an opaque object to save/restore some configuration options.
RZ_API bool rz_config_hold_s(RzConfigHold *h,...)
Save the current values of a list of config options that have string values.
RZ_API void rz_config_hold_free(RzConfigHold *h)
Free a RzConfigHold object h.
RZ_API void Ht_() free(HtName_(Ht) *ht)
RZ_API void rz_cons_message(RZ_NONNULL const char *msg)
RZ_API char * rz_cons_hud_file(const char *f)
RZ_API bool rz_analysis_function_delete_label(RzAnalysisFunction *fcn, const char *name)
RZ_API bool rz_analysis_function_set_label(RzAnalysisFunction *fcn, const char *name, ut64 addr)
RZ_API int rz_cons_less_str(const char *str, const char *exitkeys)
RZ_API RZ_OWN char * rz_core_editor(const RzCore *core, RZ_NULLABLE const char *file, RZ_NULLABLE const char *str)
RZ_API ut64 rz_core_get_asmqjmps(RzCore *core, const char *str)
RZ_API bool rz_core_block_size(RzCore *core, ut32 bsize)
RZ_API RZ_BORROW void * rz_list_get_n(RZ_NONNULL const RzList *list, ut32 n)
Returns the N-th element of the list.
RZ_API RZ_OWN void * rz_list_pop_head(RZ_NONNULL RzList *list)
Removes and returns the first element of the list.
RZ_API void rz_list_free(RZ_NONNULL RzList *list)
Empties the list and frees the list pointer.
RZ_API void rz_line_set_prompt(const char *prompt)
static static fork const void static count static fd const char const char static newpath char char char static envp time_t static t const char static mode static whence const char static dir time_t static t unsigned static seconds const char struct utimbuf static buf static inc static sig const char static mode static oldfd times
static const char struct stat static buf struct stat static buf static idle const char static path static fd const char static len const void static prot const char struct module static image struct kernel_sym static table unsigned char static buf static fsuid unsigned struct dirent unsigned static count const struct iovec static count static pid const void static len static flags const struct sched_param static p static pid static policy struct timespec static tp static suid unsigned fn
return strdup("=SP r13\n" "=LR r14\n" "=PC r15\n" "=A0 r0\n" "=A1 r1\n" "=A2 r2\n" "=A3 r3\n" "=ZF zf\n" "=SF nf\n" "=OF vf\n" "=CF cf\n" "=SN or0\n" "gpr lr .32 56 0\n" "gpr pc .32 60 0\n" "gpr cpsr .32 64 0 ____tfiae_________________qvczn\n" "gpr or0 .32 68 0\n" "gpr tf .1 64.5 0 thumb\n" "gpr ef .1 64.9 0 endian\n" "gpr jf .1 64.24 0 java\n" "gpr qf .1 64.27 0 sticky_overflow\n" "gpr vf .1 64.28 0 overflow\n" "gpr cf .1 64.29 0 carry\n" "gpr zf .1 64.30 0 zero\n" "gpr nf .1 64.31 0 negative\n" "gpr itc .4 64.10 0 if_then_count\n" "gpr gef .4 64.16 0 great_or_equal\n" "gpr r0 .32 0 0\n" "gpr r1 .32 4 0\n" "gpr r2 .32 8 0\n" "gpr r3 .32 12 0\n" "gpr r4 .32 16 0\n" "gpr r5 .32 20 0\n" "gpr r6 .32 24 0\n" "gpr r7 .32 28 0\n" "gpr r8 .32 32 0\n" "gpr r9 .32 36 0\n" "gpr r10 .32 40 0\n" "gpr r11 .32 44 0\n" "gpr r12 .32 48 0\n" "gpr r13 .32 52 0\n" "gpr r14 .32 56 0\n" "gpr r15 .32 60 0\n" "gpr r16 .32 64 0\n" "gpr r17 .32 68 0\n")
RZ_API void rz_analysis_op_free(void *op)
RZ_API bool rz_analysis_op_fini(RzAnalysisOp *op)
RZ_API int rz_analysis_op(RzAnalysis *analysis, RzAnalysisOp *op, ut64 addr, const ut8 *data, int len, RzAnalysisOpMask mask)
static struct @218 keys[]
RZ_API void rz_cons_pal_random(void)
RZ_API bool rz_core_visual_panels_root(RzCore *core, RzPanelsRoot *panels_root)
RZ_API void rz_print_set_flags(RzPrint *p, int _flags)
RZ_API int rz_print_row_at_off(RzPrint *p, ut32 offset)
RZ_API ut32 rz_print_rowoff(RzPrint *p, int i)
RZ_API void rz_print_set_cursor(RzPrint *p, int enable, int ocursor, int cursor)
static void repeat(struct parse *, sopno, int, int)
@ RZ_ANALYSIS_FCN_TYPE_NULL
#define RZ_ANALYSIS_ARCHINFO_MAX_OP_SIZE
@ RZ_ANALYSIS_OP_MASK_BASIC
#define RZ_ANALYSIS_ARCHINFO_MIN_OP_SIZE
@ RZ_ANALYSIS_OP_TYPE_JMP
@ RZ_ANALYSIS_OP_TYPE_CCALL
@ RZ_ANALYSIS_OP_TYPE_CALL
@ RZ_ANALYSIS_OP_TYPE_CJMP
@ RZ_CMD_STATUS_INVALID
command could not be executed (e.g. shell level error, bad expression, etc.)
@ RZ_VIRT_TERM_MODE_COMPLETE
All the sequences goes through VT (Windows Terminal, mintty, all OSs)
#define RZ_CONS_CLEAR_LINE
void(* RzConsEvent)(void *)
#define RZ_FLAGS_FS_SYMBOLS
@ RZ_CORE_VISUAL_MODE_PD
Disassembly view.
@ RZ_CORE_VISUAL_MODE_OV
Color blocks (entropy)
@ RZ_CORE_VISUAL_MODE_CD
Print in string format.
@ RZ_CORE_VISUAL_MODE_DB
Debug mode.
@ RZ_CORE_VISUAL_MODE_PX
Hexadecimal view.
RZ_API bool rz_file_exists(const char *str)
RZ_API char * rz_file_abspath(const char *file)
RZ_API RZ_OWN char * rz_file_slurp(const char *str, RZ_NULLABLE size_t *usz)
RZ_API bool rz_file_dump(const char *file, const ut8 *buf, int len, bool append)
RZ_API RZ_OWN char * rz_file_path_join(RZ_NONNULL const char *s1, RZ_NULLABLE const char *s2)
Concatenate two paths to create a new one with s1+s2 with the correct path separator.
RZ_API int rz_hex_str2bin(const char *in, ut8 *out)
Convert an input string in into the binary form in out.
RZ_API bool rz_io_read_at(RzIO *io, ut64 addr, ut8 *buf, int len)
RZ_API ut64 rz_io_size(RzIO *io)
RZ_API RzIOMap * rz_io_map_get(RzIO *io, ut64 addr)
RZ_API RzIODesc * rz_io_desc_get(RzIO *io, int fd)
RZ_API RZ_BORROW RzPVector * rz_io_maps(RzIO *io)
Returns the pointer to vector containing maps list.
RZ_API bool rz_io_write_at(RzIO *io, ut64 addr, const ut8 *buf, int len)
static ut64 rz_itv_begin(RzInterval itv)
static ut64 rz_itv_end(RzInterval itv)
RZ_API const ut8 * rz_mem_mem(const ut8 *haystack, int hlen, const ut8 *needle, int nlen)
RZ_API ut64 rz_num_get(RzNum *num, const char *str)
RZ_API ut64 rz_num_math(RzNum *num, const char *str)
RZ_API RZ_OWN char * rz_path_home_prefix(RZ_NULLABLE const char *path)
Return path prefixed by the home prefix.
RZ_API RZ_OWN char * rz_path_system(RZ_NULLABLE const char *path)
Return the full system path of the given subpath path.
#define RZ_PRINT_FLAGS_CURSOR
#define RZ_PRINT_FLAGS_COLOR
#define RZ_PRINT_FLAGS_ADDRMOD
#define RZ_PRINT_FLAGS_HEADER
RZ_API char * rz_str_between(const char *str, const char *prefix, const char *suffix)
RZ_API char * rz_str_appendf(char *ptr, const char *fmt,...) RZ_PRINTF_CHECK(2
RZ_API char * rz_str_newf(const char *fmt,...) RZ_PRINTF_CHECK(1
RZ_API char * rz_str_append(char *ptr, const char *string)
RZ_API char * rz_str_new(const char *str)
RZ_API size_t rz_str_ncpy(char *dst, const char *src, size_t n)
Secure string copy with null terminator.
RZ_API char * rz_str_ansi_crop(const char *str, unsigned int x, unsigned int y, unsigned int x2, unsigned int y2)
RZ_API const char * rz_str_trim_head_ro(const char *str)
RZ_API void rz_str_trim(RZ_NONNULL RZ_INOUT char *str)
Removes whitespace characters (space, tab, newline etc.) from the beginning and end of a string.
RZ_API const char * rz_str_pad(const char ch, int len)
#define rz_strf(buf,...)
Convenience macro for local temporary strings.
RZ_API char * rz_strbuf_get(RzStrBuf *sb)
RZ_API RzStrBuf * rz_strbuf_new(const char *s)
RZ_API void rz_strbuf_free(RzStrBuf *sb)
RZ_API bool rz_strbuf_appendf(RzStrBuf *sb, const char *fmt,...) RZ_PRINTF_CHECK(2
RZ_API int rz_sys_usleep(int usecs)
Sleep for usecs microseconds.
RZ_API char * rz_sys_getdir(void)
Get current working directory.
RZ_API int rz_sys_sleep(int secs)
Sleep for secs seconds.
@ RZ_OUTPUT_MODE_STANDARD
#define RZ_BETWEEN(x, y, z)
RZ_API void * rz_pvector_pop(RzPVector *vec)
static void ** rz_pvector_push_front(RzPVector *vec, void *x)
static size_t rz_pvector_len(const RzPVector *vec)
static bool rz_pvector_empty(RzPVector *vec)
static void * rz_pvector_at(const RzPVector *vec, size_t index)
RZ_API bool rz_core_seek_redo(RzCore *core)
RZ_API RzCoreSeekItem * rz_core_seek_peek(RzCore *core, int idx)
Return a element in the undo/redo list.
RZ_API bool rz_core_seek_delta(RzCore *core, st64 delta, bool save)
Seek relative to current offset and optionally save the current offset in seek history.
RZ_API bool rz_core_seek_and_save(RzCore *core, ut64 addr, bool rb)
Save currently marked state in seek history and seek to addr .
RZ_API bool rz_core_seek_next(RzCore *core, const char *type, bool save)
Seek to the next type of item from current offset.
RZ_API int rz_core_seek_base(RzCore *core, const char *hex, bool save)
Seek to a new address composed of current offset with last hex digits replaced with those of hex.
RZ_API bool rz_core_seek_prev(RzCore *core, const char *type, bool save)
Seek to the previous type of item from current offset.
RZ_API bool rz_core_seek_undo(RzCore *core)
RZ_API void rz_core_seek_item_free(RzCoreSeekItem *item)
RZ_API bool rz_core_seek(RzCore *core, ut64 addr, bool rb)
Seek to addr.
static struct sockaddr static addrlen static backlog const void static flags void struct sockaddr from
static struct sockaddr static addrlen static backlog const void static flags void struct sockaddr socklen_t static fromlen const void const struct sockaddr to
static struct sockaddr static addrlen static backlog const void static flags void flags
Represent the output state of a command handler.
RzConsPrintablePalette pal
ut64 offset
Value of core->offset at the given time in history.
RzCoreVisualMode printidx
RzCoreTaskScheduler tasks
RzPanelsRoot * panels_root
RzLinePromptType prompt_type
RZ_API void rz_core_task_enqueue_oneshot(RzCoreTaskScheduler *scheduler, RzCoreTaskOneShot func, void *user)
RZ_API void rz_core_visual_asm(RzCore *core, ut64 off)
static int visual_help(RzCore *core)
RZ_API void rz_core_visual_title(RzCore *core, int color)
static void cursor_nextrow(RzCore *core, bool use_ocur)
static void nextPrintCommand(void)
RZ_API void rz_core_print_scrollbar_bottom(RzCore *core)
static const char * print3Formats[PRINT_3_FORMATS]
static bool autoblocksize
static void rotateAsmBits(RzCore *core)
static void cursor_left(RzCore *core, bool use_ocur)
RZ_API void rz_core_visual_toggle_decompiler_disasm(RzCore *core, bool for_graph, bool reset)
RZ_API int rz_core_visual_prevopsz(RzCore *core, ut64 addr)
static int visual_responsive(RzCore *core)
RZ_API void rz_core_visual_offset(RzCore *core)
RZ_API void rz_core_visual_seek_animation_undo(RzCore *core)
static const char * printfmtSingle[NPF]
static void setcursor(RzCore *core, bool cur)
static bool __core_visual_gogo(RzCore *core, int ch)
static bool __holdMouseState(RzCore *core)
static void prevPrintCommand(void)
static void nextPrintFormat(RzCore *core)
RZ_API void rz_core_visual_applyDisMode(RzCore *core, int disMode)
static int isSpace(char ch)
RZ_API void rz_core_visual_show_char(RzCore *core, char ch)
static void backup_current_addr(RzCore *core, ut64 *addr, ut64 *bsze, ut64 *newaddr, int *cur)
static void findPair(RzCore *core)
RZ_API void rz_core_visual_disasm_up(RzCore *core, int *cols)
RZ_API bool rz_core_visual_hud(RzCore *core)
static void setdiff(RzCore *core)
static void prompt_read(const char *p, char *buf, int buflen)
RZ_API int rz_core_visual_cmd(RzCore *core, const char *arg)
static const char * rotateAsmemu(RzCore *core)
RZ_API void rz_core_visual_append_help(RzStrBuf *p, const char *title, const char **help)
static const char * __core_visual_print_command(RzCore *core)
static void cursor_right(RzCore *core, bool use_ocur)
static bool fix_cursor(RzCore *core)
static void nextOpcode(RzCore *core)
static void visual_refresh(RzCore *core)
static void visual_refresh_oneshot(RzCore *core)
static bool is_mintty(RzCons *cons)
static void prevPrintFormat(RzCore *core)
RZ_API bool rz_core_prevop_addr(RzCore *core, ut64 start_addr, int numinstrs, ut64 *prev_addr)
RZ_API void rz_core_visual_prompt_input(RzCore *core)
static void restore_current_addr(RzCore *core, ut64 addr, ut64 bsze, ut64 newaddr, int cur)
RZ_API int rz_core_visual_prompt(RzCore *core)
static void cursor_ocur(RzCore *core, bool use_ocur)
RZ_API void rz_core_visual_browse(RzCore *core, const char *input)
RZ_API void rz_core_print_scrollbar(RzCore *core)
#define PRINT_HEX_FORMATS
static void findPrevWord(RzCore *core)
static void flush_stdin(void)
RZ_API RzListInfo * rz_listinfo_new(const char *name, RzInterval pitv, RzInterval vitv, int perm, const char *extra)
static void visual_search(RzCore *core)
static void setprintmode(RzCore *core, int n)
static int visual_nkey(RzCore *core, int ch)
RZ_API void rz_core_visual_applyHexMode(RzCore *core, int hexMode)
static const char * printfmtColumns[NPF]
static int numbuf_pull(void)
static void visual_comma(RzCore *core)
static void reset_print_cur(RzPrint *p)
RZ_API int rz_core_visual(RzCore *core, const char *input)
#define CMD_REGISTERS_REFS
RZ_API void rz_core_visual_disasm_down(RzCore *core, RzAsmOp *op, int *cols)
static void visual_flagzone(RzCore *core)
RZ_API int rz_core_visual_xrefs(RzCore *core, bool xref_to, bool fcnInsteadOfAddr)
RZ_API void rz_listinfo_free(RzListInfo *info)
static bool canWrite(RzCore *core, ut64 addr)
RZ_API void rz_core_visual_toggle_hints(RzCore *core)
static void visual_breakpoint(RzCore *core)
static int current4format
char * getcommapath(RzCore *core)
RZ_API void rz_core_visual_showcursor(RzCore *core, int x)
static void printFormat(RzCore *core, const int next)
RZ_API ut64 rz_core_prevop_addr_force(RzCore *core, ut64 start_addr, int numinstrs)
static const char * help_msg_visual[]
static void findNextWord(RzCore *core)
RZ_API void rz_core_visual_jump(RzCore *core, ut8 ch)
RZ_API void rz_core_visual_seek_animation(RzCore *core, ut64 addr)
RZ_API int rz_line_hist_offset_up(RzLine *line)
static const char * print4Formats[PRINT_4_FORMATS]
static void numbuf_append(int ch)
static int follow_ref(RzCore *core, RzList *xrefs, int choice, bool xref_to)
static const char * help_visual[]
static const char * printHexFormats[PRINT_HEX_FORMATS]
static ut64 prevop_addr(RzCore *core, ut64 addr)
static int current5format
static int current0format
static const char * help_msg_visual_fn[]
static bool insert_mode_enabled(RzCore *core)
static void visual_seek_animation(RzCore *core, ut64 addr)
static const char * print5Formats[PRINT_5_FORMATS]
static bool isNumber(RzCore *core, int ch)
static const char * stackPrintCommand(RzCore *core)
static void cursor_prevrow(RzCore *core, bool use_ocur)
RZ_API int rz_line_hist_offset_down(RzLine *line)
RZ_API void rz_core_visual_seek_animation_redo(RzCore *core)
static void prevOpcode(RzCore *core)
static int current3format
static void add_comment(RzCore *core, ut64 addr, const char *prompt)
static bool fill_hist_offset(RzCore *core, RzLine *line, RzCoreSeekItem *csi)
static bool isDisasmPrint(int mode)
RZ_API void rz_core_visual_mark(RzCore *core, ut8 ch)
RZ_API bool rz_core_visual_mark_dump(RzCore *core)
RZ_API void rz_core_visual_mark_seek(RzCore *core, ut8 ch)
RZ_API void rz_core_visual_mark_del(RzCore *core, ut8 ch)
if(dbg->bits==RZ_SYS_BITS_64)
ut64(WINAPI *w32_GetEnabledXStateFeatures)()
RZ_API RzList * rz_analysis_xrefs_get_from(RzAnalysis *analysis, ut64 addr)
RZ_API RzList * rz_analysis_xrefs_get_to(RzAnalysis *analysis, ut64 addr)
RZ_API const char * rz_analysis_xrefs_type_tostring(RzAnalysisXRefType type)
RZ_API RzList * rz_analysis_function_get_xrefs_from(RzAnalysisFunction *fcn)
RZ_API bool rz_core_yank(RzCore *core, ut64 addr, ut64 len)
RZ_API bool rz_core_yank_paste(RzCore *core, ut64 addr, ut64 len)
static bool input(void *ud, zip_uint8_t *data, zip_uint64_t length)
RZ_API bool rz_flag_zone_around(RzFlag *f, ut64 addr, const char **prev, const char **next)
RZ_API RzList * rz_flag_zone_barlist(RzFlag *f, ut64 from, ut64 bsize, int rows)