Rizin
unix-like reverse engineering framework and cli tools
cmd_meta.c
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: 2021 Anton Kochkov <anton.kochkov@gmail.com>
2 // SPDX-License-Identifier: LGPL-3.0-only
3 
4 #include <rz_analysis.h>
5 #include <rz_bin.h>
6 #include <rz_cons.h>
7 #include <rz_core.h>
8 #include <rz_util.h>
9 #include <rz_types.h>
10 #include <sdb.h>
11 #include "../core_private.h"
12 
13 #define META_NAME_LENGTH
14 
15 char *getcommapath(RzCore *core);
16 
17 RZ_IPI void rz_core_meta_comment_add(RzCore *core, const char *comment, ut64 addr) {
18  const char *oldcomment = rz_meta_get_string(core->analysis, RZ_META_TYPE_COMMENT, addr);
19  if (!oldcomment || (oldcomment && !strstr(oldcomment, comment))) {
21  }
22 }
23 
24 static const char *meta_get_flag(RzCore *core, ut64 addr) {
25  RzFlagItem *fi;
26  fi = rz_flag_get_i(core->flags, addr);
27  return fi ? fi->name : NULL;
28 }
29 
31  PJ *pj = state->d.pj;
32  switch (state->mode) {
34  pj_o(pj);
35  pj_ks(pj, "name", var->name);
36  pj_ks(pj, "comment", var->comment);
37  pj_end(pj);
38  break;
40  rz_cons_printf("%s : %s\n", var->name, var->comment);
41  break;
42  case RZ_OUTPUT_MODE_RIZIN: {
43  char *b64 = sdb_encode((const ut8 *)var->comment, strlen(var->comment));
44  if (!b64) {
45  return;
46  }
47  rz_cons_printf("\"Cv%c %s base64:%s @ 0x%08" PFMT64x "\"\n", var->kind, var->name, b64, var->fcn->addr);
48  free(b64);
49  break;
50  }
51  default:
53  break;
54  }
55 }
56 
59  if (!fcn) {
60  RZ_LOG_ERROR("Cannot find the function at the 0x%08" PFMT64x " offset", core->offset);
61  return RZ_CMD_STATUS_ERROR;
62  }
63  void **it;
64  rz_pvector_foreach (&fcn->vars, it) {
65  RzAnalysisVar *var = *it;
66  if (var->kind != kind || !var->comment) {
67  continue;
68  }
70  }
71  return RZ_CMD_STATUS_OK;
72 }
73 
76  if (!fcn) {
77  RZ_LOG_ERROR("Cannot find the function at the 0x%08" PFMT64x " offset", core->offset);
78  return RZ_CMD_STATUS_ERROR;
79  }
80  void **it;
81  rz_pvector_foreach (&fcn->vars, it) {
82  RzAnalysisVar *var = *it;
84  }
85  return RZ_CMD_STATUS_OK;
86 }
87 
88 static RzCmdStatus meta_variable_comment_append(RzCore *core, const char *name, const char *comment) {
90  if (!fcn) {
91  RZ_LOG_ERROR("Cannot find the function at the 0x%08" PFMT64x " offset\n", core->offset);
92  return RZ_CMD_STATUS_ERROR;
93  }
94  char *heap_comment = NULL;
95  if (RZ_STR_ISNOTEMPTY(comment)) { // new comment given
96  if (!strncmp(comment, "base64:", 7)) {
97  heap_comment = (char *)sdb_decode(comment + 7, NULL);
98  comment = heap_comment;
99  }
100  }
102  if (!var) {
103  RZ_LOG_ERROR("Can't find variable named `%s`\n", name);
104  return RZ_CMD_STATUS_ERROR;
105  }
106  if (var->comment) {
107  if (comment && *comment) {
108  char *text = rz_str_newf("%s\n%s", var->comment, comment);
109  free(var->comment);
110  var->comment = text;
111  } else {
112  rz_cons_println(var->comment);
113  }
114  } else {
115  var->comment = strdup(comment);
116  }
117  free(heap_comment);
118  return RZ_CMD_STATUS_OK;
119 }
120 
123  if (!fcn) {
124  RZ_LOG_ERROR("Cannot find the function at the 0x%08" PFMT64x " offset\n", core->offset);
125  return RZ_CMD_STATUS_ERROR;
126  }
128  if (!var) {
129  RZ_LOG_ERROR("Can't find variable named `%s`\n", name);
130  return RZ_CMD_STATUS_ERROR;
131  }
132  free(var->comment);
133  var->comment = NULL;
134  return RZ_CMD_STATUS_OK;
135 }
136 
139  if (!fcn) {
140  RZ_LOG_ERROR("Cannot find the function at the 0x%08" PFMT64x " offset\n", core->offset);
141  return RZ_CMD_STATUS_ERROR;
142  }
144  if (!var) {
145  RZ_LOG_ERROR("Can't find variable named `%s`\n", name);
146  return RZ_CMD_STATUS_ERROR;
147  }
148  char *comment = rz_core_editor(core, NULL, var->comment);
149  if (comment) {
150  free(var->comment);
151  var->comment = comment;
152  }
153  return RZ_CMD_STATUS_OK;
154 }
155 
156 static bool meta_set_string(RzCore *core, RzAnalysisMetaType mtype, ut64 addr, ut64 size, const char *str) {
157  return rz_meta_set(core->analysis, mtype, addr, size, str);
158 }
159 
160 static bool meta_set_flag(RzCore *core, RzAnalysisMetaType mtype, ut64 addr, ut64 size, const char *str) {
161  const char *flag = meta_get_flag(core, addr);
162  return rz_meta_set(core->analysis, mtype, addr, size, flag ? flag : str);
163 }
164 
165 static void meta_remove_all(RzCore *core, RzAnalysisMetaType mtype) {
166  rz_meta_del(core->analysis, mtype, 0, UT64_MAX);
167 }
168 
169 static void meta_remove(RzCore *core, RzAnalysisMetaType mtype, ut64 addr) {
170  rz_meta_del(core->analysis, mtype, addr, 1);
171 }
172 
174  rz_meta_del(core->analysis, mtype, addr, size);
175 }
176 
179  return RZ_CMD_STATUS_OK;
180 }
181 
184  return RZ_CMD_STATUS_OK;
185 }
186 
187 RZ_IPI RzCmdStatus rz_meta_remove_handler(RzCore *core, int argc, const char **argv) {
188  rz_meta_del(core->analysis, RZ_META_TYPE_ANY, core->offset, 1);
189  return RZ_CMD_STATUS_OK;
190 }
191 
192 RZ_IPI RzCmdStatus rz_meta_remove_all_handler(RzCore *core, int argc, const char **argv) {
194  return RZ_CMD_STATUS_OK;
195 }
196 
197 RZ_IPI RzCmdStatus rz_comment_handler(RzCore *core, int argc, const char **argv) {
199  return RZ_CMD_STATUS_OK;
200 }
201 
204  return RZ_CMD_STATUS_OK;
205 }
206 
207 RZ_IPI RzCmdStatus rz_comment_at_handler(RzCore *core, int argc, const char **argv) {
208  const char *comment = rz_meta_get_string(core->analysis, RZ_META_TYPE_COMMENT, core->offset);
209  if (comment) {
210  rz_cons_println(comment);
211  }
212  return RZ_CMD_STATUS_OK;
213 }
214 
215 RZ_IPI RzCmdStatus rz_comment_append_handler(RzCore *core, int argc, const char **argv) {
217  return RZ_CMD_STATUS_OK;
218 }
219 
220 RZ_IPI RzCmdStatus rz_comment_remove_handler(RzCore *core, int argc, const char **argv) {
222  return RZ_CMD_STATUS_OK;
223 }
224 
227  return RZ_CMD_STATUS_OK;
228 }
229 
230 RZ_IPI RzCmdStatus rz_comment_filelink_handler(RzCore *core, int argc, const char **argv) {
231  if (argc > 1) {
232  const char *comment = rz_meta_get_string(core->analysis, RZ_META_TYPE_COMMENT, core->offset);
233  if (RZ_STR_ISNOTEMPTY(comment)) {
234  // Append filename to the current comment
235  char *nc = rz_str_newf("%s ,(%s)", comment, argv[1]);
237  free(nc);
238  } else {
239  char *newcomment = rz_str_newf(",(%s)", argv[1]);
240  rz_meta_set_string(core->analysis, RZ_META_TYPE_COMMENT, core->offset, newcomment);
241  free(newcomment);
242  }
243  } else {
244  const char *comment = rz_meta_get_string(core->analysis, RZ_META_TYPE_COMMENT, core->offset);
245  if (RZ_STR_ISNOTEMPTY(comment)) {
246  char *cmtfile = rz_str_between(comment, ",(", ")");
247  if (cmtfile && *cmtfile) {
248  char *cwd = getcommapath(core);
249  rz_cons_printf("%s" RZ_SYS_DIR "%s\n", cwd, cmtfile);
250  free(cwd);
251  }
252  free(cmtfile);
253  }
254  }
255  return RZ_CMD_STATUS_OK;
256 }
257 
258 RZ_IPI RzCmdStatus rz_comment_editor_handler(RzCore *core, int argc, const char **argv) {
260  return RZ_CMD_STATUS_OK;
261 }
262 
265  return RZ_CMD_STATUS_OK;
266 }
267 
269  RzAnalysisBlock *bb;
270  RzListIter *iter;
271  rz_list_foreach (fcn->bbs, iter, bb) {
272  int i;
273  for (i = 0; i < bb->size; i++) {
274  ut64 addr = bb->addr + i;
275  rz_meta_del(analysis, RZ_META_TYPE_COMMENT, addr, 1);
276  }
277  }
278 }
279 
282  if (!fcn) {
283  RZ_LOG_ERROR("Cannot find the function at the 0x%08" PFMT64x " offset", core->offset);
284  return RZ_CMD_STATUS_ERROR;
285  }
287  return RZ_CMD_STATUS_OK;
288 }
289 
291  RzListIter *it;
292  RzAnalysisFunction *fcn;
293  rz_list_foreach (core->analysis->fcns, it, fcn) {
295  }
296  return RZ_CMD_STATUS_OK;
297 }
298 
299 RZ_IPI RzCmdStatus rz_comment_unique_handler(RzCore *core, int argc, const char **argv) {
300  char *comment = NULL;
301  if (!strncmp(argv[1], "base64:", 7)) {
302  char *s = (char *)sdb_decode(argv[1] + 7, NULL);
303  if (s) {
304  comment = s;
305  }
306  } else {
307  comment = strdup(argv[1]);
308  }
309  if (comment) {
310  rz_core_meta_comment_add(core, comment, core->offset);
311  free(comment);
312  }
313  return RZ_CMD_STATUS_OK;
314 }
315 
316 RZ_IPI RzCmdStatus rz_meta_space_handler(RzCore *core, int argc, const char **argv) {
317  RzSpaces *ms = &core->analysis->meta_spaces;
318  rz_spaces_add(ms, argv[1]);
319  return RZ_CMD_STATUS_OK;
320 }
321 
323  RzSpaces *ms = &core->analysis->meta_spaces;
324  rz_core_spaces_print(core, ms, state);
325  return RZ_CMD_STATUS_OK;
326 }
327 
329  RzSpaces *ms = &core->analysis->meta_spaces;
330  rz_spaces_rename(ms, argv[1], argv[2]);
331  return RZ_CMD_STATUS_OK;
332 }
333 
335  RzSpaces *ms = &core->analysis->meta_spaces;
336  rz_spaces_unset(ms, argv[1]);
337  return RZ_CMD_STATUS_OK;
338 }
339 
341  RzSpaces *ms = &core->analysis->meta_spaces;
342  rz_spaces_unset(ms, NULL);
343  return RZ_CMD_STATUS_OK;
344 }
345 
347  return meta_variable_comment_append(core, argv[1], argv[2]);
348 }
349 
351  return meta_variable_comment_remove(core, argv[1]);
352 }
353 
355  return meta_variable_comment_editor(core, argv[1]);
356 }
357 
360 }
361 
364 }
365 
368 }
369 
372 }
373 
375  const char *comment = rz_meta_get_string(core->analysis, RZ_META_TYPE_VARTYPE, core->offset);
376  if (comment) {
377  rz_cons_println(comment);
378  }
379  return RZ_CMD_STATUS_OK;
380 }
381 
382 RZ_IPI RzCmdStatus rz_meta_data_handler(RzCore *core, int argc, const char **argv) {
383  ut64 i, addr = core->offset;
384  ut64 size = rz_num_math(core->num, argv[1]);
385  ut64 repeat = argc > 2 ? rz_num_math(core->num, argv[2]) : 1;
386  if (size == 0 || repeat == 0) {
387  RZ_LOG_ERROR("Data size or repeat count cannot be zero\n");
388  return RZ_CMD_STATUS_ERROR;
389  }
390  for (i = 0; i < repeat; i++, addr += size) {
392  }
393  return RZ_CMD_STATUS_OK;
394 }
395 
398  return RZ_CMD_STATUS_OK;
399 }
400 
401 RZ_IPI RzCmdStatus rz_meta_data_at_handler(RzCore *core, int argc, const char **argv) {
402  ut64 size = 0;
404  if (mi) {
405  rz_cons_printf("%" PFMT64u "\n", size);
406  }
407  return RZ_CMD_STATUS_OK;
408 }
409 
410 RZ_IPI RzCmdStatus rz_meta_data_remove_handler(RzCore *core, int argc, const char **argv) {
411  if (argc > 1) {
412  ut64 i, addr = core->offset;
413  ut64 size = rz_num_math(core->num, argv[1]);
414  ut64 repeat = argc > 2 ? rz_num_math(core->num, argv[2]) : 1;
415  if (size == 0 || repeat == 0) {
416  RZ_LOG_ERROR("Data size or repeat count cannot be zero\n");
417  return RZ_CMD_STATUS_ERROR;
418  }
419  for (i = 0; i < repeat; i++, addr += size) {
421  }
422  } else {
423  meta_remove(core, RZ_META_TYPE_DATA, core->offset);
424  }
425  return RZ_CMD_STATUS_OK;
426 }
427 
430  return RZ_CMD_STATUS_OK;
431 }
432 
433 RZ_IPI RzCmdStatus rz_meta_string_handler(RzCore *core, int argc, const char **argv) {
434  ut64 size = argc > 1 ? rz_num_math(core->num, argv[1]) : 0;
436  return RZ_CMD_STATUS_ERROR;
437  }
438  return RZ_CMD_STATUS_OK;
439 }
440 
443  return RZ_CMD_STATUS_OK;
444 }
445 
447  ut64 size = 0;
449  if (!mi) {
450  return RZ_CMD_STATUS_OK;
451  }
452  rz_core_meta_print(core, mi, core->offset, size, false, state);
453  return RZ_CMD_STATUS_OK;
454 }
455 
458  return RZ_CMD_STATUS_ERROR;
459  }
460  return RZ_CMD_STATUS_OK;
461 }
462 
463 RZ_IPI RzCmdStatus rz_meta_string_utf8_handler(RzCore *core, int argc, const char **argv) {
464  ut64 size = argc > 1 ? rz_num_math(core->num, argv[1]) : 0;
466  return RZ_CMD_STATUS_ERROR;
467  }
468  return RZ_CMD_STATUS_OK;
469 }
470 
471 RZ_IPI RzCmdStatus rz_meta_string_8bit_handler(RzCore *core, int argc, const char **argv) {
472  ut64 size = argc > 1 ? rz_num_math(core->num, argv[1]) : 0;
474  return RZ_CMD_STATUS_ERROR;
475  }
476  return RZ_CMD_STATUS_OK;
477 }
478 
480  ut64 size = argc > 1 ? rz_num_math(core->num, argv[1]) : 0;
481  bool big_endian = rz_config_get_b(core->config, "cfg.bigendian");
483  if (!rz_core_meta_string_add(core, core->offset, size, enc, NULL)) {
484  return RZ_CMD_STATUS_ERROR;
485  }
486  return RZ_CMD_STATUS_OK;
487 }
488 
490  ut64 size = argc > 1 ? rz_num_math(core->num, argv[1]) : 0;
491  bool big_endian = rz_config_get_b(core->config, "cfg.bigendian");
493  if (!rz_core_meta_string_add(core, core->offset, size, enc, NULL)) {
494  return RZ_CMD_STATUS_ERROR;
495  }
496  return RZ_CMD_STATUS_OK;
497 }
498 
500  meta_remove(core, RZ_META_TYPE_STRING, core->offset);
501  return RZ_CMD_STATUS_OK;
502 }
503 
506  return RZ_CMD_STATUS_OK;
507 }
508 
509 RZ_IPI RzCmdStatus rz_meta_format_handler(RzCore *core, int argc, const char **argv) {
510  ut64 size = rz_num_math(core->num, argv[1]);
511  return bool2status(meta_set_string(core, RZ_META_TYPE_FORMAT, core->offset, size, argv[2]));
512 }
513 
516  return RZ_CMD_STATUS_OK;
517 }
518 
520  meta_remove(core, RZ_META_TYPE_FORMAT, core->offset);
521  return RZ_CMD_STATUS_OK;
522 }
523 
526  return RZ_CMD_STATUS_OK;
527 }
528 
529 RZ_IPI RzCmdStatus rz_meta_magic_handler(RzCore *core, int argc, const char **argv) {
530  ut64 size = rz_num_math(core->num, argv[1]);
531  return bool2status(meta_set_string(core, RZ_META_TYPE_MAGIC, core->offset, size, argv[2]));
532 }
533 
536  return RZ_CMD_STATUS_OK;
537 }
538 
540  meta_remove(core, RZ_META_TYPE_MAGIC, core->offset);
541  return RZ_CMD_STATUS_OK;
542 }
543 
546  return RZ_CMD_STATUS_OK;
547 }
548 
549 RZ_IPI RzCmdStatus rz_meta_hidden_handler(RzCore *core, int argc, const char **argv) {
550  ut64 size = rz_num_math(core->num, argv[1]);
551  return bool2status(meta_set_flag(core, RZ_META_TYPE_HIDE, core->offset, size, argv[1]));
552 }
553 
556  return RZ_CMD_STATUS_OK;
557 }
558 
560  meta_remove(core, RZ_META_TYPE_HIDE, core->offset);
561  return RZ_CMD_STATUS_OK;
562 }
563 
566  return RZ_CMD_STATUS_OK;
567 }
568 
569 RZ_IPI RzCmdStatus rz_meta_type_handler(RzCore *core, int argc, const char **argv) {
570  meta_set_flag(core, RZ_META_TYPE_VARTYPE, core->offset, 1, argv[1]);
571  return RZ_CMD_STATUS_OK;
572 }
573 
576  return RZ_CMD_STATUS_OK;
577 }
578 
579 RZ_IPI RzCmdStatus rz_meta_type_remove_handler(RzCore *core, int argc, const char **argv) {
581  return RZ_CMD_STATUS_OK;
582 }
583 
586  return RZ_CMD_STATUS_OK;
587 }
588 
589 RZ_IPI RzCmdStatus rz_meta_type_editor_handler(RzCore *core, int argc, const char **argv) {
591  return RZ_CMD_STATUS_OK;
592 }
#define RZ_IPI
Definition: analysis_wasm.c:11
lzma_index ** i
Definition: index.h:629
RZ_API ut8 * sdb_decode(const char *in, int *len)
Definition: base64.c:37
RZ_API char * sdb_encode(const ut8 *bin, int len)
Definition: base64.c:18
RZ_IPI RzCmdStatus rz_meta_hidden_list_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
Definition: cmd_meta.c:554
static void meta_remove_all(RzCore *core, RzAnalysisMetaType mtype)
Definition: cmd_meta.c:165
RZ_IPI RzCmdStatus rz_comment_function_list_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
Definition: cmd_meta.c:263
RZ_IPI RzCmdStatus rz_meta_data_remove_all_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_meta.c:428
RZ_IPI RzCmdStatus rz_meta_data_remove_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_meta.c:410
RZ_IPI RzCmdStatus rz_comment_append_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_meta.c:215
RZ_IPI RzCmdStatus rz_meta_space_remove_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_meta.c:334
RZ_IPI RzCmdStatus rz_meta_data_at_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_meta.c:401
RZ_IPI RzCmdStatus rz_meta_type_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_meta.c:569
RZ_IPI RzCmdStatus rz_comment_at_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_meta.c:207
RZ_IPI RzCmdStatus rz_meta_type_list_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
Definition: cmd_meta.c:574
RZ_IPI RzCmdStatus rz_meta_var_comment_remove_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_meta.c:350
RZ_IPI RzCmdStatus rz_comment_list_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
Definition: cmd_meta.c:202
RZ_IPI RzCmdStatus rz_comment_unique_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_meta.c:299
RZ_IPI RzCmdStatus rz_comment_remove_all_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_meta.c:225
RZ_IPI RzCmdStatus rz_meta_var_comment_editor_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_meta.c:354
RZ_IPI RzCmdStatus rz_meta_var_comment_list_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
Definition: cmd_meta.c:358
RZ_IPI RzCmdStatus rz_meta_hidden_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_meta.c:549
RZ_IPI RzCmdStatus rz_meta_remove_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_meta.c:187
static bool meta_set_string(RzCore *core, RzAnalysisMetaType mtype, ut64 addr, ut64 size, const char *str)
Definition: cmd_meta.c:156
RZ_IPI RzCmdStatus rz_comment_filelink_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_meta.c:230
RZ_IPI RzCmdStatus rz_meta_string_wide16_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_meta.c:479
RZ_IPI RzCmdStatus rz_meta_format_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_meta.c:509
RZ_IPI RzCmdStatus rz_meta_list_at_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
Definition: cmd_meta.c:182
RZ_IPI RzCmdStatus rz_meta_space_remove_all_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_meta.c:340
RZ_IPI RzCmdStatus rz_meta_string_8bit_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_meta.c:471
RZ_IPI RzCmdStatus rz_meta_var_bp_comment_list_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
Definition: cmd_meta.c:366
RZ_IPI RzCmdStatus rz_comment_function_remove_all_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_meta.c:290
RZ_IPI RzCmdStatus rz_meta_string_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_meta.c:433
RZ_IPI RzCmdStatus rz_comment_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_meta.c:197
RZ_IPI RzCmdStatus rz_meta_type_editor_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_meta.c:589
static RzCmdStatus meta_variable_comment_remove(RzCore *core, const char *name)
Definition: cmd_meta.c:121
RZ_IPI RzCmdStatus rz_meta_type_remove_all_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_meta.c:584
RZ_IPI RzCmdStatus rz_meta_string_list_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
Definition: cmd_meta.c:441
RZ_IPI RzCmdStatus rz_meta_type_current_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_meta.c:374
RZ_IPI RzCmdStatus rz_comment_editor_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_meta.c:258
RZ_IPI RzCmdStatus rz_meta_magic_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_meta.c:529
RZ_IPI RzCmdStatus rz_meta_string_pascal_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_meta.c:456
RZ_IPI RzCmdStatus rz_meta_magic_remove_all_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_meta.c:544
RZ_IPI RzCmdStatus rz_meta_hidden_remove_all_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_meta.c:564
static void meta_remove(RzCore *core, RzAnalysisMetaType mtype, ut64 addr)
Definition: cmd_meta.c:169
RZ_IPI RzCmdStatus rz_meta_var_stack_comment_list_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
Definition: cmd_meta.c:370
static void meta_remove_size(RzCore *core, RzAnalysisMetaType mtype, ut64 addr, ut64 size)
Definition: cmd_meta.c:173
RZ_IPI RzCmdStatus rz_meta_string_remove_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_meta.c:499
RZ_IPI RzCmdStatus rz_meta_string_at_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
Definition: cmd_meta.c:446
static bool meta_set_flag(RzCore *core, RzAnalysisMetaType mtype, ut64 addr, ut64 size, const char *str)
Definition: cmd_meta.c:160
RZ_IPI RzCmdStatus rz_meta_format_remove_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_meta.c:519
RZ_IPI RzCmdStatus rz_meta_string_wide32_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_meta.c:489
RZ_IPI RzCmdStatus rz_meta_data_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_meta.c:382
RZ_IPI RzCmdStatus rz_meta_magic_list_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
Definition: cmd_meta.c:534
RZ_IPI RzCmdStatus rz_meta_magic_remove_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_meta.c:539
RZ_IPI RzCmdStatus rz_meta_string_utf8_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_meta.c:463
RZ_IPI RzCmdStatus rz_meta_space_rename_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_meta.c:328
static RzCmdStatus meta_variable_comment_append(RzCore *core, const char *name, const char *comment)
Definition: cmd_meta.c:88
RZ_IPI RzCmdStatus rz_meta_space_list_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
Definition: cmd_meta.c:322
RZ_IPI RzCmdStatus rz_comment_remove_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_meta.c:220
RZ_IPI RzCmdStatus rz_meta_var_comment_append_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_meta.c:346
RZ_IPI RzCmdStatus rz_meta_format_list_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
Definition: cmd_meta.c:514
char * getcommapath(RzCore *core)
Definition: visual.c:1607
RZ_IPI RzCmdStatus rz_meta_data_list_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
Definition: cmd_meta.c:396
RZ_IPI RzCmdStatus rz_meta_format_remove_all_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_meta.c:524
RZ_IPI RzCmdStatus rz_meta_var_reg_comment_list_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
Definition: cmd_meta.c:362
static RzCmdStatus meta_variable_comment_list_all(RzCore *core, RzCmdStateOutput *state)
Definition: cmd_meta.c:74
static void meta_function_comment_remove(RzAnalysis *analysis, RzAnalysisFunction *fcn)
Definition: cmd_meta.c:268
static const char * meta_get_flag(RzCore *core, ut64 addr)
Definition: cmd_meta.c:24
static RzCmdStatus meta_variable_comment_editor(RzCore *core, const char *name)
Definition: cmd_meta.c:137
RZ_IPI RzCmdStatus rz_meta_hidden_remove_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_meta.c:559
RZ_IPI RzCmdStatus rz_meta_remove_all_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_meta.c:192
RZ_IPI RzCmdStatus rz_meta_type_remove_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_meta.c:579
static void meta_variable_comment_print(RzCore *Core, RzAnalysisVar *var, RzCmdStateOutput *state)
Definition: cmd_meta.c:30
RZ_IPI RzCmdStatus rz_meta_space_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_meta.c:316
RZ_IPI RzCmdStatus rz_comment_function_remove_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_meta.c:280
RZ_IPI RzCmdStatus rz_meta_list_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
Definition: cmd_meta.c:177
RZ_IPI RzCmdStatus rz_meta_string_remove_all_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_meta.c:504
static RzCmdStatus meta_variable_comment_list(RzCore *core, RzAnalysisVarKind kind, RzCmdStateOutput *state)
Definition: cmd_meta.c:57
RZ_IPI void rz_core_meta_comment_add(RzCore *core, const char *comment, ut64 addr)
Definition: cmd_meta.c:17
RZ_IPI void rz_core_meta_print_list_at(RzCore *core, ut64 addr, RzCmdStateOutput *state)
Definition: cmeta.c:326
RZ_IPI void rz_core_meta_editor(RzCore *core, RzAnalysisMetaType mtype, ut64 addr)
Definition: cmeta.c:394
RZ_IPI void rz_core_meta_append(RzCore *core, const char *newcomment, RzAnalysisMetaType mtype, ut64 addr)
Definition: cmeta.c:376
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
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
RZ_API void rz_cons_println(const char *str)
Definition: cons.c:233
static RzCmdStatus bool2status(bool val)
Definition: core_private.h:208
#define NULL
Definition: cris-opc.c:27
RZ_DEPRECATE RZ_API RzAnalysisFunction * rz_analysis_get_fcn_in(RzAnalysis *analysis, ut64 addr, int type)
Definition: fcn.c:1687
RZ_API RzFlagItem * rz_flag_get_i(RzFlag *f, ut64 off)
Definition: flag.c:317
RZ_API void Ht_() free(HtName_(Ht) *ht)
Definition: ht_inc.c:130
voidpf void uLong size
Definition: ioapi.h:138
uint8_t ut8
Definition: lh5801.h:11
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
static static fork const void static count static fd const char const char static newpath char char argv
Definition: sflib.h:40
return strdup("=SP r13\n" "=LR r14\n" "=PC r15\n" "=A0 r0\n" "=A1 r1\n" "=A2 r2\n" "=A3 r3\n" "=ZF zf\n" "=SF nf\n" "=OF vf\n" "=CF cf\n" "=SN or0\n" "gpr lr .32 56 0\n" "gpr pc .32 60 0\n" "gpr cpsr .32 64 0 ____tfiae_________________qvczn\n" "gpr or0 .32 68 0\n" "gpr tf .1 64.5 0 thumb\n" "gpr ef .1 64.9 0 endian\n" "gpr jf .1 64.24 0 java\n" "gpr qf .1 64.27 0 sticky_overflow\n" "gpr vf .1 64.28 0 overflow\n" "gpr cf .1 64.29 0 carry\n" "gpr zf .1 64.30 0 zero\n" "gpr nf .1 64.31 0 negative\n" "gpr itc .4 64.10 0 if_then_count\n" "gpr gef .4 64.16 0 great_or_equal\n" "gpr r0 .32 0 0\n" "gpr r1 .32 4 0\n" "gpr r2 .32 8 0\n" "gpr r3 .32 12 0\n" "gpr r4 .32 16 0\n" "gpr r5 .32 20 0\n" "gpr r6 .32 24 0\n" "gpr r7 .32 28 0\n" "gpr r8 .32 32 0\n" "gpr r9 .32 36 0\n" "gpr r10 .32 40 0\n" "gpr r11 .32 44 0\n" "gpr r12 .32 48 0\n" "gpr r13 .32 52 0\n" "gpr r14 .32 56 0\n" "gpr r15 .32 60 0\n" "gpr r16 .32 64 0\n" "gpr r17 .32 68 0\n")
RZ_API const char * rz_meta_get_string(RzAnalysis *a, RzAnalysisMetaType type, ut64 addr)
Definition: meta.c:146
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
RZ_API bool rz_meta_set(RzAnalysis *a, RzAnalysisMetaType type, ut64 addr, ut64 size, const char *str)
Definition: meta.c:191
RZ_API RzAnalysisMetaItem * rz_meta_get_at(RzAnalysis *a, ut64 addr, RzAnalysisMetaType type, RZ_OUT RZ_NULLABLE ut64 *size)
Definition: meta.c:207
static void repeat(struct parse *, sopno, int, int)
Definition: regcomp.c:1155
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_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
RzAnalysisVarKind
Definition: rz_analysis.h:702
@ RZ_ANALYSIS_VAR_KIND_REG
Definition: rz_analysis.h:703
@ RZ_ANALYSIS_VAR_KIND_SPV
Definition: rz_analysis.h:705
@ RZ_ANALYSIS_VAR_KIND_BPV
Definition: rz_analysis.h:704
#define rz_warn_if_reached()
Definition: rz_assert.h:29
enum rz_cmd_status_t RzCmdStatus
@ RZ_CMD_STATUS_OK
command handler exited in the right way
Definition: rz_cmd.h:24
@ RZ_CMD_STATUS_ERROR
command handler had issues while running (e.g. allocation error, etc.)
Definition: rz_cmd.h:26
#define RZ_LOG_ERROR(fmtstr,...)
Definition: rz_log.h:58
RZ_API ut64 rz_num_math(RzNum *num, const char *str)
Definition: unum.c:456
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_ks(PJ *j, const char *k, const char *v)
Definition: pj.c:170
RZ_API RzSpace * rz_spaces_add(RzSpaces *sp, const char *name)
Definition: spaces.c:96
RZ_API bool rz_spaces_rename(RzSpaces *sp, const char *oname, const char *nname)
Definition: spaces.c:196
RZ_API bool rz_spaces_unset(RzSpaces *sp, const char *name)
Definition: spaces.c:141
#define RZ_STR_ISNOTEMPTY(x)
Definition: rz_str.h:68
RZ_API char * rz_str_between(const char *str, const char *prefix, const char *suffix)
Definition: str.c:3264
RZ_API char * rz_str_newf(const char *fmt,...) RZ_PRINTF_CHECK(1
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_UTF32BE
Definition: rz_str.h:26
@ RZ_STRING_ENC_UTF8
Definition: rz_str.h:21
@ RZ_STRING_ENC_GUESS
Definition: rz_str.h:33
@ RZ_STRING_ENC_UTF16LE
Definition: rz_str.h:23
@ RZ_STRING_ENC_UTF16BE
Definition: rz_str.h:25
#define RZ_SYS_DIR
Definition: rz_types.h:218
#define PFMT64u
Definition: rz_types.h:395
@ RZ_OUTPUT_MODE_JSON
Definition: rz_types.h:40
@ RZ_OUTPUT_MODE_RIZIN
Definition: rz_types.h:41
@ RZ_OUTPUT_MODE_STANDARD
Definition: rz_types.h:39
#define PFMT64x
Definition: rz_types.h:393
#define UT64_MAX
Definition: rz_types_base.h:86
#define rz_pvector_foreach(vec, it)
Definition: rz_vector.h:334
Definition: z80asm.h:102
Definition: rz_pj.h:12
RzList * fcns
Definition: rz_analysis.h:565
RzSpaces meta_spaces
Definition: rz_analysis.h:601
RzAnalysisVarKind kind
Definition: rz_analysis.h:728
RzAnalysisFunction * fcn
Definition: rz_analysis.h:726
Represent the output state of a command handler.
Definition: rz_cmd.h:91
ut64 offset
Definition: rz_core.h:301
RzAnalysis * analysis
Definition: rz_core.h:322
RzNum * num
Definition: rz_core.h:316
RzFlag * flags
Definition: rz_core.h:330
RzConfig * config
Definition: rz_core.h:300
char * name
Definition: rz_flag.h:35
Definition: dis.h:43
RZ_API RZ_BORROW RzAnalysisVar * rz_analysis_function_get_var_byname(RzAnalysisFunction *fcn, const char *name)
Definition: var.c:247
ut64(WINAPI *w32_GetEnabledXStateFeatures)()
static int addr
Definition: z80asm.c:58