5 #define INTERACTIVE_MAX_REP 1024
13 #include <sys/types.h>
17 #include <sys/utsname.h>
20 #include <cmd_descs.h>
37 #define DEPRECATED_DEFINE_CMD_DESCRIPTOR(core, cmd_) \
39 RzCmdDescriptor *d = cmd_descriptor(#cmd_, help_msg_##cmd_); \
41 rz_list_append((core)->cmd_descriptors, d); \
45 #define DEPRECATED_DEFINE_CMD_DESCRIPTOR_WITH_DETAIL(core, cmd_) \
47 RzCmdDescriptor *d = cmd_descriptor(#cmd_, help_msg##cmd_); \
49 d->help_detail = help_detail_##cmd_; \
50 rz_list_append((core)->cmd_descriptors, d); \
54 #define DEPRECATED_DEFINE_CMD_DESCRIPTOR_WITH_DETAIL2(core, cmd_) \
56 RzCmdDescriptor *d = cmd_descriptor(#cmd_, help_msg_##cmd_); \
58 d->help_detail = help_detail_##cmd_; \
59 d->help_detail2 = help_detail2_##cmd_; \
60 rz_list_append((core)->cmd_descriptors, d); \
64 #define DEPRECATED_DEFINE_CMD_DESCRIPTOR_SPECIAL(core, cmd_, named_cmd) \
66 RzCmdDescriptor *d = RZ_NEW0(RzCmdDescriptor); \
69 d->help_msg = help_msg_##named_cmd; \
70 rz_list_append((core)->cmd_descriptors, d); \
85 "Usage:",
"$alias[=cmd] [args...]",
"Alias commands and strings (See ?$? for help on $variables)",
86 "$",
"",
"list all defined aliases",
87 "$*",
"",
"list all the aliases as rizin commands in base64",
88 "$**",
"",
"same as above, but using plain text",
89 "$",
"foo:=123",
"alias for 'f foo=123'",
90 "$",
"foo-=4",
"alias for 'f foo-=4'",
91 "$",
"foo+=4",
"alias for 'f foo+=4'",
92 "$",
"foo",
"alias for 's foo' (note that command aliases can override flag resolution)",
93 "$",
"dis=base64:AAA==",
"alias this base64 encoded text to be printed when $dis is called",
94 "$",
"dis=$hello world",
"alias this text to be printed when $dis is called",
95 "$",
"dis=-",
"open cfg.editor to set the new value for dis alias",
96 "$",
"dis=af;pdf",
"create command - analyze to show function",
97 "$",
"test=#!pipe node /tmp/test.js",
"create command - rlangpipe script",
98 "$",
"dis=",
"undefine alias",
99 "$",
"dis",
"execute the previously defined alias",
100 "$",
"dis?",
"show commands aliased by $dis",
101 "$",
"dis?n",
"show commands aliased by $dis, without a new line",
107 "k[s] [key[=value]]",
111 "list namespaces under analysis",
114 "list kv from analysis > meta namespaces",
116 " analysis/meta/meta.0x80404",
117 "get value for meta.0x80404 key",
129 "dump namespace to disk",
132 "List all namespaces and sdb databases in JSON format",
135 "open file into namespace",
138 "enter the sdb query shell",
145 "Usage:",
"[cmd] | [program|H|T|.|]",
"",
146 "",
"[cmd] |?",
"show this help",
147 "",
"[cmd] |",
"disable scr.html and scr.color",
148 "",
"[cmd] |H",
"enable scr.html, respect scr.color",
149 "",
"[cmd] | [program]",
"pipe output of command to program",
150 "",
"[cmd] |.",
"alias for .[cmd]",
155 "Usage:",
"v[*i]",
"",
156 "v",
"",
"open visual panels",
157 "v",
" test",
"load saved layout with name test",
158 "v=",
" test",
"save current layout with name test",
159 "vi",
" test",
"open the file test in 'cfg.editor'",
187 if (
desc->help_msg) {
191 if (
desc->help_detail) {
240 if (!strncmp(core->
lastcmd,
"pd", 2)) {
291 char *q = strchr(
buf,
' ');
292 char *
def = strchr(
buf,
'=');
294 char *nonl = strchr(
buf,
'n');
298 char *prev =
def - 1;
316 if ((
def && q && (
def < q)) || (
def && !q)) {
336 if (
len > 0 && (
def[0] ==
'\'') && (
def[
len - 1] ==
'\'')) {
340 if (!q || (q && q >
def)) {
342 if (!strcmp(
def,
"-")) {
357 }
else if (
desc && !q) {
361 if (nonl ==
desc + 1) {
371 }
else if (
buf[1] ==
'*') {
385 }
else if (!
buf[1]) {
429 char firstLine[128] = { 0 };
430 int len =
read(
fd, (
ut8 *)firstLine,
sizeof(firstLine) - 1);
436 if (!strncmp(firstLine,
"#!/", 3)) {
438 char *nl = strchr(firstLine,
'\n');
442 nl = strchr(firstLine,
' ');
446 nl =
strdup(firstLine + 2);
472 if (!strcmp(
file,
"-")) {
492 char *error_msg =
NULL;
507 #define cmdstr(x) rz_str_newf(x " %s", file);
509 #define cmdstr(x) rz_str_newf(x " '%s'", file);
513 const char *
ext =
p + 1;
515 if (!strcmp(
ext,
"js")) {
521 }
else if (!strcmp(
ext,
"exe")) {
531 }
else if (!strcmp(
ext,
"zig")) {
537 }
else if (!strcmp(
ext,
"d")) {
543 }
else if (!strcmp(
ext,
"go")) {
549 }
else if (!strcmp(
ext,
"rb")) {
555 }
else if (!strcmp(
ext,
"vala")) {
559 }
else if (!strcmp(
ext,
"sh")) {
574 }
else if (!strcmp(
ext,
"pl")) {
580 }
else if (!strcmp(
ext,
"py")) {
615 if (!
line->sdbshell_hist_iter || !
line->sdbshell_hist_iter->n) {
618 line->sdbshell_hist_iter =
line->sdbshell_hist_iter->n;
620 line->buffer.index =
line->buffer.length = strlen(
line->buffer.data);
625 if (!
line->sdbshell_hist_iter || !
line->sdbshell_hist_iter->p) {
628 line->sdbshell_hist_iter =
line->sdbshell_hist_iter->p;
630 line->buffer.index =
line->buffer.length = strlen(
line->buffer.data);
643 char buf[1024], *
out, *tofree;
645 const char *
sp, *
p =
"[sdb]> ";
648 char *cur_pos =
NULL, *cur_cmd =
NULL, *next_cmd =
NULL;
649 char *temp_pos =
NULL, *temp_cmd =
NULL;
664 pj_ko(pj,
"analysis");
665 pj_ka(pj,
"cur_cmd");
668 cur_pos = strchr(
out,
'\n');
684 char *temp = query_result;
686 temp_pos = strchr(temp,
'\n');
725 if (
input[1] ==
' ') {
728 for (
n = o =
p;
n; o =
n) {
741 if (!
line->sdbshell_hist) {
759 line->sdbshell_hist_iter = sdb_hist->
head;
770 if (
input[1] ==
' ') {
773 eprintf(
"Unable to allocate memory\n");
776 char *ns = strchr(
fn,
' ');
790 eprintf(
"Cannot find sdb '%s'\n", ns);
796 eprintf(
"Missing sdb namespace\n");
800 eprintf(
"Usage: ko [file] [namespace]\n");
804 if (
input[1] ==
' ') {
806 char *ns = strchr(
fn,
' ');
814 eprintf(
"Cannot find sdb '%s'\n", ns);
817 eprintf(
"Missing sdb namespace\n");
821 eprintf(
"Usage: kd [file] [namespace]\n");
829 if (
input[0] ==
'\0') {
856 eprintf(
"Panel mode requires scr.interactive=true.\n");
877 eprintf(
"Cannot open file (%s)\n",
sp + 1);
897 eprintf(
"Visual mode requires scr.interactive=true.\n");
916 return rz_cmd_int2status(
ret);
923 return rz_cmd_int2status(
ret);
936 #define __CLOSE_DUPPED_PIPES() \
941 static void rz_w32_cmd_pipe(
RzCore *core,
char *rizin_cmd,
char *shell_cmd) {
942 STARTUPINFO
si = { 0 };
943 PROCESS_INFORMATION pi = { 0 };
944 SECURITY_ATTRIBUTES sa;
946 int fd_out = -1, cons_out = -1;
947 char *_shell_cmd =
NULL;
948 LPTSTR _shell_cmd_ =
NULL;
950 TCHAR *systemdir =
NULL;
951 GetConsoleMode(GetStdHandle(STD_OUTPUT_HANDLE), &
mode);
953 sa.nLength =
sizeof(SECURITY_ATTRIBUTES);
954 sa.bInheritHandle =
TRUE;
955 sa.lpSecurityDescriptor =
NULL;
956 if (!CreatePipe(&
pipe[0], &
pipe[1], &sa, 0)) {
958 goto err_r_w32_cmd_pipe;
960 if (!SetHandleInformation(
pipe[1], HANDLE_FLAG_INHERIT, 0)) {
962 goto err_r_w32_cmd_pipe;
964 si.hStdError = GetStdHandle(STD_ERROR_HANDLE);
965 si.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE);
967 si.dwFlags |= STARTF_USESTDHANDLES;
969 _shell_cmd = shell_cmd;
970 while (*_shell_cmd &&
isspace((
ut8)*_shell_cmd)) {
975 goto err_r_w32_cmd_pipe;
978 _shell_cmd_ = rz_sys_conv_utf8_to_win(_shell_cmd);
981 goto err_r_w32_cmd_pipe;
983 systemdir =
calloc(MAX_PATH,
sizeof(TCHAR));
985 goto err_r_w32_cmd_pipe;
987 int ret = GetSystemDirectory(systemdir, MAX_PATH);
990 goto err_r_w32_cmd_pipe;
992 _tcscat_s(systemdir, MAX_PATH, TEXT(
"\\cmd.exe"));
996 goto err_r_w32_cmd_pipe;
998 fd_out = _open_osfhandle((
intptr_t)
pipe[1], _O_WRONLY | _O_TEXT);
1000 perror(
"_open_osfhandle");
1001 goto err_r_w32_cmd_pipe;
1010 __CLOSE_DUPPED_PIPES();
1011 goto err_r_w32_cmd_pipe;
1014 int ret = WaitForSingleObject(th, 50);
1017 __CLOSE_DUPPED_PIPES();
1018 WaitForSingleObject(pi.hProcess, INFINITE);
1021 ret = WaitForSingleObject(pi.hProcess, 50);
1025 if (GetExitCodeThread(th, &
exit) &&
exit == STILL_ACTIVE) {
1026 CancelSynchronousIo(th);
1028 WaitForSingleObject(th, INFINITE);
1029 __CLOSE_DUPPED_PIPES();
1036 CloseHandle(pi.hProcess);
1039 CloseHandle(pi.hThread);
1042 CloseHandle(
pipe[0]);
1047 if (cons_out != -1) {
1053 SetConsoleMode(GetStdHandle(STD_OUTPUT_HANDLE),
mode);
1055 #undef __CLOSE_DUPPED_PIPES
1060 int stdout_fd, fds[2];
1063 int si, olen,
ret = -1, pipecolor = -1;
1072 if (*shell_cmd ==
'!') {
1090 if (stdout_fd != -1) {
1114 eprintf(
"rz_core_cmd_pipe: Could not pipe\n");
1118 rz_w32_cmd_pipe(core, rizin_cmd, shell_cmd);
1121 #pragma message("rz_core_cmd_pipe UNIMPLEMENTED FOR THIS PLATFORM")
1123 #warning rz_core_cmd_pipe UNIMPLEMENTED FOR THIS PLATFORM
1125 eprintf(
"rz_core_cmd_pipe: unimplemented for this platform\n");
1127 if (pipecolor != -1) {
1143 for (
i = 0;
i < argc;
i++) {
1148 eq = strchr(kv,
'=');
1166 eprintf(
"Missing '=' in e: expression (%s)\n", kv);
1184 if (depth == 0 && *ptr == ch) {
1189 }
else if (*ptr ==
')') {
1201 bool tmpseek =
false;
1202 bool original_tmpseek = core->
tmpseek;
1205 memmove(
cmd,
cmd + 9, strlen(
cmd + 9) + 1);
1206 char *http = strstr(
cmd,
"HTTP");
1215 "Connection: close\r\nContent-Length: %d\r\n\r\n",
1241 if (!icmd || (
cmd[0] ==
'#' &&
cmd[1] !=
'!' &&
cmd[1] !=
'?')) {
1244 if (*icmd && !strchr(icmd,
'"')) {
1246 for (hash = icmd + 1; *hash; hash++) {
1247 if (*hash ==
'\\') {
1257 if (hash && *hash) {
1263 if (!strchr(
cmd,
'\'')) {
1267 colon = strchr(
cmd,
';');
1303 while (rep-- && *
cmd) {
1306 if (ocur_enabled && core->
seltab >= 0) {
1315 char *cr =
strdup(cmdrep);
1318 if (
ret && *
cmd ==
'q') {
1326 if (cr && *cr && orep > 1) {
1340 core->
tmpseek = original_tmpseek;
1345 if (colon && colon[1]) {
1346 for (++colon; *colon ==
';'; colon++) {
1365 if (*
p ==
'\\' &&
p[1] ==
'"') {
1373 char *q = strchr(
p,
'+');
1377 return strchr(
p,
'-');
1406 const char *quotestr =
"`";
1408 char *ptr, *ptr2, *
str;
1409 char *arroba =
NULL;
1412 int pamode = !core->
io->
va;
1413 int i,
ret = 0, pipefd;
1414 bool usemyblock =
false;
1418 bool haveQuote =
false;
1421 bool cmd_tmpseek =
false;
1423 int cmd_ignbithints = -1;
1431 char *$0 = strstr(
cmd,
"$(");
1433 char *$1 = strchr($0 + 2,
')');
1437 memmove($0 + 1, $0 + 2, strlen($0 + 2) + 1);
1439 eprintf(
"Unterminated $() block\n");
1446 if (
cmd[1] ==
'"') {
1456 haveQuote = *
cmd ==
'"';
1470 char *
sc = strchr(
cmd,
';');
1490 if (
p[1] ==
'@' || (
p[1] &&
p[2] ==
'@')) {
1491 char *q = strchr(
p + 1,
'"');
1496 haveQuote = q !=
NULL;
1503 p = strchr(
p + 1,
';');
1506 if (
p && *
p &&
p[1] ==
'>') {
1508 while (*
str ==
'>') {
1513 const bool append =
p[2] ==
'>';
1519 if (
p && *
p &&
p[1] ==
'|') {
1557 if (
cmd[1] !=
'*' && !strstr(
cmd,
")()")) {
1563 if (
cmd[1] ==
'>') {
1574 if (ptr && (ptr[1] ==
' ' || ptr[1] ==
'\t')) {
1612 memmove(ch, ptr, strlen(ptr) + 1);
1616 char *ptr2 = strchr(
cmd,
'`');
1617 if (!ptr2 || (ptr2 && ptr2 > ptr)) {
1621 if (!strcmp(ptr + 1,
"?")) {
1625 }
else if (!strncmp(ptr + 1,
"H", 1)) {
1628 }
else if (!strcmp(ptr + 1,
".")) {
1632 }
else if (ptr[1]) {
1661 while (ptr && *ptr && ptr[1] ==
'&') {
1666 if (scr_html != -1) {
1669 if (scr_color != -1) {
1678 ptr = strchr(
cmd,
'&');
1681 ptr = strstr(
cmd,
"?*");
1682 if (ptr && (ptr ==
cmd || ptr[-1] !=
'~')) {
1686 if (
cmd < ptr && ptr[-1] ==
'?') {
1688 if (
cmd < ptr - 1 && ptr[-2] ==
'?') {
1696 if (scr_html != -1) {
1699 if (scr_color != -1) {
1714 memmove(ch, ptr, strlen(ptr) + 1);
1718 if (ptr[0] && ptr[1] ==
'?') {
1725 int use_editor =
false;
1728 str = ptr + 1 + (ptr[1] ==
'>');
1738 char *fdnum = ptr - 1;
1739 if (*fdnum ==
'H') {
1752 if (!strcmp(
str,
"-")) {
1757 const bool appendResult = (ptr[1] ==
'>');
1782 }
else if (fdn > 0) {
1800 if (editor && *editor) {
1804 eprintf(
"No cfg.editor configured\n");
1809 if (scr_html != -1) {
1812 if (scr_color != -1) {
1821 ptr = strchr(
cmd,
'`');
1826 memmove(ch, ptr, strlen(ptr) + 1);
1827 goto escape_backtick;
1832 if (ptr[1] ==
'`') {
1833 memmove(ptr, ptr + 1, strlen(ptr));
1837 ptr2 = strchr(ptr + 1,
'`');
1841 eprintf(
"parse: Missing backtick in expression.\n");
1847 if (ptr[1] ==
'!') {
1862 if (*
str ==
'|' || *
str ==
'*') {
1863 eprintf(
"rz_core_cmd_subst_i: invalid backticked command\n");
1867 if (oneline &&
str) {
1868 for (
i = 0;
str[
i];
i++) {
1869 if (
str[
i] ==
'\n') {
1879 if (scr_html != -1) {
1889 if (*
cmd !=
'"' && *
cmd) {
1890 const char *
s = strstr(
cmd,
"~?");
1892 bool showHelp =
false;
1900 if (!strcmp(
s,
"~??")) {
1918 ptr = strchr(
cmd,
'@');
1919 if (ptr ==
cmd + 1 && *
cmd ==
'?') {
1929 char *
f, *ptr2 = strchr(ptr + 1,
'!');
1931 bool addr_is_set =
false;
1932 char *tmpbits =
NULL;
1933 const char *offstr =
NULL;
1934 bool is_bits_set =
false;
1935 bool is_arch_set =
false;
1936 char *tmpeval =
NULL;
1937 char *tmpasm =
NULL;
1938 bool flgspc_changed =
false;
1946 arroba = (ptr[0] && ptr[1] && ptr[2]) ? strchr(ptr + 2,
'@') :
NULL;
1951 for (; *ptr ==
' '; ptr++) {
1954 if (*ptr && ptr[1] ==
':') {
1962 if (ptr[1] ==
'?') {
1964 }
else if (ptr[1] ==
'%') {
1966 char *
v = strchr(
k,
'=');
1974 }
else if (ptr[1] ==
'.') {
1975 if (ptr[2] ==
'.') {
1976 if (ptr[3] ==
'.') {
1983 cmd_tmpseek = core->
tmpseek =
true;
1988 eprintf(
"TODO: what do you expect for @. import offset from file maybe?\n");
1990 }
else if (ptr[0] && ptr[1] ==
':' && ptr[2]) {
1993 flgspc_changed = rz_flag_space_push(core->
flags, ptr + 2);
1999 cmd_tmpseek = core->
tmpseek =
true;
2021 eprintf(
"cannot open '%s'\n", ptr + 3);
2025 if (ptr[1] ==
':') {
2027 char *mander =
strdup(ptr + 2);
2041 cmd_tmpseek = core->
tmpseek =
true;
2053 cmd_tmpseek = core->
tmpseek =
true;
2067 if (ptr[1] ==
':') {
2095 eprintf(
"Invalid @v: syntax\n");
2099 if (ptr[1] ==
':') {
2120 eprintf(
"Error: Invalid hexpairs for @x:\n");
2127 eprintf(
"Invalid @x: syntax\n");
2140 if (ptr[1] ==
':') {
2146 if (ptr[1] ==
':') {
2147 char *q = strchr(ptr + 2,
':');
2155 eprintf(
"Usage: pd 10 @a:arm:32\n");
2160 len = strlen(ptr + 2);
2167 if (!core->
io->
va) {
2190 char *
trim = ptr - 2;
2204 if (strlen(ptr + 1) == 13 && strlen(ptr2 + 1) == 6 &&
2205 !memcmp(ptr + 1,
"0x", 2) &&
2206 !memcmp(ptr2 + 1,
"0x", 2)) {
2208 }
else if (strlen(ptr + 1) == 9 && strlen(ptr2 + 1) == 4) {
2228 eprintf(
"Invalid address (%s)\n", ptr + 1);
2233 if (ch ==
'-' || ch ==
'+') {
2255 if (ptr[1] ==
'@') {
2256 if (ptr[2] ==
'@') {
2257 char *rule = ptr + 3;
2258 while (*rule && *rule ==
' ') {
2266 bool tmpseek =
false;
2267 const char *fromvars[] = {
"analysis.from",
"diff.from",
"graph.from",
"search.from",
"zoom.from",
NULL };
2268 const char *tovars[] = {
"analysis.to",
"diff.to",
"graph.to",
"search.to",
"zoom.to",
NULL };
2272 if (ptr[1] ==
'{') {
2273 char *
range = ptr + 2;
2274 char *
p = strchr(
range,
' ');
2276 eprintf(
"Usage: / ABCD @{0x1000 0x3000}\n");
2277 eprintf(
"Run command and define the following vars:\n");
2278 eprintf(
" (analysis|diff|graph|search|zoom).{from,to}\n");
2285 int arg_len = strlen(
arg);
2287 arg[arg_len - 1] = 0;
2293 for (
i = 0; fromvars[
i];
i++) {
2296 for (
i = 0; tovars[
i];
i++) {
2300 for (
i = 0; fromvars[
i];
i++) {
2303 for (
i = 0; tovars[
i];
i++) {
2324 for (
i = 0; fromvars[
i];
i++) {
2327 for (
i = 0; tovars[
i];
i++) {
2363 if (flgspc_changed) {
2364 rz_flag_space_pop(core->
flags);
2379 char *old_grep = grep;
2384 if (scr_html != -1) {
2388 if (scr_color != -1) {
2399 *tmpseek = cmd_tmpseek;
2401 if (cmd_ignbithints != -1) {
2424 for (
arg = each;;) {
2428 char *next = strchr(
arg,
' ');
2457 if (each[0] && each[1] ==
':') {
2474 eprintf(
"Usage: @@@c:command # same as @@@=`command`\n");
2548 rz_list_foreach (
head,
iter, item) {
2552 if (item->
type !=
i) {
2557 const char *item_name;
2558 rz_list_foreach (
list,
iter, item_name) {
2574 rz_list_foreach (
list,
iter, imp) {
2583 rz_list_foreach (lost,
iter, naddr) {
2611 if (each[1] ==
'S') {
2616 rz_list_foreach (obj->
sections, it, sec) {
2623 rz_core_seek_size(core,
addr,
size);
2631 if (each[1] ==
't') {
2642 rz_list_foreach (lost,
iter,
s) {
2659 rz_list_foreach (
list,
iter, sym) {
2663 rz_list_foreach (lost,
iter, sym) {
2703 rz_list_foreach (
list,
iter, fcn) {
2724 rz_list_foreach (fcn->
bbs,
iter, bb) {
2739 char *nextLine =
NULL;
2744 while (*each ==
' ') {
2752 char *nl = strchr(each,
'\n');
2760 nl = strchr(each,
'#');
2765 while (each && *each) {
2767 while (*each ==
' ') {
2770 char *
str = strchr(each,
' ');
2807 for (; *
cmd ==
' ';
cmd++) {
2836 rz_list_foreach (fcn->
bbs,
iter, bb) {
2850 char *
str = each + 1;
2851 if (*
str ==
':' || *
str ==
' ') {
2868 eprintf(
"Usage: cmd @@s:from to step\n");
2880 rz_list_foreach (fcn->
bbs,
iter, bb) {
2894 if (each[1] ==
':') {
2899 if (each[2] && strstr(fcn->
name, each + 2)) {
2950 if (each[1] ==
':') {
2962 if (each[1] ==
'b' && each[2] ==
't') {
2969 rz_list_foreach (
list,
iter, frame) {
2989 eprintf(
"Invalid for-each statement. Use @@=dbt[abs]\n");
2999 while (*each ==
' ') {
3005 str = strchr(each,
' ');
3024 if (each[1] ==
'(') {
3028 for (core->
rcmd->
macro.
counter = 0; i < 999; core->rcmd->macro.counter++) {
3051 if (!fgets(
buf,
sizeof(
buf),
fd)) {
3063 eprintf(
"cannot open file '%s' to read offsets\n", each + 1);
3069 for (; *each ==
' '; each++) {
3075 for (;
str[j] &&
str[j] ==
' '; j++) {
3089 const RzSpace *flagspace = rz_flag_space_cur(core->
flags);
3091 if (!match_flag_items) {
3100 .
ret = match_flag_items,
3106 rz_list_foreach (match_flag_items,
iter, flag) {
3171 #define TS_START_END(node, start, end) \
3173 start = ts_node_start_byte(node); \
3174 end = ts_node_end_byte(node); \
3187 start -= parent_start;
3188 end -= parent_start;
3192 #define DEFINE_SYMBOL_TS_FCN(name) TSSymbol ts_##name##_symbol
3194 #define DEFINE_IS_TS_FCN(name) \
3195 static inline bool is_ts_##name(TSNode node) { \
3196 return ts_node_symbol(node) == ts_##name##_symbol; \
3199 #define DEFINE_IS_TS_FCN_AND_SYMBOL(name) \
3200 DEFINE_SYMBOL_TS_FCN(name); \
3201 DEFINE_IS_TS_FCN(name)
3203 #define DEFINE_HANDLE_TS_FCN(name) \
3204 static RzCmdStatus handle_ts_##name##_internal(struct tsr2cmd_state *state, TSNode node, char *node_string); \
3205 static RzCmdStatus handle_ts_##name(struct tsr2cmd_state *state, TSNode node) { \
3206 char *node_string = ts_node_sub_string(node, state->input); \
3207 RZ_LOG_DEBUG(#name ": '%s'\n", node_string); \
3208 RzCmdStatus res = handle_ts_##name##_internal(state, node, node_string); \
3209 free(node_string); \
3212 static RzCmdStatus handle_ts_##name##_internal(struct tsr2cmd_state *state, TSNode node, char *node_string)
3214 #define DEFINE_HANDLE_TS_FCN_AND_SYMBOL(name) \
3215 DEFINE_SYMBOL_TS_FCN(name); \
3216 DEFINE_HANDLE_TS_FCN(name)
3218 #define UPDATE_CMD_STATUS_RES(res, cmd_res, label) \
3219 if ((cmd_res) != RZ_CMD_STATUS_OK) { \
3237 .args = (
const char **)&
argv[1],
3238 .args_size = argc - 1,
3265 const char *static_str;
3341 if (
e->start_point.row == command_point.
row) {
3342 e->start_point.column -= command_point.
column;
3344 if (
e->end_point.row == command_point.
row) {
3345 e->end_point.column -= command_point.
column;
3347 e->start_point.row -= command_point.
row;
3348 e->end_point.row -= command_point.
row;
3355 while (*
s && *
s !=
'\r' && *
s !=
'\n') {
3429 return is_ts_args(
args) || is_ts_concatenation(
args) ||
3430 is_ts_double_quoted_arg(
args) ||
3431 is_ts_pf_concatenation(
args) || is_ts_pf_args(
args) ||
3432 is_ts_pf_dot_cmd_args(
args) || is_ts_pf_new_args(
args) ||
3433 is_ts_grep_specifier(
args);
3437 return is_ts_arg(
args) || is_ts_pf_arg(
args);
3442 is_ts_cmd_substitution_arg(
args) || is_ts_grep_specifier(
args);
3449 for (
i = 0;
i < n_children;
i++) {
3453 }
else if (is_ts_cmd_substitution_arg(
args)) {
3462 if (is_ts_arg(
arg)) {
3464 }
else if (is_ts_arg_identifier(
arg)) {
3468 return unescaped_arg;
3469 }
else if (is_ts_single_quoted_arg(
arg) || is_ts_double_quoted_arg(
arg)) {
3471 char *arg_str = o_arg_str;
3474 arg_str[strlen(arg_str) - 1] =
'\0';
3478 if (is_ts_single_quoted_arg(
arg)) {
3485 }
else if (is_ts_concatenation(
arg)) {
3488 for (
i = 0;
i < n_children;
i++) {
3503 }
else if (is_ts_args(
args)) {
3506 char **unescaped_args =
RZ_NEWS0(
char *, n_children);
3507 for (
i = 0;
i < n_children;
i++) {
3512 for (
i = 0;
i < n_children;
i++) {
3513 free(unescaped_args[
i]);
3515 free(unescaped_args);
3520 free(unescaped_args[0]);
3530 rz_list_foreach (edits, it, edit) {
3540 if (
state->tree != saved_tree) {
3543 state->tree = saved_tree;
3546 if (
state->input != saved_input) {
3549 state->input = saved_input;
3573 state->tree = new_tree;
3619 if (!cmdname_help) {
3644 char *command_str =
NULL, *command_extra_str =
NULL;
3647 RZ_LOG_DEBUG(
"command_extra_str = '%s'\n", command_extra_str);
3657 RZ_LOG_DEBUG(
"arged_stmt command: '%s'\n", command_str);
3663 if (!strcmp(command_str,
"|.")) {
3670 free(command_extra_str);
3690 pr_args->
extra = command_extra_str;
3695 eprintf(
"Wrong number of arguments passed to `%s`, see its help with `%s?`\n\n", cmdname, cmdname);
3699 eprintf(
"Command '%s' does not exist.\n", cmdname);
3701 eprintf(
"Did you want to see the help? Try `%s` without any argument.\n", cmdname);
3707 eprintf(
"Displaying the help of command '%s'.\n\n", hcd->
name);
3716 RZ_LOG_DEBUG(
"arged_stmt finished command: '%s'\n", command_str);
3729 int rep = atoi(number_str);
3734 if (!
rz_cons_yesno(
'n',
"Are you sure to repeat this %d times? (y/N)", rep)) {
3741 for (
i = 0;
i < rep;
i++) {
3757 if (is_ts_fdn_redirect_operator(redirect_op)) {
3759 }
else if (is_ts_fdn_append_operator(redirect_op)) {
3761 }
else if (is_ts_html_redirect_operator(redirect_op)) {
3763 }
else if (is_ts_html_append_operator(redirect_op)) {
3767 RZ_LOG_ERROR(
"This should never happen, redirect_operator is no known type");
3791 if (arg_str[0] ==
'$') {
3793 RZ_LOG_DEBUG(
"redirect_stmt: alias = '%s'\n", arg_str);
3799 char *new_alias_value;
3800 const char *start_char =
"$";
3801 if (is_append && old_alias_value) {
3804 old_alias_value =
"";
3809 free(new_alias_value);
3814 RZ_LOG_DEBUG(
"redirect_stmt: fdn = %d, is_append = %d\n", fdn, is_append);
3833 if (scr_html != -1) {
3906 size_t node_str_len = strlen(node_string);
3907 if (node_str_len >= 2 && !strcmp(node_string + node_str_len - 2,
"?*")) {
3908 node_string[node_str_len - 2] = 0;
3909 const char *
argv[2] = {
NULL, node_string };
3911 }
else if (node_str_len >= 3 && !strcmp(node_string + node_str_len - 3,
"?*j")) {
3912 node_string[node_str_len - 3] = 0;
3913 const char *
argv[2] = {
NULL, node_string };
3958 if (!offset_val &&
isalpha((
int)offset_string[0])) {
3960 eprintf(
"Invalid address (%s)\n", offset_string);
3961 free(offset_string);
3965 if (offset_string[0] ==
'-' || offset_string[0] ==
'+') {
3966 offset_val +=
state->core->offset;
3972 free(offset_string);
3980 ut64 orig_blksz =
state->core->blocksize;
3981 RZ_LOG_DEBUG(
"tmp_blksz_stmt, changing blksz to %s\n", blksz_string);
3994 if (!
a ||
a->argc != 2 + 1) {
3999 char *from_str =
a->argv[1];
4000 char *to_str =
a->argv[2];
4002 const char *fromvars[] = {
"analysis.from",
"diff.from",
"graph.from",
4003 "search.from",
"zoom.from",
NULL };
4004 const char *tovars[] = {
"analysis.to",
"diff.to",
"graph.to",
4005 "search.to",
"zoom.to",
NULL };
4012 for (
i = 0; fromvars[
i];
i++) {
4016 for (
i = 0; tovars[
i];
i++) {
4035 char *tmparch, *tmpbits;
4036 bool is_arch_set =
false, is_bits_set =
false;
4038 int cmd_ignbithints = -1;
4041 char *q = strchr(arg_str,
':');
4063 if (cmd_ignbithints != -1) {
4077 int cmd_ignbithints;
4121 for (
i = 0;
i < n_args;
i++) {
4124 char *
eq = strchr(arg_str,
'=');
4130 eprintf(
"Missing '=' in e: expression (%s)\n", arg_str);
4147 rz_flag_space_push(core->
flags, arg_str);
4149 rz_flag_space_pop(core->
flags);
4217 int pamode = !core->
io->
va;
4223 eprintf(
"Cannot open io buffer\n");
4259 eprintf(
"Cannot open '%s'\n", arg_str);
4277 sz = strlen(arg_str);
4312 size_t len = strlen(arg_str);
4327 char *arg_str =
NULL;
4331 const RzSpace *flagspace = rz_flag_space_cur(core->
flags);
4336 if (!match_flag_items) {
4344 .
ret = match_flag_items,
4350 rz_list_foreach (match_flag_items,
iter, flag) {
4383 rz_list_foreach (
list,
iter, frame) {
4437 if (!fgets(
buf,
sizeof(
buf),
fd)) {
4462 rz_cmd_parsed_args_foreach_arg(
a,
i,
s) {
4496 if (!
a || (has_size && (
a->argc - 1) % 2 != 0)) {
4522 if (!bbl || rz_list_empty(bbl)) {
4523 eprintf(
"No basic block contains current address\n");
4554 if (!
a ||
a->argc != 3 + 1) {
4564 char *from_str =
a->argv[1];
4565 char *to_str =
a->argv[2];
4566 char *step_str =
a->argv[3];
4616 rz_list_foreach (fcn->
bbs,
iter, bb) {
4743 rz_list_foreach (
list,
iter, imp) {
4753 rz_list_foreach (lost,
iter, naddr) {
4783 rz_list_foreach (
head,
iter, item) {
4787 if (item->
type !=
i) {
4792 const char *item_name;
4793 rz_list_foreach (
list,
iter, item_name) {
4817 rz_list_foreach (
list,
iter, sym) {
4822 rz_list_foreach (lost,
iter, sym) {
4854 rz_list_foreach (lost,
iter,
s) {
4935 if (!dbg_maps_addrs) {
4948 rz_list_foreach (dbg_maps_addrs,
iter, map_addr) {
4974 rz_list_foreach (
list,
iter, fcn) {
5023 bool is_pipe =
state->core->is_pipe;
5024 state->core->is_pipe =
true;
5026 state->core->is_pipe = is_pipe;
5033 RZ_LOG_DEBUG(
"grep_stmt processed specifier: '%s'\n", specifier_str);
5035 free(specifier_str_es);
5047 if (scr_html != -1) {
5051 if (scr_color != -1) {
5062 if (scr_html != -1) {
5075 if (
a &&
a->argc > 1) {
5091 if (*
state->input ==
'q') {
5094 }
else if (*
state->input !=
'=' && strncmp(
state->input,
"!=", 2)) {
5113 bool is_lastcmd =
state->core->is_lastcmd;
5114 state->core->is_lastcmd =
false;
5116 ret = handler(
state, node);
5120 if (
state->log && !
state->core->is_lastcmd) {
5124 state->core->is_lastcmd = is_lastcmd;
5131 bool saved_tmpseek = core->
tmpseek;
5134 core->
tmpseek = saved_tmpseek;
5144 RZ_LOG_DEBUG(
"commands with %d childs\n", child_count);
5145 if (child_count == 0 && !*
state->input) {
5155 if (
state->split_lines) {
5158 for (
i = 0;
i < child_count;
i++) {
5160 RZ_LOG_ERROR(
"handle_ts_statements: That was too deep...\n");
5174 if (
state->split_lines) {
5181 eprintf(
"Error while executing command: %s\n", command_str);
5195 if (
state->split_lines) {
5201 #define HANDLER_RULE_OP(name) { #name, handle_ts_##name },
5202 #define RULE_OP(name)
5209 #define RULE_OP(name) { #name, &ts_##name##_symbol },
5210 #define HANDLER_RULE_OP(name) RULE_OP(name)
5281 res = handle_ts_statements(&
state,
root);
5301 eprintf(
"rz_core_cmd: That was too deep (%s)...\n",
cmd);
5305 for (rcmd =
cmd;;) {
5306 char *ptr = strchr(rcmd,
'\n');
5312 eprintf(
"|ERROR| Invalid command '%s' (0x%02x)\n", rcmd, *rcmd);
5401 ptr = strchr(
str,
'\n');
5406 ptr = strchr(
str,
'\n');
5418 vsnprintf(
string,
sizeof(
string), fmt, ap);
5440 char *
p = (*
cmd !=
'"') ? strchr(
cmd,
'|') :
NULL;
5441 if (!
p && *
cmd !=
'!' && *
cmd !=
'.') {
5477 vsnprintf(
string,
sizeof(
string), fmt, ap);
5484 const char *static_str;
5541 for (
p = (
const ut8 *)y->
cmd; *
p;
p++) {
5551 eprintf(
"Command '%s' is duplicated, please check\n", y->
cmd);
5604 ut32 pointer_size = 0;
5607 }
else if (!strcmp(
argv[1],
"32")) {
5609 }
else if (!strcmp(
argv[1],
"64")) {
RZ_API RzAnalysisFunction * rz_analysis_get_function_at(RzAnalysis *analysis, ut64 addr)
RZ_API ut64 rz_analysis_function_linear_size(RzAnalysisFunction *fcn)
const char * ts_node_type(TSNode)
void ts_parser_delete(TSParser *parser)
TSNode ts_node_named_child(TSNode, uint32_t)
uint32_t ts_node_start_byte(TSNode)
char * ts_node_string(TSNode)
TSNode ts_node_child(TSNode, uint32_t)
uint32_t ts_node_named_child_count(TSNode)
bool ts_node_is_null(TSNode)
TSNode ts_node_child_by_field_name(TSNode self, const char *field_name, uint32_t field_name_length)
TSSymbol ts_node_symbol(TSNode)
void ts_tree_delete(TSTree *self)
TSPoint ts_node_start_point(TSNode)
TSNode ts_tree_root_node(const TSTree *self)
bool ts_parser_set_language(TSParser *self, const TSLanguage *language)
bool ts_node_has_error(TSNode)
uint32_t ts_node_end_byte(TSNode)
TSParser * ts_parser_new(void)
TSNode ts_node_parent(TSNode)
TSTree * ts_parser_parse_string(TSParser *self, const TSTree *old_tree, const char *string, uint32_t length)
TSSymbol ts_language_symbol_for_name(const TSLanguage *self, const char *string, uint32_t length, bool is_named)
TSPoint ts_node_end_point(TSNode)
static const char * arg(RzAnalysis *a, csh *handle, cs_insn *insn, char *buf, int n)
RZ_API RzBinObject * rz_bin_cur_object(RzBin *bin)
RZ_DEPRECATE RZ_API RZ_BORROW RzList * rz_bin_get_imports(RZ_NONNULL RzBin *bin)
RZ_DEPRECATE RZ_API RZ_BORROW RzList * rz_bin_get_symbols(RZ_NONNULL RzBin *bin)
RZ_DEPRECATE RZ_API RZ_BORROW RzList * rz_bin_get_strings(RZ_NONNULL RzBin *bin)
static RzList * maps(RzBinFile *bf)
static RzBinSourceLineInfo * lines(RzBinFile *bf)
int bits(struct state *s, int need)
RZ_API void rz_analysis_block_ref(RzAnalysisBlock *bb)
RZ_API ut64 rz_analysis_block_get_op_size(RzAnalysisBlock *bb, size_t i)
RZ_API ut64 rz_analysis_block_get_op_addr(RzAnalysisBlock *block, size_t i)
RZ_API void rz_analysis_block_unref(RzAnalysisBlock *bb)
RZ_API RzList * rz_analysis_get_blocks_in(RzAnalysis *analysis, ut64 addr)
const lzma_allocator const uint8_t size_t uint8_t * out
RZ_IPI void rzshell_cmddescs_init(RzCore *core)
RZ_IPI int rz_cmd_debug(void *data, const char *input)
RZ_IPI int rz_cmd_print(void *data, const char *input)
RZ_IPI int rz_cmd_analysis(void *data, const char *input)
RZ_IPI int rz_cmd_macro(void *data, const char *input)
RZ_IPI int rz_cmd_search(void *data, const char *input)
RZ_IPI int rz_cmd_hexdump(void *data, const char *input)
RZ_IPI int rz_equal_H_handler_old(void *data, const char *input)
RZ_IPI int rz_cmd_help(void *data, const char *input)
RZ_API int rz_type_parse_file(RzTypeDB *typedb, const char *path, const char *dir, char **error_msg)
Parses the C types file creating the new parser state.
RZ_API bool rz_core_bin_basefind_print(RzCore *core, ut32 pointer_size, RzCmdStateOutput *state)
RZ_API void rz_core_sysenv_begin(RzCore *core)
RZ_API void rz_core_sysenv_end(RzCore *core)
RZ_API int rz_core_block_read(RzCore *core)
static const char * help_msg_dollar[]
static RzCmdStatus iter_offsets_common(struct tsr2cmd_state *state, TSNode node, bool has_size)
static char * do_handle_ts_unescape_arg(struct tsr2cmd_state *state, TSNode arg, bool do_unwrap)
static RzCmdStatus core_cmd_pipe(RzCore *core, struct tsr2cmd_state *state, TSNode rizin_cmd, int argc, char **argv)
Executes a rizin command and pipes the result to the stdin of the program specified in argc/argv.
RZ_IPI RzCmdStatus rz_push_escaped_handler(RzCore *core, int argc, const char **argv)
static bool set_tmp_bits(RzCore *core, int bits, char **tmpbits, int *cmd_ignbithints)
RZ_IPI int rz_cmd_kuery(void *data, const char *input)
RZ_API int rz_core_cmd_foreach3(RzCore *core, const char *cmd, char *each)
struct ts_data_symbol_map map_ts_symbols[]
RZ_API int rz_line_hist_sdb_up(RzLine *line)
static char * find_eoq(char *p)
static int rz_core_cmd_subst(RzCore *core, char *cmd)
static void replace_whitespaces(char *s, char ch)
RZ_API char * rz_core_cmd_str_pipe(RzCore *core, const char *cmd)
static void foreach_pairs(RzCore *core, const char *cmd, const char *each)
static void foreachOffset(RzCore *core, const char *_cmd, const char *each)
#define TS_START_END(node, start, end)
static void handle_substitution_args(struct tsr2cmd_state *state, TSNode args, RzList *edits)
RZ_API RzCmd * rz_core_cmd_new(bool has_cons)
Create an instance of RzCmd for the Rizin language.
RZ_API void rz_save_panels_layout(RzCore *core, const char *_name)
RZ_API int rz_core_cmd_buffer(RzCore *core, const char *buf)
RZ_API int rz_line_hist_sdb_down(RzLine *line)
static char * parse_tmp_evals(RzCore *core, const char *str)
static char * ts_node_handle_arg(struct tsr2cmd_state *state, TSNode command, TSNode arg, uint32_t child_idx)
static bool substitute_args_do(struct tsr2cmd_state *state, RzList *edits, TSNode *new_command)
static char * ts_node_sub_parent_string(TSNode parent, TSNode node, const char *cstr)
static ut8 * core_cmd_raw_node(RzCore *core, struct tsr2cmd_state *state, TSNode rizin_cmd, int *length)
RZ_API int rz_core_cmd_lines(RzCore *core, const char *lines)
static void cmd_descriptor_init(RzCore *core)
static void substitute_args_init(struct tsr2cmd_state *state, TSNode command)
static char * langFromHashbang(RzCore *core, const char *file)
static struct tsr2cmd_edit * create_cmd_edit(struct tsr2cmd_state *state, TSNode arg, char *new_text)
RZ_IPI int rz_cmd_alias(void *data, const char *input)
RZ_API int rz_core_cmd0(RzCore *core, const char *cmd)
#define DEFINE_HANDLE_TS_FCN(name)
#define DEPRECATED_DEFINE_CMD_DESCRIPTOR_SPECIAL(core, cmd_, named_cmd)
RZ_IPI RzCmdStatus rz_last_output_handler(RzCore *core, int argc, const char **argv)
static const char * help_msg_k[]
static bool help_search_cmd_desc_entry(RzCmd *cmd, const RzCmdDesc *cd, void *user)
static bool set_tmp_arch(RzCore *core, char *arch, char **tmparch)
RZ_API ut8 * rz_core_cmd_raw(RzCore *core, const char *cmd, int *length)
Executes a rizin command and returns the raw stdout and its length.
RZ_API int rz_core_cmd_foreach(RzCore *core, const char *cmd, char *each)
RZ_API void rz_core_cmd_help(const RzCore *core, const char *help[])
RZ_API int rz_core_cmd(RzCore *core, const char *cstr, int log)
RZ_IPI RzCmdStatus rz_cmd_help_search_handler(RzCore *core, int argc, const char **argv, RzOutputMode mode)
static bool iter_dbt_commands(struct tsr2cmd_state *state, TSNode node, enum dbt_commands_mode mode)
#define DEFINE_HANDLE_TS_FCN_AND_SYMBOL(name)
RZ_IPI int rz_cmd_visual(void *data, const char *input)
static ut8 * core_cmd_raw(RzCore *core, const char *cmd, int *length)
RZ_API int rz_core_cmd_file(RzCore *core, const char *file)
RZ_API bool rz_load_panels_layout(RzCore *core, const char *_name)
RZ_IPI RzCmdStatus rz_basefind_compute_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
RZ_API int rz_core_cmd_command(RzCore *core, const char *command)
static RzCmdStatus core_cmd_tsrzcmd(RzCore *core, const char *cstr, bool split_lines, bool log)
RZ_API bool rz_core_run_script(RzCore *core, RZ_NONNULL const char *file)
static TSTree * apply_edits(struct tsr2cmd_state *state, RzList *edits)
RZ_API char * rz_core_cmd_strf(RzCore *core, const char *fmt,...)
static int run_cmd_depth(RzCore *core, char *cmd)
static int rz_core_cmd_subst_i(RzCore *core, char *cmd, char *colon, bool *tmpseek)
void free_tsr2cmd_edit(struct tsr2cmd_edit *edit)
static RzCmdDescriptor * cmd_descriptor(const char *cmd, const char *help[])
RZ_IPI RzCmdStatus rz_pointer_handler(RzCore *core, int argc, const char **argv)
static RzCmdStatus do_iter_offsets(RzCore *core, struct tsr2cmd_state *state, TSNode *command, RzCmdParsedArgs *a, bool has_size)
RZ_API void rz_core_cmd_init(RzCore *core)
static bool handle_tmp_desc(struct tsr2cmd_state *state, TSNode command, const ut8 *buf, int sz)
static char * system_exec_stdin(bool is_pipe, int argc, char **argv, const ut8 *input, int input_len, int *length)
#define DEFINE_IS_TS_FCN_AND_SYMBOL(name)
#define UPDATE_CMD_STATUS_RES(res, cmd_res, label)
static bool duplicate_flag(RzFlagItem *flag, void *u)
static bool callback_foreach_kv(void *user, const char *k, const char *v)
static RzCmdParsedArgs * ts_node_handle_arg_prargs(struct tsr2cmd_state *state, TSNode command, TSNode arg, uint32_t child_idx, bool do_unwrap)
static int core_cmd0_wrapper(void *core, const char *cmd)
RZ_API int rz_core_cmdf(RzCore *core, const char *fmt,...)
RZ_API RzCmdStatus rz_core_cmd_lines_rzshell(RzCore *core, const char *lines)
RZ_IPI bool rz_core_cmd_lastcmd_repeat(RzCore *core, bool next)
static bool is_macro_command(const char *ptr)
RZ_API RzCmdStatus rz_core_cmd0_rzshell(RzCore *core, const char *cmd)
static void recursive_help_go(RzCore *core, int detail, RzCmdDescriptor *desc)
static RzCmdParsedArgs * parse_args(struct tsr2cmd_state *state, TSNode args, bool do_unwrap)
static int rz_core_cmd_nullcallback(void *data)
static const char * help_msg_v[]
static RzCmdStatus handle_ts_stmt(struct tsr2cmd_state *state, TSNode node)
#define DEPRECATED_DEFINE_CMD_DESCRIPTOR(core, cmd_)
static int compare_cmd_descriptor_name(const void *a, const void *b)
static void tmpenvs_free(void *item)
RZ_API char * rz_core_disassemble_instr(RzCore *core, ut64 addr, int l)
static void get_help_wrong_cmd(RzCore *core, const char *cmdname)
RZ_IPI int rz_cmd_panels(void *data, const char *input)
static RzCmdStatus do_iter_sections(struct tsr2cmd_state *state, TSNode node, bool show_sections)
static bool substitute_args(struct tsr2cmd_state *state, TSNode args, TSNode *new_command)
RZ_API char * rz_core_cmd_str(RzCore *core, const char *cmd)
Executes a rizin command and returns the stdout as a string.
static int lang_run_file(RzCore *core, RzLang *lang, const char *file)
static char * findSeparator(char *p)
RZ_API RzCmdStatus rz_core_cmd_rzshell(RzCore *core, const char *cstr, int log)
TSLanguage * tree_sitter_rzcmd()
RZ_API char * rz_core_disassemble_bytes(RzCore *core, ut64 addr, int b)
static char * find_ch_after_macro(char *ptr, char ch)
static const char * help_msg_vertical_bar[]
static void recursive_help(RzCore *core, int detail, const char *cmd_prefix)
RZ_API int rz_core_cmd_pipe_old(RzCore *core, char *rizin_cmd, char *shell_cmd)
static char * ts_node_sub_string(TSNode node, const char *cstr)
static int bb_cmp(const void *a, const void *b)
static bool is_group_of_args(TSNode args)
static bool is_arg(TSNode args)
#define INTERACTIVE_MAX_REP
RZ_IPI void rz_core_kuery_print(RzCore *core, const char *k)
struct _search_help RzHelpSearch
RZ_API int rz_core_flush(RzCore *core, const char *cmd)
struct ts_data_symbol_map map_ts_stmt_handlers[]
static RzCmdStatus handle_ts_stmt_tmpseek(struct tsr2cmd_state *state, TSNode node)
static void substitute_args_fini(struct tsr2cmd_state *state)
static bool copy_into_flagitem_list(RzFlagItem *flg, void *u)
RzCmdStatus(* ts_handler)(struct tsr2cmd_state *state, TSNode node)
static bool is_handled_args(TSNode args)
static char * do_handle_substitution_cmd(struct tsr2cmd_state *state, TSNode inn_cmd)
static void handle_cmd_substitution_arg(struct tsr2cmd_state *state, TSNode arg, RzList *edits)
RZ_API RzCmdParsedArgs * rz_cmd_parsed_args_newargs(int n_args, char **args)
RZ_API bool rz_cmd_get_help_json(RzCmd *cmd, const RzCmdDesc *cd, PJ *j)
Generates a JSON output of the given help message description.
RZ_API RzCmdDesc * rz_cmd_get_desc(RzCmd *cmd, const char *cmd_identifier)
Retrieve the command descriptor for the command named cmd_identifier.
RZ_API char * rz_cmd_parsed_args_argstr(RzCmdParsedArgs *a)
RZ_API const char * rz_cmd_parsed_args_cmd(RzCmdParsedArgs *a)
RZ_API void rz_cmd_foreach_cmdname(RzCmd *cmd, RzCmdDesc *begin, RzCmdForeachNameCb cb, void *user)
Execute a callback function on each possible command the user can execute.
RZ_API bool rz_cmd_alias_del(RzCmd *cmd, const char *k)
RZ_API bool rz_cmd_parsed_args_setcmd(RzCmdParsedArgs *a, const char *cmd)
RZ_API int rz_cmd_add(RzCmd *c, const char *cmd, RzCmdCb cb)
RZ_API char * rz_cmd_unescape_arg(const char *arg, RzCmdEscape esc)
RZ_API int rz_cmd_call(RzCmd *cmd, const char *input)
RZ_API bool rz_cmd_get_help_strbuf(RzCmd *cmd, const RzCmdDesc *cd, bool use_color, RzStrBuf *sb)
Generates a text output of the given help message description (summary format)
RZ_API RzCmdParsedArgs * rz_cmd_parsed_args_newcmd(const char *cmd)
RZ_API int rz_cmd_alias_set(RzCmd *cmd, const char *k, const char *v, int remote)
RZ_API char * rz_cmd_alias_get(RzCmd *cmd, const char *k, int remote)
RZ_API int rz_cmd_macro_call(RzCmdMacro *mac, const char *name)
RZ_API RzCmdStatus rz_cmd_call_parsed_args(RzCmd *cmd, RzCmdParsedArgs *args)
RZ_API int rz_cmd_set_data(RzCmd *cmd, void *data)
RZ_API char * rz_cmd_get_help(RzCmd *cmd, RzCmdParsedArgs *args, bool use_color)
RZ_API RzCmd * rz_cmd_new(bool has_cons)
RZ_API RzCmdDesc * rz_cmd_get_desc_best(RzCmd *cmd, const char *cmd_identifier)
Retrieve the command descriptor that best matches the name cmd_identifier.
RZ_API void rz_cmd_parsed_args_free(RzCmdParsedArgs *a)
RZ_API char * rz_cmd_escape_arg(const char *arg, RzCmdEscape esc)
RZ_API char ** rz_cmd_alias_keys(RzCmd *cmd, int *sz)
static const char * help_msg_greater_sign[]
static const char * help_msg_at_at[]
static const char * help_msg_at_at_at[]
static const char * help_msg_at[]
RZ_IPI bool rz_core_seek_to_register(RzCore *core, const char *regname, bool is_silent)
RZ_IPI int rz_core_seek_opcode(RzCore *core, int n, bool silent)
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 void rz_cons_pipe_close(int fd)
RZ_API int rz_cons_pipe_open(const char *file, int fdn, int append)
RZ_API int rz_cons_get_buffer_len(void)
RZ_API void rz_cons_filter(void)
RZ_API void rz_cons_last(void)
RZ_API RZ_OWN char * rz_cons_get_buffer_dup(void)
Return a newly allocated buffer containing what's currently in RzCons buffer.
RZ_API int rz_cons_memcat(const char *str, int len)
RZ_API void rz_cons_set_last_interactive(void)
RZ_API void rz_cons_strcat(const char *str)
RZ_API void rz_cons_newline(void)
RZ_API void rz_cons_break_pop(void)
RZ_API void rz_cons_break_push(RzConsBreak cb, void *user)
RZ_API void rz_cons_set_interactive(bool x)
RZ_API int rz_cons_printf(const char *format,...)
RZ_API void rz_cons_echo(const char *msg)
RZ_API const char * rz_cons_get_buffer(void)
Return the current RzCons buffer.
RZ_API bool rz_cons_is_interactive(void)
RZ_API void rz_cons_cmd_help(const char *help[], bool use_color)
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_reset(void)
RZ_API void rz_cons_pop(void)
RZ_API void rz_cons_push(void)
static RzCmdStatus bool2status(bool val)
RZ_IPI bool rz_core_seek_bb_instruction(RzCore *core, int index)
RZ_API void rz_core_reg_update_flags(RzCore *core)
Update or create flags for all registers where it makes sense.
RZ_API RzReg * rz_core_reg_default(RzCore *core)
Get the currently relevant RzReg.
static static fork const void static count close
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 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 static offset struct stat static buf void long static basep static whence static length const void static len static semflg const void static shmflg const struct timespec struct timespec static rem const char static group const void start
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
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 static offset struct stat static buf void long static basep static whence static length const void static len static semflg const void static shmflg const struct timespec struct timespec static rem const char static group const void length
RZ_API int rz_line_hist_cmd_down(RzLine *line)
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 ut64 rz_debug_reg_get(RzDebug *dbg, const char *name)
static states step(struct re_guts *, sopno, sopno, states, int, states)
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_item_clone(RzFlagItem *item)
RZ_API void rz_flag_item_free(RzFlagItem *item)
RZ_API RzFlagItem * rz_flag_get(RzFlag *f, const char *name)
RZ_API RzFlagItem * rz_flag_set(RzFlag *f, const char *name, ut64 off, ut32 size)
RZ_API void rz_flag_foreach_space(RzFlag *f, const RzSpace *space, RzFlagItemCb cb, void *user)
RZ_API void rz_flag_foreach_glob(RzFlag *f, const char *glob, RzFlagItemCb cb, void *user)
void trim(string &s, string characters)
RZ_API void rz_cons_grep_help(void)
RZ_API char * rz_cons_grep_strip(char *cmd, const char *quotestr)
RZ_API void rz_cons_grep_parsecmd(char *cmd, const char *quotestr)
RZ_API void rz_cons_grep_process(char *grep)
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 bool rz_config_hold_i(RzConfigHold *h,...)
Save the current values of a list of config options that have integer 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 int rz_lang_run_file(RzLang *lang, const char *file)
RZ_API RzLangPlugin * rz_lang_get_by_extension(RzLang *lang, const char *ext)
RZ_API bool rz_lang_use(RzLang *lang, const char *name)
memcpy(mem, inblock.get(), min(CONTAINING_RECORD(inblock.get(), MEMBLOCK, data) ->size, size))
RZ_API RZ_OWN char * rz_core_editor(const RzCore *core, RZ_NULLABLE const char *file, RZ_NULLABLE const char *str)
RZ_API bool rz_core_block_size(RzCore *core, ut32 bsize)
RZ_API bool rz_debug_select(RzDebug *dbg, int pid, int tid)
RZ_API RzList * rz_debug_frames(RzDebug *dbg, ut64 at)
static void list(RzEgg *egg)
RZ_API RZ_BORROW RzListIter * rz_list_insert(RZ_NONNULL RzList *list, ut32 n, void *data)
Inserts a new element at the N-th position.
RZ_API RZ_OWN RzList * rz_list_newf(RzListFree f)
Returns a new initialized RzList pointer and sets the free method.
RZ_API RZ_BORROW void * rz_list_get_top(RZ_NONNULL const RzList *list)
Returns the last element of the list.
RZ_API RZ_OWN void * rz_list_pop(RZ_NONNULL RzList *list)
Removes and returns the last element of the list.
RZ_API void rz_list_sort(RZ_NONNULL RzList *list, RZ_NONNULL RzListComparator cmp)
Sorts via merge sort or via insertion sort a list.
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_BORROW RzListIter * rz_list_push(RZ_NONNULL RzList *list, void *item)
Alias for rz_list_append.
RZ_API ut32 rz_list_length(RZ_NONNULL const RzList *list)
Returns the length of the list.
RZ_API RZ_BORROW RzListIter * rz_list_append(RZ_NONNULL RzList *list, void *data)
Appends at the end of the list a new element.
RZ_API void rz_list_free(RZ_NONNULL RzList *list)
Empties the list and frees the list pointer.
RZ_API char * sdb_querys(Sdb *r, char *buf, size_t len, const char *_cmd)
void * malloc(size_t size)
void * calloc(size_t number, size_t size)
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 pid
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 dup
static static fork const void static count static fd const char const char static newpath char char argv
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")
static static fork const void static count static fd const char static mode const char static pathname const char static path const char static dev const char static group static getpid static getuid void void static data static pause const char static mode static sync const char const char static newpath const char static pathname unsigned long static filedes void static end_data_segment static handler static getegid char static len static pgid const char static path dup2
static static fork const void static count static fd const char static mode const char static pathname const char static path const char static dev const char static group static getpid static getuid void void static data static pause const char static mode static sync const char const char static newpath const char static pathname pipe
static const char struct stat static buf struct stat static buf static vhangup int status
RZ_API Sdb * sdb_ns_path(Sdb *s, const char *path, int create)
RZ_API Sdb * sdb_ns(Sdb *s, const char *name, int create)
static struct @218 keys[]
RZ_API bool rz_core_visual_panels_root(RzCore *core, RzPanelsRoot *panels_root)
RZ_API ut64 rz_reg_getv(RzReg *reg, const char *name)
RZ_API const RzList * rz_reg_get_list(RzReg *reg, int type)
RZ_API void rz_core_rtr_cmd(RzCore *core, const char *input)
#define rz_warn_if_reached()
#define rz_return_if_fail(expr)
#define rz_return_val_if_fail(expr, val)
RZ_API char * rz_base64_encode_dyn(const ut8 *bin, size_t sz)
RZ_API void rz_buf_free(RzBuffer *b)
Free all internal data hold by the buffer and the buffer.
RZ_API RZ_OWN RzBuffer * rz_buf_new_with_bytes(RZ_NULLABLE RZ_BORROW const ut8 *bytes, ut64 len)
Creates a new buffer with a bytes array.
RZ_API ut64 rz_buf_size(RZ_NONNULL RzBuffer *b)
Return the size of the buffer.
@ RZ_CMD_ESCAPE_MULTI_ARG
The string should be escaped so that it appears as one or multiple arguments.
@ RZ_CMD_ESCAPE_SINGLE_QUOTED_ARG
The string should be escaped so that it can be wrapped in '....'.
@ RZ_CMD_ESCAPE_PF_ARG
The string should be escaped so that it appears as one or multiple pf arguments.
@ RZ_CMD_ESCAPE_ONE_ARG
The string should be escaped so that it appears as one single argument.
@ RZ_CMD_ESCAPE_DOUBLE_QUOTED_ARG
The string should be escaped so that it can be wrapped in "....".
int(* RzCmdCb)(void *user, const char *input)
@ RZ_CMD_DESC_TYPE_OLDINPUT
enum rz_cmd_status_t RzCmdStatus
@ RZ_CMD_STATUS_OK
command handler exited in the right way
@ RZ_CMD_STATUS_WRONG_ARGS
command handler could not handle the arguments passed to it
@ RZ_CMD_STATUS_NONEXISTINGCMD
command does not exist
@ RZ_CMD_STATUS_INVALID
command could not be executed (e.g. shell level error, bad expression, etc.)
@ RZ_CMD_STATUS_ERROR
command handler had issues while running (e.g. allocation error, etc.)
static void rz_write_ble(void *dst, ut64 val, bool big_endian, int size)
static void rz_write_ble32(void *dest, ut32 val, bool big_endian)
static void rz_write_ble64(void *dest, ut64 val, bool big_endian)
RZ_API char * rz_file_temp(const char *prefix)
RZ_API bool rz_file_is_c(const char *file)
RZ_API bool rz_file_exists(const char *str)
RZ_API char * rz_file_abspath(const char *file)
RZ_API int rz_file_mkstemp(RZ_NULLABLE const char *prefix, char **oname)
RZ_API RZ_OWN char * rz_file_slurp(const char *str, RZ_NULLABLE size_t *usz)
RZ_API bool rz_file_rm(const char *file)
RZ_API char * rz_file_path(const char *bin)
RZ_API int rz_hex_str2bin(const char *in, ut8 *out)
Convert an input string in into the binary form in out.
static RzIntervalNode * rz_interval_tree_iter_get(RzIntervalTreeIter *it)
#define rz_interval_tree_foreach(tree, it, dat)
RZ_API char * rz_io_system(RzIO *io, const char *cmd)
RZ_API ut64 rz_io_desc_size(RzIODesc *desc)
RZ_API RzList * rz_io_map_get_for_fd(RzIO *io, int fd)
RZ_API int rz_io_fd_get_current(RzIO *io)
RZ_API RzIODesc * rz_io_open_buffer(RzIO *io, RzBuffer *b, int flags, int mode)
RZ_API bool rz_io_use_fd(RzIO *io, int fd)
RZ_API RzIOMap * rz_io_map_new(RzIO *io, int fd, int flags, ut64 delta, ut64 addr, ut64 size)
RZ_API bool rz_io_desc_close(RzIODesc *desc)
void(* RzListFree)(void *ptr)
#define RZ_LOG_WARN(fmtstr,...)
#define RZ_LOG_DEBUG(fmtstr,...)
#define RZ_LOG_ERROR(fmtstr,...)
RZ_API void * rz_mem_dup(const void *s, int l)
RZ_API ut64 rz_num_get(RzNum *num, const char *str)
RZ_API ut64 rz_num_tail(RzNum *num, ut64 addr, const char *hex)
RZ_API ut64 rz_num_math(RzNum *num, const char *str)
RZ_API PJ * pj_ko(PJ *j, const char *k)
RZ_API PJ * pj_ka(PJ *j, const char *k)
RZ_API PJ * pj_end(PJ *j)
RZ_API const char * pj_string(PJ *pj)
RZ_API void pj_free(PJ *j)
RZ_API PJ * pj_s(PJ *j, const char *k)
#define RZ_PRINT_FLAGS_COLOR
RZ_API const char * rz_str_lchr(const char *str, char chr)
static const char * rz_str_get(const char *str)
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_ndup(RZ_NULLABLE const char *ptr, int len)
Create new copy of string ptr limited to size len.
RZ_API char * rz_str_new(const char *str)
RZ_API char RZ_API char * rz_str_newlen(const char *str, int len)
RZ_API RZ_BORROW char * rz_str_trim_tail(RZ_NONNULL char *str)
Removes whitespace characters (space, tab, newline etc.) from the end of a string and replaces them w...
RZ_API char * rz_str_trim_dup(const char *str)
RZ_API void rz_str_trim_head(RZ_NONNULL char *str)
Removes whitespace characters (space, tab, newline etc.) from the end of a string....
RZ_API char * rz_str_array_join(const char **a, size_t n, const char *sep)
RZ_API bool rz_str_glob(const char *str, const char *glob)
#define RZ_STR_ISEMPTY(x)
RZ_API char * rz_str_prepend(char *ptr, const char *string)
RZ_API const char * rz_str_trim_head_ro(const char *str)
RZ_API char * rz_str_replace(char *str, const char *key, const char *val, int g)
RZ_API const char * rz_str_firstbut(const char *s, char ch, const char *but)
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 bool rz_str_startswith(RZ_NONNULL const char *str, RZ_NONNULL const char *needle)
Checks if a string starts with a specifc sequence of characters (case sensitive)
RZ_API int rz_str_unescape(char *buf)
RZ_API const char * rz_str_word_get0(const char *str, int idx)
RZ_API const char * rz_str_lastbut(const char *s, char ch, const char *but)
RZ_API bool rz_str_endswith(RZ_NONNULL const char *str, RZ_NONNULL const char *needle)
Checks if a string ends with a specifc sequence of characters (case sensitive)
RZ_API char * rz_str_trim_nc(char *str)
RZ_API size_t rz_str_split(char *str, char ch)
Split string str in place by using ch as a delimiter.
RZ_API RZ_OWN char * rz_strbuf_drain(RzStrBuf *sb)
RZ_API bool rz_strbuf_prepend(RzStrBuf *sb, const char *s)
RZ_API char * rz_strbuf_get(RzStrBuf *sb)
RZ_API bool rz_strbuf_append(RzStrBuf *sb, const char *s)
RZ_API RzStrBuf * rz_strbuf_new(const char *s)
RZ_API void rz_strbuf_free(RzStrBuf *sb)
RZ_API RzSubprocessWaitReason rz_subprocess_wait(RzSubprocess *proc, ut64 timeout_ms)
RZ_API void rz_subprocess_free(RzSubprocess *proc)
RZ_API ut8 * rz_subprocess_out(RzSubprocess *proc, int *length)
RZ_API RzSubprocess * rz_subprocess_start_opt(RzSubprocessOpt *opt)
RZ_API void rz_subprocess_fini(void)
RZ_API ssize_t rz_subprocess_stdin_write(RzSubprocess *proc, const ut8 *buf, size_t buf_size)
RZ_API bool rz_subprocess_init(void)
@ RZ_SUBPROCESS_PIPE_NONE
No pipe should be created. It can be used for stdin, stdout and stderr.
@ RZ_SUBPROCESS_PIPE_STDOUT
@ RZ_SUBPROCESS_PIPE_CREATE
Re-use the same pipe as stdout. It can be used for stderr only.
RZ_API int rz_sys_cmdf(const char *fmt,...) RZ_PRINTF_CHECK(1
RZ_API char * rz_sys_getenv(const char *key)
Get the value of an environment variable named key or NULL if none exists.
RZ_API int rz_sys_execl(const char *pathname, const char *arg,...)
RZ_API int rz_sys_setenv(const char *key, const char *value)
Set an environment variable in the calling process.
RZ_API int rz_sys_pipe(int pipefd[2], bool close_on_exec)
RZ_API int rz_sys_open(const char *path, int perm, int mode)
RZ_API int rz_sys_fork(void)
RZ_API int rz_sys_pipe_close(int fd)
RZ_API FILE * rz_sys_fopen(const char *path, const char *mode)
RZ_API int RZ_API char * rz_sys_cmd_str(const char *cmd, const char *input, int *len)
RZ_API int rz_sys_signal(int sig, void(*handler)(int))
RZ_API int rz_sys_cmd_str_full(const char *cmd, const char *input, char **output, int *len, char **sterr)
int(* PrintfCallback)(const char *str,...) RZ_PRINTF_CHECK(1
RzOutputMode
Enum to describe the way data are printed.
@ RZ_OUTPUT_MODE_STANDARD
RZ_API void * rz_pvector_pop(RzPVector *vec)
RZ_API void rz_pvector_init(RzPVector *vec, RzPVectorFree free)
RZ_API void rz_pvector_fini(RzPVector *vec)
static void ** rz_pvector_push(RzPVector *vec, void *x)
RZ_API Sdb * sdb_new(const char *path, const char *name, int lock)
RZ_API void sdb_file(Sdb *s, const char *dir)
RZ_API void sdb_drain(Sdb *s, Sdb *f)
RZ_API bool sdb_foreach(Sdb *s, SdbForeachCallback cb, void *user)
RZ_API bool sdb_sync(Sdb *s)
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
char * extra
Extra data that is neither a command name nor an argument (e.g. command modifiers/specifiers,...
Represent the output state of a command handler.
RzCmdDescriptor root_cmd_descriptor
RZ_DEPRECATE bool cmd_in_backticks
RzCoreTaskScheduler tasks
RzPanelsRoot * panels_root
RzList *(* threads)(RzDebug *dbg, int pid)
RzList *(* pids)(RzDebug *dbg, int pid)
struct rz_debug_plugin_t * cur
struct rz_io_desc_t * desc
RzRegisterType type
Register type.
int size
in bits> 8,16,32,64 ... 128/256
const char * file
< Name of the executable to run. It is searched also in PATH
static enum exit_status_type exit_status
Exit status to use. This can be changed with set_exit_status().
RZ_API void rz_core_task_yield(RzCoreTaskScheduler *scheduler)
RZ_API int rz_core_visual(RzCore *core, const char *input)
ut64(WINAPI *w32_GetEnabledXStateFeatures)()
static const z80_opcode fd[]
static bool input(void *ud, zip_uint8_t *data, zip_uint64_t length)
int def(FILE *source, FILE *dest, int level)
int read(izstream &zs, T *x, Items items)