Rizin
unix-like reverse engineering framework and cli tools
cmd_help.c
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: 2009-2020 pancake <pancake@nopcode.org>
2 // SPDX-License-Identifier: LGPL-3.0-only
3 
4 #include <stddef.h>
5 #include <math.h> // required for signbit
6 #include "rz_cons.h"
7 #include "rz_core.h"
8 #include "rz_util.h"
9 
10 static ut32 vernum(const char *s) {
11  // XXX this is known to be buggy, only works for strings like "x.x.x"
12  // XXX anything like "x.xx.x" will break the parsing
13  // XXX -git is ignored, maybe we should shift for it
14  char *a = strdup(s);
15  a = rz_str_replace(a, ".", "0", 1);
16  char *dash = strchr(a, '-');
17  if (dash) {
18  *dash = 0;
19  }
20  ut32 res = atoi(a);
21  free(a);
22  return res;
23 }
24 
25 static const char *help_msg_percent[] = {
26  "Usage:", "%[name[=value]]", "Set each NAME to VALUE in the environment",
27  "%", "", "list all environment variables",
28  "%", "SHELL", "prints SHELL value",
29  "%", "TMPDIR=/tmp", "sets TMPDIR value to \"/tmp\"",
30  NULL
31 };
32 
33 // NOTE: probably not all environment vars takes sesnse
34 // because they can be replaced by commands in the given
35 // command.. we should only expose the most essential and
36 // unidirectional ones.
37 static const char *help_msg_env[] = {
38  "\nEnvironment:", "", "",
39  "RZ_FILE", "", "file name",
40  "RZ_OFFSET", "", "10base offset 64bit value",
41  "RZ_XOFFSET", "", "same as above, but in 16 base",
42  "RZ_BSIZE", "", "block size",
43  "RZ_ENDIAN", "", "'big' or 'little'",
44  "RZ_IOVA", "", "is io.va true? virtual addressing (1,0)",
45  "RZ_DEBUG", "", "debug mode enabled? (1,0)",
46  "RZ_SIZE", "", "file size",
47  "RZ_ARCH", "", "value of asm.arch",
48  "RZ_BITS", "", "arch reg size (8, 16, 32, 64)",
49  "RZ_BIN_LANG", "", "assume this lang to demangle",
50  "RZ_BIN_DEMANGLE", "", "demangle or not",
51  "RZ_BIN_PDBSERVER", "", "e pdb.server",
52  NULL
53 };
54 
55 static const char *help_msg_exclamation[] = {
56  "Usage:", "!<cmd>", " Run given command as in system(3)",
57  "!", "", "list all historic commands",
58  "!*", "rzp x", "run rizin command via rzpipe in current session",
59  "!!", "", "save command history to hist file",
60  "!!", "ls~txt", "print output of 'ls' and grep for 'txt'",
61  "!!!", "cmd [args|$type]", "adds the autocomplete value",
62  "!!!-", "cmd [args]", "removes the autocomplete value",
63  ".!", "rz_bin -rpsei ${FILE}", "run each output line as a rizin cmd",
64  "!", "echo $RZ_SIZE", "display file size",
65  "!-", "", "clear history in current session",
66  "!-*", "", "clear and save empty history log",
67  "R=!", "", "enable remotecmd mode",
68  "R!=", "", "disable remotecmd mode",
69  NULL
70 };
71 
72 static const char *help_msg_question_e[] = {
73  "Usage: ?e[=bdgnpst] arg", "print/echo things", "",
74  "?e", "", "echo message with newline",
75  "?e=", " 32", "progress bar at 32 percentage",
76  "?eg", " 10 20", "move cursor to column 10, row 20",
77  "?en", " nonl", "echo message without ending newline",
78  "?et", " msg", "change terminal title",
79  NULL
80 };
81 
82 static const char *help_msg_question[] = {
83  "Usage: ?[?[?]] expression", "", "",
84  "?!", " [cmd]", "run cmd if $? == 0",
85  "?", " eip-0x804800", "show all representation result for this math expr",
86  "?$", "", "show value all the variables ($)",
87  "?+", " [cmd]", "run cmd if $? > 0",
88  "?-", " [cmd]", "run cmd if $? < 0",
89  "?=", " eip-0x804800", "hex and dec result for this math expr",
90  "?==", " x86 `e asm.arch`", "strcmp two strings",
91  "??", " [cmd]", "run cmd if $? != 0",
92  "??", "", "show value of operation",
93  "?a", "", "show ascii table",
94  "?B", " [elem]", "show range boundaries like 'e?search.in",
95  "?b", " [num]", "show binary value of number",
96  "?b64[-]", " [str]", "encode/decode in base64",
97  "?btw", " num|expr num|expr num|expr", "returns boolean value of a <= b <= c",
98  "?e", "[=bdgnpst] arg", "echo messages, bars, pie charts and more (see ?e? for details)",
99  "?f", " [num] [str]", "map each bit of the number as flag string index",
100  "?F", "", "flush cons output",
101  "?h", " [str]", "calculate hash for given string",
102  "?i", "[ynmkp] arg", "prompt for number or Yes,No,Msg,Key,Path and store in $$?",
103  "?ik", "", "press any key input dialog",
104  "?im", " message", "show message centered in screen",
105  "?in", " prompt", "noyes input prompt",
106  "?ip", " prompt", "path input prompt",
107  "?iy", " prompt", "yesno input prompt",
108  "?j", " arg", "same as '? num' but in JSON",
109  "?l", "[q] str", "returns the length of string ('q' for quiet, just set $?)",
110  "?o", " num", "get octal value",
111  "?P", " paddr", "get virtual address for given physical one",
112  "?p", " vaddr", "get physical address for given virtual address",
113  "?q", " eip-0x804800", "compute expression like ? or ?v but in quiet mode",
114  "?r", " [from] [to]", "generate random number between from-to",
115  "?s", " from to step", "sequence of numbers from to by steps",
116  "?t", " cmd", "returns the time to run a command",
117  "?T", "", "show loading times",
118  "?u", " num", "get value in human units (KB, MB, GB, TB)",
119  "?v", " eip-0x804800", "show hex value of math expr",
120  "?vi", " rsp-rbp", "show decimal value of math expr",
121  "?V", "", "show library version of rz_core",
122  "?w", " addr", "show what's in this address (like pxr/pxq does)",
123  "?X", " num|expr", "returns the hexadecimal value numeric expr",
124  "?x", " str", "returns the hexpair of number or string",
125  "?x", "+num", "like ?v, but in hexpairs honoring cfg.bigendian",
126  "?x", "-hexst", "convert hexpair into raw string with newline",
127  "?_", " hudfile", "load hud menu with given file",
128  "[cmd]?*", "", "recursive help for the given cmd",
129  NULL
130 };
131 
132 static const char *help_msg_question_v[] = {
133  "Usage: ?v [$.]", "", "",
134  "flag", "", "offset of flag",
135  "$", "{ev}", "get value of eval config variable",
136  "$$", "", "here (current virtual seek)",
137  "$$$", "", "current non-temporary virtual seek",
138  "$?", "", "last comparison value",
139  "$alias", "=value", "alias commands (simple macros)",
140  "$B", "", "base address (aligned lowest map address)",
141  "$b", "", "block size",
142  "$c", "", "get terminal width in character columns",
143  "$Cn", "", "get nth call of function",
144  "$D", "", "current debug map base address ?v $D @ rsp",
145  "$DB", "", "same as dbg.baddr, progam base address",
146  "$DD", "", "current debug map size",
147  "$Dn", "", "get nth data reference in function",
148  "$e", "", "1 if end of block, else 0",
149  "$e", "{flag}", "end of flag (flag->offset + flag->size)",
150  "$f", "", "jump fail address (e.g. jz 0x10 => next instruction)",
151  "$F", "", "Same as $FB",
152  "$Fb", "", "begin of basic block",
153  "$FB", "", "begin of function",
154  "$Fe", "", "end of basic block",
155  "$FE", "", "end of function",
156  "$Ff", "", "function false destination",
157  "$Fi", "", "basic block instructions",
158  "$FI", "", "function instructions",
159  "$Fj", "", "function jump destination",
160  "$fl", "", "flag length (size) at current address (fla; pD $l @ entry0)",
161  "$FS", "", "function size (linear length)",
162  "$Fs", "", "size of the current basic block",
163  "$FSS", "", "function size (sum bb sizes)",
164  "$j", "", "jump address (e.g. jmp 0x10, jz 0x10 => 0x10)",
165  "$Ja", "", "get nth jump of function",
166  "$k{kv}", "", "get value of an sdb query value",
167  "$l", "", "opcode length",
168  "$M", "", "map address (lowest map address)",
169  "$m", "", "opcode memory reference (e.g. mov eax,[0x10] => 0x10)",
170  "$MM", "", "map size (lowest map address)",
171  "$O", "", "cursor here (current offset pointed by the cursor)",
172  "$o", "", "here (current disk io offset)",
173  "$p", "", "getpid()",
174  "$P", "", "pid of children (only in debug)",
175  "$r", "", "get console height (in rows, see $c for columns)",
176  "$r", "{reg}", "get value of named register",
177  "$s", "", "file size",
178  "$S", "", "section offset",
179  "$SS", "", "section size",
180  "$s", "{flag}", "get size of flag",
181  "$v", "", "opcode immediate value (e.g. lui a0,0x8010 => 0x8010)",
182  "$w", "", "get word size, 4 if asm.bits=32, 8 if 64, ...",
183  "$Xn", "", "get nth xref of function",
184  "RzNum", "", "$variables usable in math expressions",
185  NULL
186 };
187 
188 static const char *help_msg_question_V[] = {
189  "Usage: ?V[jq]", "", "",
190  "?V", "", "show version information",
191  "?V0", "", "show major version",
192  "?V1", "", "show minor version",
193  "?V2", "", "show patch version",
194  "?Vn", "", "show numeric version (2)",
195  "?Vc", "", "show numeric version",
196  "?Vj", "", "same as above but in JSON",
197  "?Vq", "", "quiet mode, just show the version number",
198  NULL
199 };
200 
201 static const char *help_msg_greater_sign[] = {
202  "Usage:", "[cmd]>[file]", "redirects console from 'cmd' output to 'file'",
203  "[cmd] > [file]", "", "redirect STDOUT of 'cmd' to 'file'",
204  "[cmd] > $alias", "", "save the output of the command as an alias (see $?)",
205  "[cmd] H> [file]", "", "redirect html output of 'cmd' to 'file'",
206  "[cmd] 2> [file]", "", "redirect STDERR of 'cmd' to 'file'",
207  "[cmd] 2> /dev/null", "", "omit the STDERR output of 'cmd'",
208  NULL
209 };
210 
211 static void cmd_help_exclamation(RzCore *core) {
214 }
215 
216 static void cmd_help_percent(RzCore *core) {
219 }
220 
221 static const char *findBreakChar(const char *s) {
222  while (*s) {
223  if (!rz_name_validate_char(*s, true)) {
224  break;
225  }
226  s++;
227  }
228  return s;
229 }
230 
231 static char *filterFlags(RzCore *core, const char *msg) {
232  const char *dollar, *end;
233  char *word, *buf = NULL;
234  for (;;) {
235  dollar = strchr(msg, '$');
236  if (!dollar) {
237  break;
238  }
239  buf = rz_str_appendlen(buf, msg, dollar - msg);
240  if (dollar[1] == '{') {
241  // find }
242  end = strchr(dollar + 2, '}');
243  if (end) {
244  word = rz_str_newlen(dollar + 2, end - dollar - 2);
245  end++;
246  } else {
247  msg = dollar + 1;
248  buf = rz_str_append(buf, "$");
249  continue;
250  }
251  } else {
252  end = findBreakChar(dollar + 1);
253  if (!end) {
254  end = dollar + strlen(dollar);
255  }
256  word = rz_str_newlen(dollar + 1, end - dollar - 1);
257  }
258  if (end && word) {
259  ut64 val = rz_num_math(core->num, word);
260  char num[32];
261  snprintf(num, sizeof(num), "0x%" PFMT64x, val);
262  buf = rz_str_append(buf, num);
263  msg = end;
264  } else {
265  break;
266  }
267  free(word);
268  }
269  buf = rz_str_append(buf, msg);
270  return buf;
271 }
272 
273 static const char *avatar_orangg[] = {
274  " _______\n"
275  " / \\ .-%s-.\n"
276  " _| ( o) (o)\\_ | %s |\n"
277  " / _ .\\. | \\ <| %s |\n"
278  " \\| \\ ____ / 7` | %s |\n"
279  " '|\\| `---'/ `-%s-'\n"
280  " | /----. \\\n"
281  " | \\___/ |___\n"
282  " `-----'`-----'\n"
283 };
284 
285 static const char *avatar_clippy[] = {
286  " .--. .-%s-.\n"
287  " | _| | %s |\n"
288  " | O O < %s |\n"
289  " | | | | %s |\n"
290  " || | / `-%s-'\n"
291  " |`-'|\n"
292  " `---'\n",
293  " .--. .-%s-.\n"
294  " | \\ | %s |\n"
295  " | O o < %s |\n"
296  " | | / | %s |\n"
297  " | ( / `-%s-'\n"
298  " | / \n"
299  " `--'\n",
300  " .--. .-%s-.\n"
301  " | _|_ | %s |\n"
302  " | O O < %s |\n"
303  " | || | %s |\n"
304  " | _:| `-%s-'\n"
305  " | |\n"
306  " `---'\n",
307 };
308 
309 static const char *avatar_clippy_utf8[] = {
310  " ╭──╮ ╭─%s─╮\n"
311  " │ _│ │ %s │\n"
312  " │ O O < %s │\n"
313  " │ │╭ │ %s │\n"
314  " ││ ││ ╰─%s─╯\n"
315  " │└─┘│\n"
316  " ╰───╯\n",
317  " ╭──╮ ╭─%s─╮\n"
318  " │ ╶│╶ │ %s │\n"
319  " │ O o < %s │\n"
320  " │ │ ╱ │ %s │\n"
321  " │ ╭┘ ╱ ╰─%s─╯\n"
322  " │ â•° ╱\n"
323  " ╰──'\n",
324  " ╭──╮ ╭─%s─╮\n"
325  " │ _│_ │ %s │\n"
326  " │ O O < %s │\n"
327  " │ │╷ │ %s │\n"
328  " │ ││ ╰─%s─╯\n"
329  " │ ─╯│\n"
330  " ╰───╯\n",
331 };
332 
333 static const char *avatar_cybcat[] = {
334  " /\\.---./\\ .-%s-.\n"
335  " '-- --' | %s |\n"
336  "---- ^ ^ ---- < %s |\n"
337  " _.- Y -._ | %s |\n"
338  " `-%s-'\n",
339  " /\\.---./\\ .-%s-.\n"
340  " '-- @ @ --' | %s |\n"
341  "---- Y ---- < %s |\n"
342  " _.- O -._ | %s |\n"
343  " `-%s-'\n",
344  " /\\.---./\\ .-%s-.\n"
345  " '-- = = --' | %s |\n"
346  "---- Y ---- < %s |\n"
347  " _.- U -._ | %s |\n"
348  " `-%s-'\n",
349 };
350 
351 enum {
355 };
356 
360 RZ_API const char **rz_core_help_vars_get(RzCore *core) {
361  static const char *vars[] = {
362  "$$", "$$$", "$?", "$B", "$b", "$c", "$Cn", "$D", "$DB", "$DD", "$Dn",
363  "$e", "$f", "$F", "$Fb", "$FB", "$Fe", "$FE", "$Ff", "$Fi", "$FI", "$Fj",
364  "$fl", "$FS", "$Fs", "$FSS", "$j", "$Ja", "$l", "$M", "$m", "$MM", "$O",
365  "$o", "$p", "$P", "$r", "$s", "$S", "$SS", "$v", "$w", "$Xn", NULL
366  };
367  return vars;
368 }
369 
371  int i = 0;
372  const char **vars = rz_core_help_vars_get(core);
373  const bool wideOffsets = rz_config_get_i(core->config, "scr.wideoff");
374  while (vars[i]) {
375  const char *pad = rz_str_pad(' ', 6 - strlen(vars[i]));
376  if (wideOffsets) {
377  eprintf("%s %s 0x%016" PFMT64x "\n", vars[i], pad, rz_num_math(core->num, vars[i]));
378  } else {
379  eprintf("%s %s 0x%08" PFMT64x "\n", vars[i], pad, rz_num_math(core->num, vars[i]));
380  }
381  i++;
382  }
383 }
384 
385 RZ_API void rz_core_clippy(RzCore *core, const char *msg) {
386  int type = RZ_AVATAR_CLIPPY;
387  if (*msg == '+' || *msg == '3') {
388  char *space = strchr(msg, ' ');
389  if (!space) {
390  return;
391  }
392  type = (*msg == '+') ? RZ_AVATAR_ORANGG : RZ_AVATAR_CYBCAT;
393  msg = space + 1;
394  }
395  const char *f;
396  int msglen = rz_str_len_utf8(msg);
397  char *s = strdup(rz_str_pad(' ', msglen));
398  char *l;
399 
400  if (type == RZ_AVATAR_ORANGG) {
401  l = strdup(rz_str_pad('-', msglen));
402  f = avatar_orangg[0];
403  } else if (type == RZ_AVATAR_CYBCAT) {
404  l = strdup(rz_str_pad('-', msglen));
406  } else if (rz_config_get_i(core->config, "scr.utf8")) {
407  l = (char *)rz_str_repeat("─", msglen);
409  } else {
410  l = strdup(rz_str_pad('-', msglen));
412  }
413 
414  rz_cons_printf(f, l, s, msg, s, l);
415  free(l);
416  free(s);
417 }
418 
419 RZ_IPI int rz_cmd_help(void *data, const char *input) {
420  RzCore *core = (RzCore *)data;
421  RzIOMap *map;
422  const char *k;
423  RzListIter *iter;
424  char *p, out[128] = RZ_EMPTY;
425  ut64 n;
426  int i;
427  RzList *tmp;
428 
429  switch (input[0]) {
430  case '0': // "?0"
431  core->curtab = 0;
432  break;
433  case '1': // "?1"
434  if (core->curtab < 0) {
435  core->curtab = 0;
436  }
437  core->curtab++;
438  break;
439  case 'r': // "?r"
440  { // TODO : Add support for 64bit random numbers
441  ut64 b = 0;
442  ut32 r = UT32_MAX;
443  if (input[1]) {
444  strncpy(out, input + (input[1] == ' ' ? 2 : 1), sizeof(out) - 1);
445  p = strchr(out + 1, ' ');
446  if (p) {
447  *p = 0;
448  b = (ut32)rz_num_math(core->num, out);
449  r = (ut32)rz_num_math(core->num, p + 1) - b;
450  } else {
451  r = (ut32)rz_num_math(core->num, out);
452  }
453  } else {
454  r = 0LL;
455  }
456  if (!r) {
457  r = UT32_MAX >> 1;
458  }
459  core->num->value = (ut64)(b + rz_num_rand(r));
460  rz_cons_printf("0x%" PFMT64x "\n", core->num->value);
461  } break;
462  case 'a': // "?a"
464  break;
465  case 'b': // "?b"
466  if (input[1] == '6' && input[2] == '4') {
467  // b64 decoding takes at most strlen(str) * 4
468  const int buflen = (strlen(input + 3) * 4) + 1;
469  char *buf = calloc(buflen, sizeof(char));
470  if (!buf) {
471  return false;
472  }
473  if (input[3] == '-') {
474  rz_base64_decode((ut8 *)buf, input + 4, -1);
475  } else if (input[3] == ' ') {
476  const char *s = input + 4;
477  rz_base64_encode(buf, (const ut8 *)s, strlen(s));
478  }
480  free(buf);
481  } else if (input[1] == 't' && input[2] == 'w') { // "?btw"
482  if (rz_num_between(core->num, input + 3) == -1) {
483  eprintf("Usage: ?btw num|(expr) num|(expr) num|(expr)\n");
484  }
485  } else {
486  n = rz_num_math(core->num, input + 1);
487  rz_num_to_bits(out, n);
488  rz_cons_printf("%sb\n", out);
489  }
490  break;
491  case 'B': // "?B"
492  k = rz_str_trim_head_ro(input + 1);
493  tmp = rz_core_get_boundaries_prot(core, -1, k, "search");
494  if (!tmp) {
495  return false;
496  }
497  rz_list_foreach (tmp, iter, map) {
498  rz_cons_printf("0x%" PFMT64x " 0x%" PFMT64x "\n", map->itv.addr, rz_itv_end(map->itv));
499  }
500  rz_list_free(tmp);
501  break;
502  case 'h': // "?h"
503  if (input[1] == ' ') {
504  ut32 hash = (ut32)rz_str_djb2_hash(input + 2);
505  rz_cons_printf("0x%08x\n", hash);
506  } else {
507  eprintf("Usage: ?h [string-to-hash]\n");
508  }
509  break;
510  case 'F': // "?F"
511  rz_cons_flush();
512  break;
513  case 'f': // "?f"
514  if (input[1] == ' ') {
515  char *q, *p = strdup(input + 2);
516  if (!p) {
517  eprintf("Cannot strdup\n");
518  return 0;
519  }
520  q = strchr(p, ' ');
521  if (q) {
522  *q = 0;
523  n = rz_num_get(core->num, p);
524  rz_str_bits(out, (const ut8 *)&n, sizeof(n) * 8, q + 1);
526  } else {
527  eprintf("Usage: \"?b value bitstring\"\n");
528  }
529  free(p);
530  } else {
531  eprintf("Whitespace expected after '?f'\n");
532  }
533  break;
534  case 'o': // "?o"
535  n = rz_num_math(core->num, input + 1);
536  rz_cons_printf("0%" PFMT64o "\n", n);
537  break;
538  case 'T': // "?T"
539  rz_cons_printf("plug.init = %" PFMT64d "\n"
540  "plug.load = %" PFMT64d "\n"
541  "file.load = %" PFMT64d "\n",
542  core->times->loadlibs_init_time,
543  core->times->loadlibs_time,
544  core->times->file_open_time);
545  break;
546  case 'u': // "?u"
547  {
548  char unit[8];
549  n = rz_num_math(core->num, input + 1);
550  rz_num_units(unit, sizeof(unit), n);
551  rz_cons_println(unit);
552  } break;
553  case 'j': // "?j"
554  case ' ': // "? "
555  {
556  char *asnum, unit[8];
557  ut32 s, a;
558  double d;
559  float f;
560  char number[128];
561  char *const inputs = strdup(input + 1);
562  RzList *list = rz_num_str_split_list(inputs);
563  const int list_len = rz_list_length(list);
564  PJ *pj = NULL;
565  if (*input == 'j') {
566  pj = pj_new();
567  pj_o(pj);
568  }
569  for (i = 0; i < list_len; i++) {
570  const char *str = rz_list_pop_head(list);
571  if (!*str) {
572  continue;
573  }
574  n = rz_num_math(core->num, str);
575  if (core->num->dbz) {
576  eprintf("RzNum ERROR: Division by Zero\n");
577  }
578  asnum = rz_num_as_string(NULL, n, false);
579  /* decimal, hexa, octal */
580  s = n >> 16 << 12;
581  a = n & 0x0fff;
582  rz_num_units(unit, sizeof(unit), n);
583  if (*input == 'j') {
584  pj_ks(pj, "int32", rz_strf(number, "%d", (st32)(n & UT32_MAX)));
585  pj_ks(pj, "uint32", rz_strf(number, "%u", (ut32)n));
586  pj_ks(pj, "int64", rz_strf(number, "%" PFMT64d, (st64)n));
587  pj_ks(pj, "uint64", rz_strf(number, "%" PFMT64u, (ut64)n));
588  pj_ks(pj, "hex", rz_strf(number, "0x%08" PFMT64x, n));
589  pj_ks(pj, "octal", rz_strf(number, "0%" PFMT64o, n));
590  pj_ks(pj, "unit", unit);
591  pj_ks(pj, "segment", rz_strf(number, "%04x:%04x", s, a));
592 
593  } else {
594  if (n >> 32) {
595  rz_cons_printf("int64 %" PFMT64d "\n", (st64)n);
596  rz_cons_printf("uint64 %" PFMT64u "\n", (ut64)n);
597  } else {
598  rz_cons_printf("int32 %d\n", (st32)n);
599  rz_cons_printf("uint32 %u\n", (ut32)n);
600  }
601  rz_cons_printf("hex 0x%" PFMT64x "\n", n);
602  rz_cons_printf("octal 0%" PFMT64o "\n", n);
603  rz_cons_printf("unit %s\n", unit);
604  rz_cons_printf("segment %04x:%04x\n", s, a);
605 
606  if (asnum) {
607  rz_cons_printf("string \"%s\"\n", asnum);
608  free(asnum);
609  }
610  }
611  /* binary and floating point */
612  rz_str_bits64(out, n);
613  f = d = core->num->fvalue;
614  /* adjust sign for nan floats, different libcs are confused */
615  if (isnan(f) && signbit(f)) {
616  f = -f;
617  }
618  if (isnan(d) && signbit(d)) {
619  d = -d;
620  }
621  if (*input == 'j') {
622  pj_ks(pj, "fvalue", rz_strf(number, "%.1lf", core->num->fvalue));
623  pj_ks(pj, "float", rz_strf(number, "%ff", f));
624  pj_ks(pj, "double", rz_strf(number, "%lf", d));
625  pj_ks(pj, "binary", rz_strf(number, "0b%s", out));
627  pj_ks(pj, "trits", rz_strf(number, "0t%s", out));
628  } else {
629  rz_cons_printf("fvalue %.1lf\n", core->num->fvalue);
630  rz_cons_printf("float %ff\n", f);
631  rz_cons_printf("double %lf\n", d);
632  rz_cons_printf("binary 0b%s\n", out);
633 
634  /* ternary */
636  rz_cons_printf("trits 0t%s\n", out);
637  }
638  }
639  if (*input == 'j') {
640  pj_end(pj);
641  }
642  free(inputs);
644  if (pj) {
645  rz_cons_printf("%s\n", pj_string(pj));
646  pj_free(pj);
647  }
648  } break;
649  case 'q': // "?q"
650  if (core->num->dbz) {
651  eprintf("RzNum ERROR: Division by Zero\n");
652  }
653  if (input[1] == '?') {
654  rz_cons_printf("|Usage: ?q [num] # Update $? without printing anything\n"
655  "|?q 123; ?? x # hexdump if 123 != 0");
656  } else {
657  const char *space = strchr(input, ' ');
658  if (space) {
659  n = rz_num_math(core->num, space + 1);
660  } else {
661  n = rz_num_math(core->num, "$?");
662  }
663  core->num->value = n; // redundant
664  }
665  break;
666  case 'v': // "?v"
667  {
668  const char *space = strchr(input, ' ');
669  if (space) {
670  n = rz_num_math(core->num, space + 1);
671  } else {
672  n = rz_num_math(core->num, "$?");
673  }
674  }
675  if (core->num->dbz) {
676  eprintf("RzNum ERROR: Division by Zero\n");
677  }
678  switch (input[1]) {
679  case '?':
680  rz_cons_printf("|Usage: ?v[id][ num] # Show value\n"
681  "|?vx number -> show 8 digit padding in hex\n"
682  "|?vi1 200 -> 1 byte size value (char)\n"
683  "|?vi2 0xffff -> 2 byte size value (short)\n"
684  "|?vi4 0xffff -> 4 byte size value (int)\n"
685  "|?vi8 0xffff -> 8 byte size value (st64)\n"
686  "| No argument shows $? value\n"
687  "|?vi will show in decimal instead of hex\n");
688  break;
689  case '\0':
690  rz_cons_printf("%d\n", (st32)n);
691  break;
692  case 'x': // "?vx"
693  rz_cons_printf("0x%08" PFMT64x "\n", n);
694  break;
695  case 'i': // "?vi"
696  switch (input[2]) {
697  case '1': // byte
698  rz_cons_printf("%d\n", (st8)(n & UT8_MAX));
699  break;
700  case '2': // word
701  rz_cons_printf("%d\n", (st16)(n & UT16_MAX));
702  break;
703  case '4': // dword
704  rz_cons_printf("%d\n", (st32)(n & UT32_MAX));
705  break;
706  case '8': // qword
707  rz_cons_printf("%" PFMT64d "\n", (st64)(n & UT64_MAX));
708  break;
709  default:
710  rz_cons_printf("%" PFMT64d "\n", n);
711  break;
712  }
713  break;
714  case 'd':
715  rz_cons_printf("%" PFMT64d "\n", n);
716  break;
717  default:
718  rz_cons_printf("0x%" PFMT64x "\n", n);
719  }
720  core->num->value = n; // redundant
721  break;
722  case '=': // "?=" set num->value
723  if (input[1] == '=') { // ?==
724  if (input[2] == ' ') {
725  char *s = strdup(input + 3);
726  char *e = strchr(s, ' ');
727  if (e) {
728  *e++ = 0;
729  core->num->value = strcmp(s, e);
730  } else {
731  eprintf("Missing secondary word in expression to compare\n");
732  }
733  free(s);
734  } else {
735  eprintf("Usage: ?== str1 str2\n");
736  }
737  } else {
738  if (input[1]) { // ?=
739  rz_num_math(core->num, input + 1);
740  } else {
741  rz_cons_printf("0x%" PFMT64x "\n", core->num->value);
742  }
743  }
744  break;
745  case '+': // "?+"
746  if (input[1]) {
747  st64 n = (st64)core->num->value;
748  if (n > 0) {
749  rz_core_cmd(core, input + 1, 0);
750  }
751  } else {
752  rz_cons_printf("0x%" PFMT64x "\n", core->num->value);
753  }
754  break;
755  case '-': // "?-"
756  if (input[1]) {
757  st64 n = (st64)core->num->value;
758  if (n < 0) {
759  rz_core_cmd(core, input + 1, 0);
760  }
761  } else {
762  rz_cons_printf("0x%" PFMT64x "\n", core->num->value);
763  }
764  break;
765  case '!': // "?!"
766  if (input[1]) {
767  if (!core->num->value) {
768  if (input[1] == '?') {
769  cmd_help_exclamation(core);
770  return 0;
771  }
772  return core->num->value = rz_core_cmd(core, input + 1, 0);
773  }
774  } else {
775  rz_cons_printf("0x%" PFMT64x "\n", core->num->value);
776  }
777  break;
778  case '@': // "?@"
779  if (input[1] == '@') {
780  if (input[2] == '@') {
782  } else {
784  }
785  } else {
787  }
788  break;
789  case '&': // "?&"
790  helpCmdTasks(core);
791  break;
792  case '%': // "?%"
793  if (input[1] == '?') {
794  cmd_help_percent(core);
795  }
796  break;
797  case '$': // "?$"
798  if (input[1] == '?') {
800  } else {
802  }
803  return true;
804  case 'V': // "?V"
805  switch (input[1]) {
806  case '?': // "?V?"
808  break;
809  case 0: { // "?V"
810  char *v = rz_str_version(NULL);
811  rz_cons_printf("%s\n", v);
812  free(v);
813  break;
814  }
815  case 'c': // "?Vc"
816  rz_cons_printf("%d\n", vernum(RZ_VERSION));
817  break;
818  case 'j': // "?Vj"
819  {
820  PJ *pj = pj_new();
821  pj_o(pj);
822  pj_ks(pj, "arch", RZ_SYS_ARCH);
823  pj_ks(pj, "os", RZ_SYS_OS);
824  pj_ki(pj, "bits", RZ_SYS_BITS);
825  pj_ki(pj, "major", RZ_VERSION_MAJOR);
826  pj_ki(pj, "minor", RZ_VERSION_MINOR);
827  pj_ki(pj, "patch", RZ_VERSION_PATCH);
828  pj_ki(pj, "number", RZ_VERSION_NUMBER);
829  pj_ki(pj, "nversion", vernum(RZ_VERSION));
830  pj_ks(pj, "version", RZ_VERSION);
831  pj_end(pj);
832  rz_cons_printf("%s\n", pj_string(pj));
833  pj_free(pj);
834  } break;
835  case 'n': // "?Vn"
837  break;
838  case 'q': // "?Vq"
840  break;
841  case '0':
843  break;
844  case '1':
846  break;
847  case '2':
849  break;
850  }
851  break;
852  case 'l': // "?l"
853  if (input[1] == 'q') {
854  for (input += 2; input[0] == ' '; input++)
855  ;
856  core->num->value = strlen(input);
857  } else {
858  for (input++; input[0] == ' '; input++)
859  ;
860  core->num->value = strlen(input);
861  rz_cons_printf("%" PFMT64d "\n", core->num->value);
862  }
863  break;
864  case 'X': // "?X"
865  for (input++; input[0] == ' '; input++)
866  ;
867  n = rz_num_math(core->num, input);
868  rz_cons_printf("%" PFMT64x "\n", n);
869  break;
870  case 'x': // "?x"
871  for (input++; input[0] == ' '; input++)
872  ;
873  if (*input == '-') {
874  ut8 *out = malloc(strlen(input) + 1);
875  if (out) {
876  int len = rz_hex_str2bin(input + 1, out);
877  if (len >= 0) {
878  out[len] = 0;
879  rz_cons_println((const char *)out);
880  } else {
881  eprintf("Error parsing the hexpair string\n");
882  }
883  free(out);
884  }
885  } else if (*input == '+') {
886  ut64 n = rz_num_math(core->num, input);
887  int bits = rz_num_to_bits(NULL, n) / 8;
888  for (i = 0; i < bits; i++) {
889  rz_cons_printf("%02x", (ut8)((n >> (i * 8)) & 0xff));
890  }
891  rz_cons_newline();
892  } else {
893  if (*input == ' ') {
894  input++;
895  }
896  for (i = 0; input[i]; i++) {
897  rz_cons_printf("%02x", input[i]);
898  }
899  rz_cons_newline();
900  }
901  break;
902  case 'E': // "?E" clippy echo
904  break;
905  case 'e': // "?e" echo
906  switch (input[1]) {
907  case 't': // "?et newtitle"
909  break;
910  case '=': { // "?e="
911  ut64 pc = rz_num_math(core->num, input + 2);
912  rz_print_progressbar(core->print, pc, 80);
913  rz_cons_newline();
914  break;
915  }
916  case 'c': // "?ec" column
917  rz_cons_column(rz_num_math(core->num, input + 2));
918  break;
919  case 'g': { // "?eg" gotoxy
920  int x = atoi(input + 2);
921  char *arg = strchr(input + 2, ' ');
922  int y = arg ? atoi(arg + 1) : 0;
923  rz_cons_gotoxy(x, y);
924  } break;
925  case 'n': { // "?en" echo -n
926  const char *msg = rz_str_trim_head_ro(input + 2);
927  // TODO: replace all ${flagname} by its value in hexa
928  char *newmsg = filterFlags(core, msg);
929  rz_str_unescape(newmsg);
930  rz_cons_print(newmsg);
931  free(newmsg);
932  break;
933  }
934  case ' ': {
935  const char *msg = rz_str_trim_head_ro(input + 1);
936  // TODO: replace all ${flagname} by its value in hexa
937  char *newmsg = filterFlags(core, msg);
938  rz_str_unescape(newmsg);
939  rz_cons_println(newmsg);
940  free(newmsg);
941  } break;
942  case 0:
943  rz_cons_newline();
944  break;
945  default:
947  break;
948  }
949  break;
950  case 's': { // "?s" sequence from to step
951  ut64 from, to, step;
952  char *p, *p2;
953  for (input++; *input == ' '; input++)
954  ;
955  p = strchr(input, ' ');
956  if (p) {
957  *p = '\0';
958  from = rz_num_math(core->num, input);
959  p2 = strchr(p + 1, ' ');
960  if (p2) {
961  *p2 = '\0';
962  step = rz_num_math(core->num, p2 + 1);
963  } else {
964  step = 1;
965  }
966  to = rz_num_math(core->num, p + 1);
967  for (; from <= to; from += step)
968  rz_cons_printf("%" PFMT64d " ", from);
969  rz_cons_newline();
970  }
971  break;
972  }
973  case 'P': { // "?P" physical to virtual address conversion
974  ut64 n = (input[0] && input[1]) ? rz_num_math(core->num, input + 2) : core->offset;
975  ut64 vaddr = rz_io_p2v(core->io, n);
976  if (vaddr == UT64_MAX) {
977  rz_cons_printf("no map at 0x%08" PFMT64x "\n", n);
978  } else {
979  rz_cons_printf("0x%08" PFMT64x "\n", vaddr);
980  }
981  break;
982  }
983  case 'p': { // "?p" virtual to physical address conversion
984  ut64 n = (input[0] && input[1]) ? rz_num_math(core->num, input + 2) : core->offset;
985  ut64 paddr = rz_io_v2p(core->io, n);
986  if (paddr == UT64_MAX) {
987  rz_cons_printf("no map at 0x%08" PFMT64x "\n", n);
988  } else {
989  rz_cons_printf("0x%08" PFMT64x "\n", paddr);
990  }
991  break;
992  }
993  case '_': // "?_" hud input
994  rz_core_yank_hud_file(core, input + 1);
995  break;
996  case 'i': // "?i" input num
997  rz_cons_set_raw(0);
998  if (!rz_cons_is_interactive()) {
999  eprintf("Not running in interactive mode\n");
1000  } else {
1001  switch (input[1]) {
1002  case 'f': // "?if"
1003  core->num->value = !rz_num_conditional(core->num, input + 2);
1004  eprintf("%s\n", rz_str_bool(!core->num->value));
1005  break;
1006  case 'm': // "?im"
1007  rz_cons_message(input + 2);
1008  break;
1009  case 'p': // "?ip"
1010  core->num->value = rz_core_yank_hud_path(core, input + 2, 0) == true;
1011  break;
1012  case 'k': // "?ik"
1014  break;
1015  case 'y': // "?iy"
1016  for (input += 2; *input == ' '; input++)
1017  ;
1018  core->num->value = rz_cons_yesno(1, "%s? (Y/n)", input);
1019  break;
1020  case 'n': // "?in"
1021  for (input += 2; *input == ' '; input++)
1022  ;
1023  core->num->value = rz_cons_yesno(0, "%s? (y/N)", input);
1024  break;
1025  default: {
1026  char foo[1024];
1027  rz_cons_flush();
1028  for (input++; *input == ' '; input++)
1029  ;
1030  // TODO: rz_cons_input()
1031  snprintf(foo, sizeof(foo) - 1, "%s: ", input);
1033  rz_cons_fgets(foo, sizeof(foo), 0, NULL);
1034  foo[sizeof(foo) - 1] = 0;
1035  rz_core_yank_set_str(core, RZ_CORE_FOREIGN_ADDR, foo);
1036  core->num->value = rz_num_math(core->num, foo);
1037  } break;
1038  }
1039  }
1040  rz_cons_set_raw(0);
1041  break;
1042  case 'w': { // "?w"
1043  ut64 addr = rz_num_math(core->num, input + 1);
1044  char *rstr = core->print->hasrefs(core->print->user, addr, true);
1045  if (!rstr) {
1046  eprintf("Cannot get refs\n");
1047  break;
1048  }
1049  rz_cons_println(rstr);
1050  free(rstr);
1051  break;
1052  }
1053  case 't': { // "?t"
1055  rz_core_cmd(core, input + 1, 0);
1057  double seconds = (double)(end - start) / RZ_USEC_PER_SEC;
1058  core->num->value = (ut64)seconds;
1059  eprintf("%lf\n", seconds);
1060  break;
1061  }
1062  case '?': // "??"
1063  if (input[1] == '?') {
1064  if (input[2] == '?') { // "???"
1065  rz_core_clippy(core, "What are you doing?");
1066  return 0;
1067  }
1068  if (input[2]) {
1069  if (core->num->value) {
1070  rz_core_cmd(core, input + 1, 0);
1071  }
1072  break;
1073  }
1075  return 0;
1076  } else if (input[1]) {
1077  if (core->num->value) {
1078  core->num->value = rz_core_cmd(core, input + 1, 0);
1079  }
1080  } else {
1081  if (core->num->dbz) {
1082  eprintf("RzNum ERROR: Division by Zero\n");
1083  }
1084  rz_cons_printf("%" PFMT64d "\n", core->num->value);
1085  }
1086  break;
1087  case '\0': // "?"
1088  default:
1089  break;
1090  }
1091  return 0;
1092 }
size_t len
Definition: 6502dis.c:15
#define e(frag)
#define RZ_IPI
Definition: analysis_wasm.c:11
lzma_index ** i
Definition: index.h:629
ut16 val
Definition: armass64_const.h:6
int bits(struct state *s, int need)
Definition: blast.c:72
const lzma_allocator const uint8_t size_t uint8_t * out
Definition: block.h:528
RZ_API void rz_core_cmd_help(const RzCore *core, const char *help[])
Definition: cmd.c:163
RZ_API int rz_core_cmd(RzCore *core, const char *cstr, int log)
Definition: cmd.c:5328
static void cmd_help_exclamation(RzCore *core)
Definition: cmd_help.c:211
static const char * help_msg_question_v[]
Definition: cmd_help.c:132
static const char * avatar_clippy[]
Definition: cmd_help.c:285
RZ_API void rz_core_help_vars_print(RzCore *core)
Definition: cmd_help.c:370
static const char * avatar_orangg[]
Definition: cmd_help.c:273
static const char * help_msg_env[]
Definition: cmd_help.c:37
static const char * help_msg_question_V[]
Definition: cmd_help.c:188
static const char * help_msg_exclamation[]
Definition: cmd_help.c:55
RZ_API const char ** rz_core_help_vars_get(RzCore *core)
Returns all the $ variable names in a NULL-terminated array.
Definition: cmd_help.c:360
static char * filterFlags(RzCore *core, const char *msg)
Definition: cmd_help.c:231
static const char * help_msg_greater_sign[]
Definition: cmd_help.c:201
RZ_API void rz_core_clippy(RzCore *core, const char *msg)
Definition: cmd_help.c:385
static const char * help_msg_percent[]
Definition: cmd_help.c:25
static ut32 vernum(const char *s)
Definition: cmd_help.c:10
static const char * avatar_cybcat[]
Definition: cmd_help.c:333
static const char * avatar_clippy_utf8[]
Definition: cmd_help.c:309
static const char * help_msg_question_e[]
Definition: cmd_help.c:72
@ RZ_AVATAR_ORANGG
Definition: cmd_help.c:352
@ RZ_AVATAR_CLIPPY
Definition: cmd_help.c:354
@ RZ_AVATAR_CYBCAT
Definition: cmd_help.c:353
static void cmd_help_percent(RzCore *core)
Definition: cmd_help.c:216
static const char * help_msg_question[]
Definition: cmd_help.c:82
RZ_IPI int rz_cmd_help(void *data, const char *input)
Definition: cmd_help.c:419
static const char * findBreakChar(const char *s)
Definition: cmd_help.c:221
static const char * help_msg_at_at[]
Definition: cmd_print.c:154
static void helpCmdTasks(RzCore *core)
Definition: cmd_print.c:1085
static const char * help_msg_at_at_at[]
Definition: cmd_print.c:175
static const char * help_msg_at[]
Definition: cmd_print.c:102
RZ_API RZ_OWN RzList * rz_core_get_boundaries_prot(RzCore *core, int perm, const char *mode, const char *prefix)
Definition: cmd_search.c:577
RZ_API ut64 rz_config_get_i(RzConfig *cfg, RZ_NONNULL const char *name)
Definition: config.c:119
RZ_API void rz_cons_set_raw(bool is_raw)
Definition: cons.c:1617
RZ_API void rz_cons_set_title(const char *str)
Definition: cons.c:1733
RZ_API void rz_cons_column(int c)
Definition: cons.c:1707
RZ_API void rz_cons_newline(void)
Definition: cons.c:1274
RZ_API int rz_cons_printf(const char *format,...)
Definition: cons.c:1202
RZ_API bool rz_cons_is_interactive(void)
Definition: cons.c:365
RZ_API void rz_cons_flush(void)
Definition: cons.c:959
RZ_API void rz_cons_println(const char *str)
Definition: cons.c:233
RZ_API void rz_cons_gotoxy(int x, int y)
Definition: cons.c:724
#define RZ_API
#define NULL
Definition: cris-opc.c:27
#define r
Definition: crypto_rc6.c:12
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
Definition: sflib.h:133
uint32_t ut32
const char * k
Definition: dsignal.c:11
const char * v
Definition: dsignal.c:12
static states step(struct re_guts *, sopno, sopno, states, int, states)
Definition: engine.c:888
size_t map(int syms, int left, int len)
Definition: enough.c:237
RZ_API void Ht_() free(HtName_(Ht) *ht)
Definition: ht_inc.c:130
RZ_API void rz_cons_message(RZ_NONNULL const char *msg)
Definition: hud.c:321
RZ_API int rz_cons_any_key(const char *msg)
Definition: input.c:393
RZ_API int rz_cons_fgets(char *buf, int len, int argc, const char **argv)
Definition: input.c:339
RZ_API bool rz_cons_yesno(int def, const char *fmt,...)
Definition: input.c:666
voidpf void * buf
Definition: ioapi.h:138
snprintf
Definition: kernel.h:364
uint8_t ut8
Definition: lh5801.h:11
void * p
Definition: libc.cpp:67
static RzMain foo[]
Definition: main.c:11
static void list(RzEgg *egg)
Definition: rz-gg.c:52
RZ_API ut32 rz_list_length(RZ_NONNULL const RzList *list)
Returns the length of the list.
Definition: list.c:109
RZ_API RZ_OWN void * rz_list_pop_head(RZ_NONNULL RzList *list)
Removes and returns the first element of the list.
Definition: list.c:401
RZ_API void rz_list_free(RZ_NONNULL RzList *list)
Empties the list and frees the list pointer.
Definition: list.c:137
void * malloc(size_t size)
Definition: malloc.c:123
void * calloc(size_t number, size_t size)
Definition: malloc.c:102
RZ_API void rz_line_set_prompt(const char *prompt)
Definition: line.c:56
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 struct tms static buf static getgid static geteuid const char static filename static arg static mask struct ustat static ubuf static getppid static setsid static egid sigset_t static set struct timeval struct timezone static tz fd_set fd_set fd_set struct timeval static timeout const char char static bufsiz const char static swapflags void static offset const char static length static mode static who const char struct statfs static buf unsigned unsigned num
Definition: sflib.h:126
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")
int x
Definition: mipsasm.c:20
int n
Definition: mipsasm.c:19
int type
Definition: mipsasm.c:17
RZ_API void rz_print_progressbar(RzPrint *p, int pc, int _cols)
Definition: print.c:1259
static void pad(RzStrBuf *sb, ut32 count)
Definition: protobuf.c:36
#define eprintf(x, y...)
Definition: rlcc.c:7
static RzSocket * s
Definition: rtr.c:28
RZ_API const char * ret_ascii_table(void)
Definition: ascii_table.c:78
RZ_API size_t rz_base64_encode(char *bout, const ut8 *bin, size_t sz)
Definition: ubase64.c:81
RZ_API int rz_base64_decode(ut8 *bout, const char *bin, int len)
Definition: ubase64.c:48
RZ_API int rz_hex_str2bin(const char *in, ut8 *out)
Convert an input string in into the binary form in out.
Definition: hex.c:444
RZ_API ut64 rz_io_v2p(RzIO *io, ut64 va)
Definition: io.c:541
RZ_API ut64 rz_io_p2v(RzIO *io, ut64 pa)
Definition: io.c:533
static ut64 rz_itv_end(RzInterval itv)
Definition: rz_itv.h:42
RZ_API bool rz_name_validate_char(const char ch, bool strict)
Definition: name.c:6
RZ_API RzList * rz_num_str_split_list(char *str)
Definition: unum.c:905
RZ_API ut64 rz_num_get(RzNum *num, const char *str)
Definition: unum.c:172
RZ_API int rz_num_to_bits(char *out, ut64 num)
Definition: unum.c:542
RZ_API ut64 rz_num_math(RzNum *num, const char *str)
Definition: unum.c:456
RZ_API int rz_num_conditional(RzNum *num, const char *str)
Definition: unum.c:603
RZ_API int rz_num_to_trits(char *out, ut64 num)
Definition: unum.c:578
RZ_API char * rz_num_units(char *buf, size_t len, ut64 number)
Definition: unum.c:108
RZ_API int rz_num_between(RzNum *num, const char *input_value)
Definition: unum.c:826
RZ_API char * rz_num_as_string(RzNum *___, ut64 n, bool printable_only)
Definition: unum.c:705
RZ_API int rz_num_rand(int max)
Definition: unum.c:47
RZ_API PJ * pj_new(void)
Definition: pj.c:25
RZ_API PJ * pj_ki(PJ *j, const char *k, int d)
Definition: pj.c:149
RZ_API PJ * pj_end(PJ *j)
Definition: pj.c:87
RZ_API const char * pj_string(PJ *pj)
Definition: pj.c:57
RZ_API void pj_free(PJ *j)
Definition: pj.c:34
RZ_API PJ * pj_o(PJ *j)
Definition: pj.c:75
RZ_API PJ * pj_ks(PJ *j, const char *k, const char *v)
Definition: pj.c:170
RZ_API char * rz_str_repeat(const char *ch, int sz)
Definition: str.c:3249
RZ_API char * rz_str_append(char *ptr, const char *string)
Definition: str.c:1063
RZ_API ut64 rz_str_djb2_hash(const char *str)
Definition: str.c:383
RZ_API char RZ_API char * rz_str_newlen(const char *str, int len)
Definition: str.c:871
RZ_API const char * rz_str_bool(int b)
Definition: str.c:3896
RZ_API char * rz_str_appendlen(char *ptr, const char *string, int slen)
Definition: str.c:1043
RZ_API int rz_str_bits64(char *strout, ut64 in)
Definition: str.c:244
RZ_API size_t rz_str_len_utf8(const char *s)
Definition: str.c:2709
RZ_API int rz_str_bits(char *strout, const ut8 *buf, int len, const char *bitz)
Definition: str.c:195
RZ_API const char * rz_str_trim_head_ro(const char *str)
Definition: str_trim.c:86
RZ_API char * rz_str_replace(char *str, const char *key, const char *val, int g)
Definition: str.c:1110
RZ_API const char * rz_str_pad(const char ch, int len)
Definition: str.c:3236
RZ_API char * rz_str_version(const char *program)
Definition: str.c:4051
RZ_API int rz_str_unescape(char *buf)
Definition: str.c:1300
#define rz_strf(buf,...)
Convenience macro for local temporary strings.
Definition: rz_str.h:59
#define RZ_USEC_PER_SEC
Definition: rz_time.h:9
RZ_API ut64 rz_time_now_mono(void)
Returns the current time in microseconds, using the monotonic clock.
Definition: time.c:102
#define PFMT64d
Definition: rz_types.h:394
#define RZ_SYS_BITS
Definition: rz_types.h:520
#define RZ_SYS_ARCH
Definition: rz_types.h:519
#define RZ_SYS_OS
Definition: rz_types.h:587
#define PFMT64u
Definition: rz_types.h:395
#define RZ_ARRAY_SIZE(x)
Definition: rz_types.h:300
#define PFMT64o
Definition: rz_types.h:396
#define PFMT64x
Definition: rz_types.h:393
#define st8
Definition: rz_types_base.h:16
#define RZ_EMPTY
Definition: rz_types_base.h:68
#define st64
Definition: rz_types_base.h:10
#define UT32_MAX
Definition: rz_types_base.h:99
#define UT64_MAX
Definition: rz_types_base.h:86
#define UT8_MAX
#define st16
Definition: rz_types_base.h:14
#define st32
Definition: rz_types_base.h:12
#define UT16_MAX
#define RZ_VERSION_PATCH
Definition: rz_version.h:6
#define RZ_VERSION
Definition: rz_version.h:8
#define RZ_VERSION_MAJOR
Definition: rz_version.h:4
#define RZ_VERSION_NUMBER
Definition: rz_version.h:7
#define RZ_VERSION_MINOR
Definition: rz_version.h:5
static struct sockaddr static addrlen static backlog const void static flags void struct sockaddr from
Definition: sfsocketcall.h:123
static struct sockaddr static addrlen static backlog const void static flags void struct sockaddr socklen_t static fromlen const void const struct sockaddr to
Definition: sfsocketcall.h:125
static struct sockaddr static addrlen static backlog const void msg
Definition: sfsocketcall.h:119
#define d(i)
Definition: sha256.c:44
#define b(i)
Definition: sha256.c:42
#define f(i)
Definition: sha256.c:46
#define a(i)
Definition: sha256.c:41
Definition: rz_pj.h:12
ut64 offset
Definition: rz_core.h:301
RzIO * io
Definition: rz_core.h:313
RzNum * num
Definition: rz_core.h:316
int curtab
Definition: rz_core.h:367
RzPrint * print
Definition: rz_core.h:327
RzConfig * config
Definition: rz_core.h:300
RzCoreTimes * times
Definition: rz_core.h:325
ut64 file_open_time
Definition: rz_core.h:180
ut64 loadlibs_init_time
Definition: rz_core.h:178
ut64 loadlibs_time
Definition: rz_core.h:179
double fvalue
Definition: rz_num.h:64
ut64 value
Definition: rz_num.h:63
int dbz
Definition: rz_num.h:66
void * user
Definition: rz_print.h:110
RzPrintHasRefs hasrefs
Definition: rz_print.h:150
ut64 buflen
Definition: core.c:76
if(dbg->bits==RZ_SYS_BITS_64)
Definition: windows-arm64.h:4
ut64(WINAPI *w32_GetEnabledXStateFeatures)()
RZ_API bool rz_core_yank_hud_file(RzCore *core, const char *input)
Definition: yank.c:333
RZ_API bool rz_core_yank_set_str(RzCore *core, ut64 addr, RZ_NONNULL const char *str)
Definition: yank.c:101
RZ_API bool rz_core_yank_hud_path(RzCore *core, const char *input, int dir)
Definition: yank.c:346
static int addr
Definition: z80asm.c:58
static bool input(void *ud, zip_uint8_t *data, zip_uint64_t length)