Rizin
unix-like reverse engineering framework and cli tools
cmeta.c
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: 2008-2020 nibble <nibble.ds@gmail.com>
2 // SPDX-FileCopyrightText: 2008-2020 pancake <pancake@nopcode.org>
3 // SPDX-FileCopyrightText: 2008-2020 thestr4ng3r <info@florianmaerkl.de>
4 // SPDX-FileCopyrightText: 2021 Anton Kochkov <anton.kochkov@gmail.com>
5 // SPDX-License-Identifier: LGPL-3.0-only
6 
7 #include <rz_core.h>
8 
10  const RzSpace *cur = rz_spaces_current(spaces);
12  RzSpace *s;
13  PJ *pj = state->d.pj;
14  RzSpaceIter it;
15  rz_spaces_foreach(spaces, it, s) {
16  int count = rz_spaces_count(spaces, s->name);
17  switch (state->mode) {
19  pj_o(pj);
20  pj_ks(pj, "name", s->name);
21  pj_ki(pj, "count", count);
22  pj_kb(pj, "selected", cur == s);
23  pj_end(pj);
24  break;
26  rz_cons_printf("%s\n", s->name);
27  break;
29  rz_cons_printf("%s %s\n", spaces->name, s->name);
30  break;
32  rz_cons_printf("%5d %c %s\n", count,
33  (!cur || cur == s) ? '*' : '.', s->name);
34  break;
35  default:
37  break;
38  }
39  }
42  rz_cons_printf("%s %s # current\n", spaces->name, rz_spaces_current_name(spaces));
43  }
44 }
45 
47  char *esc_str = NULL;
48  RzStrEscOptions opt = { 0 };
49  opt.show_asciidot = false;
50  opt.esc_bslash = core->print->esc_bslash;
51  switch (mi->subtype) {
56  case RZ_STRING_ENC_UTF8:
57  // All strings that are put into the metadata are already converted
58  esc_str = rz_str_escape_utf8(mi->str, &opt);
59  break;
65  case RZ_STRING_ENC_8BIT:
66  esc_str = rz_str_escape_8bit(mi->str, false, &opt);
67  break;
68  default:
70  }
71  return esc_str;
72 }
73 
75  if (rz_spaces_current(&core->analysis->meta_spaces) &&
76  rz_spaces_current(&core->analysis->meta_spaces) != d->space) {
77  return;
78  }
79  PJ *pj = state->d.pj;
80  RzOutputMode mode = state->mode;
81  char *pstr, *base64_str;
82  char *str = NULL;
83  if (d->str) {
84  if (d->type == RZ_META_TYPE_STRING) {
85  str = meta_string_escape(core, d);
86  } else {
87  str = rz_str_escape(d->str);
88  }
89  }
90  if (str || d->type == RZ_META_TYPE_DATA) {
91  if (d->type == RZ_META_TYPE_STRING && !*str) {
92  free(str);
93  return;
94  }
95  if (!str) {
96  pstr = "";
97  } else if (d->type == RZ_META_TYPE_FORMAT) {
98  pstr = str;
99  } else if (d->type == RZ_META_TYPE_STRING) {
100  pstr = str;
101  } else if (d->type == RZ_META_TYPE_VARTYPE) {
102  // Sanitize (don't escape) Ct comments so we can see "char *", etc.
103  free(str);
104  str = strdup(d->str);
106  pstr = str;
107  } else if (d->type != RZ_META_TYPE_COMMENT) {
108  rz_name_filter(str, 0, true);
109  pstr = str;
110  } else {
111  pstr = d->str;
112  }
113  switch (mode) {
114  case RZ_OUTPUT_MODE_JSON:
115  pj_o(pj);
116  pj_kn(pj, "offset", start);
117  pj_ks(pj, "type", rz_meta_type_to_string(d->type));
118 
119  if (d->type == RZ_META_TYPE_HIGHLIGHT) {
120  pj_k(pj, "color");
121  ut8 r = 0, g = 0, b = 0, A = 0;
122  const char *esc = strchr(d->str, '\x1b');
123  if (esc) {
124  rz_cons_rgb_parse(esc, &r, &g, &b, &A);
125  char *rgb_str = rz_cons_rgb_tostring(r, g, b);
126  base64_str = rz_base64_encode_dyn((const ut8 *)rgb_str, strlen(rgb_str));
127  if (d->type == RZ_META_TYPE_STRING && base64_str) {
128  pj_s(pj, base64_str);
129  } else {
130  pj_s(pj, rgb_str);
131  }
132  free(base64_str);
133  free(rgb_str);
134  } else {
135  pj_s(pj, str);
136  }
137  } else {
138  pj_k(pj, "name");
139  if (d->type == RZ_META_TYPE_STRING && (base64_str = rz_base64_encode_dyn((const ut8 *)d->str, strlen(d->str)))) {
140  pj_s(pj, base64_str);
141  free(base64_str);
142  } else {
143  pj_s(pj, rz_str_get(str));
144  }
145  }
146  if (d->type == RZ_META_TYPE_DATA) {
147  pj_kn(pj, "size", size);
148  } else if (d->type == RZ_META_TYPE_STRING) {
149  const char *enc = rz_str_enc_as_string(d->subtype);
150  pj_ks(pj, "enc", enc);
151  pj_kb(pj, "ascii", rz_str_is_ascii(d->str));
152  }
153  pj_end(pj);
154  break;
156  default:
157  switch (d->type) {
158  case RZ_META_TYPE_COMMENT: {
159  const char *type = rz_meta_type_to_string(d->type);
160  char *s = sdb_encode((const ut8 *)pstr, -1);
161  if (!s) {
162  s = strdup(pstr);
163  }
164  if (mode == RZ_OUTPUT_MODE_RIZIN) {
165  if (!strcmp(type, "CCu")) {
166  rz_cons_printf("%s base64:%s @ 0x%08" PFMT64x "\n",
167  type, s, start);
168  } else {
169  rz_cons_printf("%s %s @ 0x%08" PFMT64x "\n",
170  type, pstr, start);
171  }
172  } else {
173  if (!strcmp(type, "CCu")) {
174  char *mys = rz_str_escape(pstr);
175  rz_cons_printf("0x%08" PFMT64x " %s \"%s\"\n",
176  start, type, mys);
177  free(mys);
178  } else {
179  rz_cons_printf("0x%08" PFMT64x " %s \"%s\"\n",
180  start, type, pstr);
181  }
182  }
183  free(s);
184  } break;
185  case RZ_META_TYPE_STRING:
186  if (mode == RZ_OUTPUT_MODE_RIZIN) {
187  char cmd[] = "Cs#";
188  switch (d->subtype) {
189  case RZ_STRING_ENC_8BIT:
190  case RZ_STRING_ENC_UTF8:
191  cmd[2] = d->subtype;
192  break;
195  cmd[2] = 'w';
196  break;
199  cmd[2] = 'W';
200  break;
201  default:
202  cmd[2] = 0;
203  }
204  rz_cons_printf("%s %" PFMT64u " @ 0x%08" PFMT64x " # %s\n",
205  cmd, size, start, pstr);
206  } else {
207  const char *enc;
208  if (d->subtype == RZ_STRING_ENC_8BIT) {
209  enc = rz_str_is_ascii(d->str) ? "ascii" : "8bit";
210  } else {
211  enc = rz_str_enc_as_string(d->subtype);
212  }
213  if (show_full || mode == RZ_OUTPUT_MODE_LONG) {
214  rz_cons_printf("0x%08" PFMT64x " %s[%" PFMT64u "] \"%s\"\n",
215  start, enc, size, pstr);
216  } else if (mode == RZ_OUTPUT_MODE_STANDARD) {
217  rz_cons_printf("%s[%" PFMT64u "] \"%s\"\n",
218  enc, size, pstr);
219  } else {
220  rz_cons_printf("\"%s\"\n", pstr);
221  }
222  }
223  break;
224  case RZ_META_TYPE_HIDE:
225  case RZ_META_TYPE_DATA:
226  if (mode == RZ_OUTPUT_MODE_RIZIN) {
227  rz_cons_printf("%s %" PFMT64u " @ 0x%08" PFMT64x "\n",
228  rz_meta_type_to_string(d->type),
229  size, start);
230  } else {
231  if (show_full || mode == RZ_OUTPUT_MODE_LONG) {
232  const char *dtype = d->type == RZ_META_TYPE_HIDE ? "hidden" : "data";
233  rz_cons_printf("0x%08" PFMT64x " %s %s %" PFMT64u "\n",
234  start, dtype,
235  rz_meta_type_to_string(d->type), size);
236  } else {
237  rz_cons_printf("%" PFMT64u "\n", size);
238  }
239  }
240  break;
241  case RZ_META_TYPE_MAGIC:
242  case RZ_META_TYPE_FORMAT:
243  if (mode == RZ_OUTPUT_MODE_RIZIN) {
244  rz_cons_printf("%s %" PFMT64u " %s @ 0x%08" PFMT64x "\n",
245  rz_meta_type_to_string(d->type),
246  size, pstr, start);
247  } else {
248  if (show_full || mode == RZ_OUTPUT_MODE_LONG) {
249  const char *dtype = d->type == RZ_META_TYPE_MAGIC ? "magic" : "format";
250  rz_cons_printf("0x%08" PFMT64x " %s %" PFMT64u " %s\n",
251  start, dtype, size, pstr);
252  } else {
253  rz_cons_printf("%" PFMT64u " %s\n", size, pstr);
254  }
255  }
256  break;
258  if (mode == RZ_OUTPUT_MODE_RIZIN) {
259  rz_cons_printf("%s %s @ 0x%08" PFMT64x "\n",
260  rz_meta_type_to_string(d->type), pstr, start);
261  } else {
262  rz_cons_printf("0x%08" PFMT64x " %s\n", start, pstr);
263  }
264  break;
265  case RZ_META_TYPE_HIGHLIGHT: {
266  ut8 r = 0, g = 0, b = 0, A = 0;
267  const char *esc = strchr(d->str, '\x1b');
268  rz_cons_rgb_parse(esc, &r, &g, &b, &A);
269  rz_cons_printf("%s rgb:%02x%02x%02x @ 0x%08" PFMT64x "\n",
270  rz_meta_type_to_string(d->type), r, g, b, start);
271  // TODO: d->size
272  } break;
273  default:
274  if (mode == RZ_OUTPUT_MODE_RIZIN) {
275  rz_cons_printf("%s %" PFMT64u " 0x%08" PFMT64x " # %s\n",
276  rz_meta_type_to_string(d->type),
277  size, start, pstr);
278  } else {
279  // TODO: use b64 here
280  rz_cons_printf("0x%08" PFMT64x " array[%" PFMT64u "] %s %s\n",
281  start, size,
282  rz_meta_type_to_string(d->type), pstr);
283  }
284  break;
285  }
286  break;
287  }
288  if (str) {
289  free(str);
290  }
291  }
292 }
293 
294 typedef struct {
296  const RzSpace *space;
297 
298  RzPVector /*RzIntervalNode*/ *result;
299 } CollectCtx;
300 
302  return (type == RZ_META_TYPE_ANY || item->type == type) && (!space || item->space == space);
303 }
304 
305 static bool collect_nodes_cb(RzIntervalNode *node, void *user) {
306  CollectCtx *ctx = user;
307  if (item_matches_filter(node->data, ctx->type, ctx->space)) {
308  rz_pvector_push(ctx->result, node);
309  }
310  return true;
311 }
312 
314  CollectCtx ctx = {
315  .type = type,
316  .space = space,
317  .result = rz_pvector_new(NULL)
318  };
319  if (!ctx.result) {
320  return NULL;
321  }
323  return ctx.result;
324 }
325 
329  if (!nodes) {
330  return;
331  }
333  void **it;
334  rz_pvector_foreach (nodes, it) {
335  RzIntervalNode *node = *it;
336  rz_core_meta_print(core, node->data, node->start, rz_meta_node_size(node), true, state);
337  }
338  rz_pvector_free(nodes);
340 }
341 
343  RzAnalysisFunction *fcn = NULL;
344  if (addr != UT64_MAX) {
345  fcn = rz_analysis_get_fcn_in(core->analysis, addr, 0);
346  if (!fcn) {
347  return;
348  }
349  }
351  RzAnalysisMetaItem *item;
352  rz_interval_tree_foreach (&core->analysis->meta, it, item) {
354  if (type != RZ_META_TYPE_ANY && item->type != type) {
355  continue;
356  }
357  if (fcn && !rz_analysis_function_contains(fcn, node->start)) {
358  continue;
359  }
360  rz_core_meta_print(core, item, node->start, rz_meta_node_size(node), true, state);
361  }
362 }
363 
368 }
369 
372  print_meta_list(core, type, addr, state);
374 }
375 
376 RZ_IPI void rz_core_meta_append(RzCore *core, const char *newcomment, RzAnalysisMetaType mtype, ut64 addr) {
377  const char *comment = rz_meta_get_string(core->analysis, mtype, addr);
378  char *nc = strdup(newcomment);
379  rz_str_unescape(nc);
380  if (comment) {
381  char *text = rz_str_newf("%s %s", comment, nc);
382  if (text) {
383  rz_meta_set_string(core->analysis, mtype, addr, text);
384  free(text);
385  } else {
386  rz_sys_perror("malloc");
387  }
388  } else {
389  rz_meta_set_string(core->analysis, mtype, addr, nc);
390  }
391  free(nc);
392 }
393 
395  const char *comment = rz_meta_get_string(core->analysis, mtype, addr);
396  char *out = rz_core_editor(core, NULL, comment);
397  if (out) {
398  rz_meta_del(core->analysis, mtype, addr, 1);
399  rz_meta_set_string(core->analysis, mtype, addr, out);
400  free(out);
401  }
402 }
403 
409 static bool meta_string_8bit_add(RzCore *core, ut64 addr, size_t limit, ut8 **name, size_t *name_len) {
410  rz_return_val_if_fail(limit && name && name_len, false);
411  *name = malloc(limit + 1);
412  if (!*name) {
413  return false;
414  }
415  if (!rz_io_read_at(core->io, addr, *name, limit)) {
416  RZ_FREE(*name);
417  return false;
418  }
419  (*name)[limit] = '\0';
420  *name_len = strlen((char *)*name);
421  return true;
422 }
423 
424 static bool meta_string_guess_add(RzCore *core, ut64 addr, size_t limit, char **name_out, size_t *name_len, RzDetectedString **ds, RzStrEnc encoding) {
425  rz_return_val_if_fail(limit && name_out && name_len && ds, false);
426  char *name = malloc(limit + 1);
427  if (!name) {
428  return false;
429  }
430  RzBinFile *bf = rz_bin_cur(core->bin);
431  RzBinObject *obj = rz_bin_cur_object(core->bin);
432  if (!bf || !obj) {
433  free(name);
434  return false;
435  }
436  bool big_endian = rz_config_get_b(core->config, "cfg.bigendian");
437  RzUtilStrScanOptions scan_opt = {
438  .buf_size = 2048,
439  .max_uni_blocks = 4,
440  .min_str_length = 4,
441  .prefer_big_endian = big_endian,
442  .check_ascii_freq = bf->rbin->strseach_check_ascii_freq
443  };
444  RzList *str_list = rz_list_new();
445  if (!str_list) {
446  free(name);
447  return false;
448  }
449  ut64 paddr = rz_io_v2p(core->io, addr);
450  int count = rz_scan_strings(bf->buf, str_list, &scan_opt, paddr, paddr + limit, encoding);
451  if (count <= 0) {
452  rz_list_free(str_list);
453  free(name);
454  return false;
455  }
456  *ds = rz_list_first(str_list);
457  rz_list_free(str_list);
458  rz_str_ncpy(name, (*ds)->string, limit);
459  name[limit] = '\0';
460  *name_out = name;
461  return true;
462 }
463 
475  char *guessname = NULL;
476  size_t name_len = 0;
477  ut64 limit = size ? size : core->blocksize;
478  size_t n = 0;
479  bool result = false;
481  if (!meta_string_8bit_add(core, addr, limit, (ut8 **)&guessname, &name_len)) {
482  goto out;
483  }
484  n = size == 0 ? name_len + 1 : size;
485  } else {
486  RzDetectedString *ds = NULL;
487  if (!meta_string_guess_add(core, addr, limit, &guessname, &name_len, &ds, encoding)) {
488  return false;
489  }
490  if (!ds) {
491  goto out;
492  }
493  encoding = ds->type;
494  n = ds->size;
495  }
496  if (!name) {
497  result = rz_meta_set_with_subtype(core->analysis, RZ_META_TYPE_STRING, encoding, addr, n, guessname);
498  } else {
500  }
501 out:
502  free(guessname);
503  return result;
504 }
505 
518  // We shall read the first byte and it will be the size of the 8-bit or UTF-8 string
519  RzBinFile *bf = rz_bin_cur(core->bin);
520  if (!bf) {
521  return false;
522  }
523  ut8 size;
524  ut64 paddr = rz_io_v2p(core->io, addr);
525  if (!rz_buf_read8_at(bf->buf, paddr, &size)) {
526  return false;
527  }
528  // Note the offset is off by one since the first byte was the size of the string
529  if (!rz_core_meta_string_add(core, core->offset + 1, size, encoding, NULL)) {
530  return false;
531  }
532  return true;
533 }
534 
RZ_API bool rz_analysis_function_contains(RzAnalysisFunction *fcn, ut64 addr)
Definition: function.c:361
#define RZ_IPI
Definition: analysis_wasm.c:11
#define A(x)
Definition: arc.h:165
RZ_API char * sdb_encode(const ut8 *bin, int len)
Definition: base64.c:18
RZ_API RzBinObject * rz_bin_cur_object(RzBin *bin)
Definition: bin.c:900
RZ_API RzBinFile * rz_bin_cur(RzBin *bin)
Definition: bin.c:895
const lzma_allocator const uint8_t size_t uint8_t * out
Definition: block.h:528
RZ_API void rz_cmd_state_output_array_start(RzCmdStateOutput *state)
Mark the start of an array of elements in the output.
Definition: cmd_api.c:2558
RZ_API void rz_cmd_state_output_array_end(RzCmdStateOutput *state)
Mark the end of an array of elements in the output.
Definition: cmd_api.c:2572
static void print_meta_list(RzCore *core, RzAnalysisMetaType type, ut64 addr, RzCmdStateOutput *state)
Definition: cmeta.c:342
RZ_IPI void rz_core_meta_print_list_at(RzCore *core, ut64 addr, RzCmdStateOutput *state)
Definition: cmeta.c:326
static bool item_matches_filter(RzAnalysisMetaItem *item, RzAnalysisMetaType type, RZ_NULLABLE const RzSpace *space)
Definition: cmeta.c:301
RZ_IPI void rz_core_meta_editor(RzCore *core, RzAnalysisMetaType mtype, ut64 addr)
Definition: cmeta.c:394
static bool meta_string_8bit_add(RzCore *core, ut64 addr, size_t limit, ut8 **name, size_t *name_len)
Definition: cmeta.c:409
static RzPVector * collect_nodes_at(RzAnalysis *analysis, RzAnalysisMetaType type, RZ_NULLABLE const RzSpace *space, ut64 addr)
Definition: cmeta.c:313
static bool collect_nodes_cb(RzIntervalNode *node, void *user)
Definition: cmeta.c:305
RZ_IPI void rz_core_meta_append(RzCore *core, const char *newcomment, RzAnalysisMetaType mtype, ut64 addr)
Definition: cmeta.c:376
static bool meta_string_guess_add(RzCore *core, ut64 addr, size_t limit, char **name_out, size_t *name_len, RzDetectedString **ds, RzStrEnc encoding)
Definition: cmeta.c:424
RZ_IPI void rz_core_meta_print_list_in_function(RzCore *core, RzAnalysisMetaType type, ut64 addr, RzCmdStateOutput *state)
Definition: cmeta.c:370
RZ_API bool rz_core_meta_pascal_string_add(RzCore *core, ut64 addr, RzStrEnc encoding, RZ_NULLABLE const char *name)
add a pascal string to RzCore
Definition: cmeta.c:516
RZ_IPI void rz_core_spaces_print(RzCore *core, RzSpaces *spaces, RzCmdStateOutput *state)
Definition: cmeta.c:9
RZ_IPI void rz_core_meta_print(RzCore *core, RzAnalysisMetaItem *d, ut64 start, ut64 size, bool show_full, RzCmdStateOutput *state)
Definition: cmeta.c:74
static char * meta_string_escape(RzCore *core, RzAnalysisMetaItem *mi)
Definition: cmeta.c:46
RZ_API bool rz_core_meta_string_add(RzCore *core, ut64 addr, ut64 size, RzStrEnc encoding, RZ_NULLABLE const char *name)
add a string to RzCore
Definition: cmeta.c:474
RZ_IPI void rz_core_meta_print_list_all(RzCore *core, RzAnalysisMetaType type, RzCmdStateOutput *state)
Definition: cmeta.c:364
RZ_API bool rz_config_get_b(RzConfig *cfg, RZ_NONNULL const char *name)
Definition: config.c:142
RZ_API int rz_cons_printf(const char *format,...)
Definition: cons.c:1202
#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 count
Definition: sflib.h:98
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
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
Definition: sflib.h:79
struct @667 g
RZ_DEPRECATE RZ_API RzAnalysisFunction * rz_analysis_get_fcn_in(RzAnalysis *analysis, ut64 addr, int type)
Definition: fcn.c:1687
RZ_API void Ht_() free(HtName_(Ht) *ht)
Definition: ht_inc.c:130
voidpf void uLong size
Definition: ioapi.h:138
const char int mode
Definition: ioapi.h:137
uint8_t ut8
Definition: lh5801.h:11
const char * spaces(int count)
RZ_API RZ_OWN char * rz_core_editor(const RzCore *core, RZ_NULLABLE const char *file, RZ_NULLABLE const char *str)
Definition: core.c:3214
RZ_API RZ_OWN RzList * rz_list_new(void)
Returns a new initialized RzList pointer (free method is not initialized)
Definition: list.c:235
RZ_API RZ_BORROW void * rz_list_first(RZ_NONNULL const RzList *list)
Returns the first element of the list.
Definition: list.c:77
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
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 uint32_t const uint8_t uint32_t uint32_t limit
Definition: memcmplen.h:45
RZ_API bool rz_meta_set_with_subtype(RzAnalysis *m, RzAnalysisMetaType type, int subtype, ut64 addr, ut64 size, const char *str)
Definition: meta.c:195
RZ_API const char * rz_meta_get_string(RzAnalysis *a, RzAnalysisMetaType type, ut64 addr)
Definition: meta.c:146
RZ_API const char * rz_meta_type_to_string(int type)
Definition: meta.c:236
RZ_API void rz_meta_del(RzAnalysis *a, RzAnalysisMetaType type, ut64 addr, ut64 size)
Definition: meta.c:187
RZ_API bool rz_meta_set_string(RzAnalysis *a, RzAnalysisMetaType type, ut64 addr, const char *s)
Definition: meta.c:141
int n
Definition: mipsasm.c:19
int type
Definition: mipsasm.c:17
const char * name
Definition: op.c:541
RZ_API int rz_cons_rgb_parse(const char *p, ut8 *r, ut8 *g, ut8 *b, ut8 *a)
Definition: rgb.c:113
RZ_API char * rz_cons_rgb_tostring(ut8 r, ut8 g, ut8 b)
Definition: rgb.c:322
static RzSocket * s
Definition: rtr.c:28
RzAnalysisMetaType
Definition: rz_analysis.h:287
@ RZ_META_TYPE_VARTYPE
Definition: rz_analysis.h:297
@ RZ_META_TYPE_ANY
Definition: rz_analysis.h:288
@ RZ_META_TYPE_DATA
Definition: rz_analysis.h:289
@ RZ_META_TYPE_HIGHLIGHT
Definition: rz_analysis.h:296
@ RZ_META_TYPE_HIDE
Definition: rz_analysis.h:294
@ RZ_META_TYPE_MAGIC
Definition: rz_analysis.h:293
@ RZ_META_TYPE_STRING
Definition: rz_analysis.h:291
@ RZ_META_TYPE_COMMENT
Definition: rz_analysis.h:295
@ RZ_META_TYPE_FORMAT
Definition: rz_analysis.h:292
#define rz_warn_if_reached()
Definition: rz_assert.h:29
#define rz_return_val_if_fail(expr, val)
Definition: rz_assert.h:108
RZ_API char * rz_base64_encode_dyn(const ut8 *bin, size_t sz)
Definition: ubase64.c:92
RZ_API bool rz_buf_read8_at(RzBuffer *b, ut64 addr, RZ_NONNULL RZ_OUT ut8 *result)
Read a byte at the specified address in the buffer.
Definition: buf.c:876
RZ_API bool rz_interval_tree_all_at(RzIntervalTree *tree, ut64 start, RzIntervalIterCb cb, void *user)
Definition: intervaltree.c:221
static RzIntervalNode * rz_interval_tree_iter_get(RzIntervalTreeIter *it)
#define rz_interval_tree_foreach(tree, it, dat)
RZ_API bool rz_io_read_at(RzIO *io, ut64 addr, ut8 *buf, int len)
Definition: io.c:300
RZ_API ut64 rz_io_v2p(RzIO *io, ut64 va)
Definition: io.c:541
RZ_API bool rz_name_filter(char *name, int len, bool strict)
Definition: name.c:43
RZ_API PJ * pj_kb(PJ *j, const char *k, bool v)
Definition: pj.c:177
RZ_API PJ * pj_ki(PJ *j, const char *k, int d)
Definition: pj.c:149
RZ_API PJ * pj_k(PJ *j, const char *k)
Definition: pj.c:104
RZ_API PJ * pj_end(PJ *j)
Definition: pj.c:87
RZ_API PJ * pj_o(PJ *j)
Definition: pj.c:75
RZ_API PJ * pj_s(PJ *j, const char *k)
Definition: pj.c:197
RZ_API PJ * pj_ks(PJ *j, const char *k, const char *v)
Definition: pj.c:170
RZ_API PJ * pj_kn(PJ *j, const char *k, ut64 n)
Definition: pj.c:121
#define rz_spaces_foreach(sp, it, s)
Definition: rz_spaces.h:105
static const char * rz_spaces_current_name(RzSpaces *sp)
Definition: rz_spaces.h:95
RZ_API int rz_spaces_count(RzSpaces *sp, const char *name)
Definition: spaces.c:167
static RzSpace * rz_spaces_current(RzSpaces *sp)
Definition: rz_spaces.h:91
static const char * rz_str_get(const char *str)
Definition: rz_str.h:187
RZ_API char * rz_str_newf(const char *fmt,...) RZ_PRINTF_CHECK(1
RZ_API RZ_OWN char * rz_str_escape(RZ_NONNULL const char *buf)
Definition: str.c:1550
RZ_API const char * rz_str_enc_as_string(RzStrEnc enc)
Definition: str.c:44
RZ_API size_t rz_str_ncpy(char *dst, const char *src, size_t n)
Secure string copy with null terminator.
Definition: str.c:923
RzStrEnc
Definition: rz_str.h:19
@ RZ_STRING_ENC_UTF32LE
Definition: rz_str.h:24
@ RZ_STRING_ENC_8BIT
Definition: rz_str.h:20
@ RZ_STRING_ENC_EBCDIC_US
Definition: rz_str.h:31
@ RZ_STRING_ENC_UTF32BE
Definition: rz_str.h:26
@ RZ_STRING_ENC_UTF8
Definition: rz_str.h:21
@ RZ_STRING_ENC_UTF16LE
Definition: rz_str.h:23
@ RZ_STRING_ENC_UTF16BE
Definition: rz_str.h:25
@ RZ_STRING_ENC_EBCDIC_UK
Definition: rz_str.h:30
@ RZ_STRING_ENC_IBM037
Definition: rz_str.h:28
@ RZ_STRING_ENC_IBM290
Definition: rz_str.h:29
@ RZ_STRING_ENC_EBCDIC_ES
Definition: rz_str.h:32
RZ_API char * rz_str_escape_8bit(const char *buf, bool colors, RzStrEscOptions *opt)
Definition: str.c:1595
RZ_API char * rz_str_escape_utf8(const char *buf, RzStrEscOptions *opt)
Definition: str.c:1699
RZ_API int rz_str_unescape(char *buf)
Definition: str.c:1300
RZ_API bool rz_str_is_ascii(const char *str)
Definition: str.c:1988
RZ_API void rz_str_sanitize(char *c)
Definition: str.c:1381
RZ_API int rz_scan_strings(RZ_NONNULL RzBuffer *buf_to_scan, RZ_NONNULL RzList *list, RZ_NONNULL const RzUtilStrScanOptions *opt, const ut64 from, const ut64 to, RzStrEnc type)
Look for strings in an RzBuffer.
Definition: str_search.c:525
#define rz_sys_perror(x)
Definition: rz_types.h:336
#define RZ_NULLABLE
Definition: rz_types.h:65
#define PFMT64u
Definition: rz_types.h:395
RzOutputMode
Enum to describe the way data are printed.
Definition: rz_types.h:38
@ RZ_OUTPUT_MODE_LONG
Definition: rz_types.h:44
@ RZ_OUTPUT_MODE_JSON
Definition: rz_types.h:40
@ RZ_OUTPUT_MODE_QUIET
Definition: rz_types.h:42
@ RZ_OUTPUT_MODE_RIZIN
Definition: rz_types.h:41
@ RZ_OUTPUT_MODE_STANDARD
Definition: rz_types.h:39
#define RZ_FREE(x)
Definition: rz_types.h:369
#define PFMT64x
Definition: rz_types.h:393
#define UT64_MAX
Definition: rz_types_base.h:86
RZ_API RzPVector * rz_pvector_new(RzPVectorFree free)
Definition: vector.c:302
static void ** rz_pvector_push(RzPVector *vec, void *x)
Definition: rz_vector.h:300
RZ_API void rz_pvector_free(RzPVector *vec)
Definition: vector.c:336
#define rz_pvector_foreach(vec, it)
Definition: rz_vector.h:334
#define d(i)
Definition: sha256.c:44
#define b(i)
Definition: sha256.c:42
RzStrEnc type
String type.
Definition: rz_str_search.h:21
ut32 size
Size of buffer containing the string in bytes.
Definition: rz_str_search.h:19
Group together some common options used by string escaping functions.
Definition: rz_str.h:39
bool esc_bslash
When true, backslashes \ are quoted with \\
Definition: rz_str.h:41
bool show_asciidot
When true, dots . are placed instead of unprintable characters.
Definition: rz_str.h:40
size_t buf_size
Maximum size of a detected string.
Definition: rz_str_search.h:28
Definition: z80asm.h:102
Definition: rz_pj.h:12
const RzSpace * space
Definition: rz_analysis.h:306
RzAnalysisMetaType type
Definition: rz_analysis.h:302
RzIntervalTree meta
Definition: rz_analysis.h:600
RzSpaces meta_spaces
Definition: rz_analysis.h:601
XX curplugin == o->plugin.
Definition: rz_bin.h:298
struct rz_bin_t * rbin
Definition: rz_bin.h:316
RzBuffer * buf
Definition: rz_bin.h:303
bool strseach_check_ascii_freq
Definition: rz_bin.h:361
Represent the output state of a command handler.
Definition: rz_cmd.h:91
RzBin * bin
Definition: rz_core.h:298
ut64 offset
Definition: rz_core.h:301
RzAnalysis * analysis
Definition: rz_core.h:322
RzIO * io
Definition: rz_core.h:313
RzPrint * print
Definition: rz_core.h:327
ut32 blocksize
Definition: rz_core.h:303
RzConfig * config
Definition: rz_core.h:300
bool esc_bslash
Definition: rz_print.h:161
Definition: dis.h:43
ut64(WINAPI *w32_GetEnabledXStateFeatures)()
static int addr
Definition: z80asm.c:58