Rizin
unix-like reverse engineering framework and cli tools
cmd_type.c
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: 2009-2020 pancake <pancake@nopcode.org>
2 // SPDX-FileCopyrightText: 2009-2020 oddcoder <ahmedsoliman@oddcoder.com>
3 // SPDX-FileCopyrightText: 2009-2020 Anton Kochkov <anton.kochkov@gmail.com>
4 // SPDX-FileCopyrightText: 2009-2020 Jody Frankowski <jody.frankowski@gmail.com>
5 // SPDX-License-Identifier: LGPL-3.0-only
6 
7 #include <string.h>
8 #include <rz_analysis.h>
9 #include <rz_cons.h>
10 #include <rz_core.h>
11 #include <sdb.h>
12 #include "../core_private.h"
13 
14 // Calling conventions
15 
16 static void types_cc_print(RzCore *core, const char *cc, RzOutputMode mode) {
18  if (strchr(cc, '(')) {
19  if (!rz_analysis_cc_set(core->analysis, cc)) {
20  RZ_LOG_ERROR("Invalid syntax in cc signature.");
21  }
22  } else {
23  const char *ccname = rz_str_trim_head_ro(cc);
24  char *result = rz_analysis_cc_get(core->analysis, ccname);
25  if (result) {
26  if (mode == RZ_OUTPUT_MODE_JSON) {
27  PJ *pj = pj_new();
28  pj_a(pj);
29  pj_ks(pj, "cc", result);
30  pj_end(pj);
32  pj_free(pj);
33  } else {
34  rz_cons_printf("%s\n", result);
35  }
36  free(result);
37  }
38  }
39 }
40 
41 // Enums
42 
43 static RzCmdStatus types_enum_member_find(RzCore *core, const char *enum_name, const char *enum_value) {
44  rz_return_val_if_fail(enum_name || enum_value, RZ_CMD_STATUS_ERROR);
45  ut64 value = rz_num_math(core->num, enum_value);
46  const char *enum_member = rz_type_db_enum_member_by_val(core->analysis->typedb, enum_name, value);
47  if (!enum_member) {
48  RZ_LOG_ERROR("Cannot find matching enum member");
49  return RZ_CMD_STATUS_ERROR;
50  }
51  rz_cons_println(enum_member);
52  return RZ_CMD_STATUS_OK;
53 }
54 
55 static RzCmdStatus types_enum_member_find_all(RzCore *core, const char *enum_value) {
57  ut64 value = rz_num_math(core->num, enum_value);
59  if (!matches || rz_list_empty(matches)) {
60  RZ_LOG_ERROR("Cannot find matching enum member");
61  return RZ_CMD_STATUS_ERROR;
62  }
64  char *match;
65  rz_list_foreach (matches, iter, match) {
67  }
68  rz_list_free(matches);
69  return RZ_CMD_STATUS_OK;
70 }
71 
72 static void type_list_c_all(RzCore *core) {
73  char *str = rz_core_types_as_c_all(core, true);
74  if (str) {
75  rz_cons_print(str);
76  free(str);
77  }
78 }
79 
80 static void type_list_c_all_nl(RzCore *core) {
81  char *str = rz_core_types_as_c_all(core, false);
82  if (str) {
83  rz_cons_print(str);
84  free(str);
85  }
86 }
87 
88 static RzCmdStatus type_format_print(RzCore *core, const char *type, ut64 address) {
89  char *fmt = rz_type_format(core->analysis->typedb, type);
90  if (RZ_STR_ISEMPTY(fmt)) {
91  RZ_LOG_ERROR("Cannot find type %s\n", type);
92  free(fmt);
93  return RZ_CMD_STATUS_ERROR;
94  }
95  rz_core_cmdf(core, "pf %s @ 0x%08" PFMT64x "\n", fmt, address);
96  free(fmt);
97  return RZ_CMD_STATUS_OK;
98 }
99 
100 static RzCmdStatus type_format_print_variable(RzCore *core, const char *type, const char *varname) {
101  char *fmt = rz_type_format(core->analysis->typedb, type);
102  if (RZ_STR_ISEMPTY(fmt)) {
103  RZ_LOG_ERROR("Cannot find type \"%s\"\n", type);
104  free(fmt);
105  return RZ_CMD_STATUS_ERROR;
106  }
107  RzAnalysisFunction *fcn = rz_analysis_get_fcn_in(core->analysis, core->offset, -1);
108  if (!fcn) {
109  RZ_LOG_ERROR("Cannot find function at the current offset\n");
110  free(fmt);
111  return RZ_CMD_STATUS_ERROR;
112  }
114  if (!var) {
115  RZ_LOG_ERROR("Cannot find variable \"%s\" in the current function\n", varname);
116  free(fmt);
117  return RZ_CMD_STATUS_ERROR;
118  }
120  rz_core_cmdf(core, "pf %s @ 0x%08" PFMT64x "\n", fmt, addr);
121  free(fmt);
122  return RZ_CMD_STATUS_OK;
123 }
124 
125 static RzCmdStatus type_format_print_value(RzCore *core, const char *type, ut64 val) {
126  char *fmt = rz_type_format(core->analysis->typedb, type);
127  if (RZ_STR_ISEMPTY(fmt)) {
128  RZ_LOG_ERROR("Cannot find type %s\n", type);
129  free(fmt);
130  return RZ_CMD_STATUS_ERROR;
131  }
132  rz_core_cmdf(core, "pf %s @v:0x%08" PFMT64x "\n", fmt, val);
133  free(fmt);
134  return RZ_CMD_STATUS_OK;
135 }
136 
137 static RzCmdStatus type_format_print_hexstring(RzCore *core, const char *type, const char *hexpairs) {
138  char *fmt = rz_type_format(core->analysis->typedb, type);
139  if (RZ_STR_ISEMPTY(fmt)) {
140  RZ_LOG_ERROR("Cannot find type %s\n", type);
141  free(fmt);
142  return RZ_CMD_STATUS_ERROR;
143  }
144  rz_core_cmdf(core, "pf %s @x:%s", fmt, hexpairs);
145  free(fmt);
146  return RZ_CMD_STATUS_OK;
147 }
148 
149 static void types_xrefs(RzCore *core, const char *typestr) {
150  char *error_msg = NULL;
151  RzType *type = rz_type_parse_string_single(core->analysis->typedb->parser, typestr, &error_msg);
152  if (!type || error_msg) {
153  if (error_msg) {
154  RZ_LOG_ERROR("%s", error_msg);
155  free(error_msg);
156  }
157  return;
158  }
159  RzType *type2;
160  RzListIter *iter, *iter2;
161  RzAnalysisFunction *fcn;
162  rz_list_foreach (core->analysis->fcns, iter, fcn) {
163  RzList *uniq = rz_analysis_types_from_fcn(core->analysis, fcn);
164  rz_list_foreach (uniq, iter2, type2) {
165  if (rz_types_equal(type2, type)) {
166  rz_cons_printf("%s\n", fcn->name);
167  break;
168  }
169  }
170  }
171 }
172 
173 static void types_xrefs_summary(RzCore *core) {
174  RzType *type;
175  RzListIter *iter, *iter2;
176  RzAnalysisFunction *fcn;
177  RzAnalysis *analysis = core->analysis;
178  rz_list_foreach (analysis->fcns, iter, fcn) {
179  RzList *uniq = rz_analysis_types_from_fcn(analysis, fcn);
180  if (rz_list_length(uniq)) {
181  rz_cons_printf("%s: ", fcn->name);
182  }
183  rz_list_foreach (uniq, iter2, type) {
184  char *str = rz_type_as_string(analysis->typedb, type);
185  if (str) {
186  rz_cons_printf("%s%s", str, iter2->n ? "," : "\n");
187  }
188  free(str);
189  }
190  }
191 }
192 
194  RzType *type;
195  RzListIter *iter;
196  RzAnalysis *analysis = core->analysis;
198  if (!fcn) {
199  RZ_LOG_ERROR("Cannot find function at 0x%08" PFMT64x "\n", addr);
200  return RZ_CMD_STATUS_ERROR;
201  }
202  RzList *uniq = rz_analysis_types_from_fcn(analysis, fcn);
203  rz_list_foreach (uniq, iter, type) {
204  char *str = rz_type_as_string(analysis->typedb, type);
206  free(str);
207  }
208  rz_list_free(uniq);
209  return RZ_CMD_STATUS_OK;
210 }
211 
212 static void types_xrefs_graph(RzCore *core) {
213  RzType *type;
214  RzListIter *iter, *iter2;
215  RzAnalysisFunction *fcn;
216  rz_list_foreach (core->analysis->fcns, iter, fcn) {
217  RzList *uniq = rz_analysis_types_from_fcn(core->analysis, fcn);
218  if (rz_list_length(uniq)) {
219  rz_cons_printf("agn %s\n", fcn->name);
220  }
221  rz_list_foreach (uniq, iter2, type) {
222  char *typestr = rz_type_as_string(core->analysis->typedb, type);
223  rz_str_replace_ch(typestr, ' ', '_', true);
224  rz_cons_printf("agn %s\n", typestr);
225  rz_cons_printf("age %s %s\n", typestr, fcn->name);
226  free(typestr);
227  }
228  }
229 }
230 
231 static void types_xrefs_all(RzCore *core) {
232  RzType *type;
233  RzListIter *iter, *iter2;
234  RzAnalysisFunction *fcn;
235  RzList *types_list = rz_list_newf(free);
236  rz_list_foreach (core->analysis->fcns, iter, fcn) {
238  rz_list_foreach (types, iter2, type) {
239  const char *ident = rz_type_identifier(type);
240  if (ident) {
241  rz_list_push(types_list, strdup(ident));
242  }
243  }
245  }
246  RzList *uniq_types = rz_list_uniq(types_list, (RzListComparator)strcmp);
247  rz_list_free(types_list);
248  rz_list_sort(uniq_types, (RzListComparator)strcmp);
249  char *typestr;
250  rz_list_foreach (uniq_types, iter, typestr) {
251  rz_cons_printf("%s\n", typestr);
252  }
253  rz_list_free(uniq_types);
254 }
255 
256 RZ_IPI RzCmdStatus rz_type_handler(RzCore *core, int argc, const char **argv, RzOutputMode mode) {
257  const char *type = argc > 1 ? argv[1] : NULL;
258  if (type) {
260  } else {
262  }
263  return RZ_CMD_STATUS_OK;
264 }
265 
266 RZ_IPI RzCmdStatus rz_type_del_handler(RzCore *core, int argc, const char **argv) {
267  rz_type_db_del(core->analysis->typedb, argv[1]);
268  return RZ_CMD_STATUS_OK;
269 }
270 
271 RZ_IPI RzCmdStatus rz_type_del_all_handler(RzCore *core, int argc, const char **argv) {
274  return RZ_CMD_STATUS_OK;
275 }
276 
278  const char *cc = argc > 1 ? argv[1] : NULL;
279  if (cc) {
280  types_cc_print(core, cc, mode);
281  } else {
283  }
284  return RZ_CMD_STATUS_OK;
285 }
286 
287 RZ_IPI RzCmdStatus rz_type_cc_del_handler(RzCore *core, int argc, const char **argv) {
288  const char *cc = argc > 1 ? argv[1] : NULL;
289  rz_analysis_cc_del(core->analysis, cc);
290  return RZ_CMD_STATUS_OK;
291 }
292 
293 RZ_IPI RzCmdStatus rz_type_cc_del_all_handler(RzCore *core, int argc, const char **argv) {
294  sdb_reset(core->analysis->sdb_cc);
295  return RZ_CMD_STATUS_OK;
296 }
297 
298 RZ_IPI RzCmdStatus rz_type_list_c_handler(RzCore *core, int argc, const char **argv) {
299  if (argc > 1) {
300  char *str = rz_core_types_as_c(core, argv[1], true);
301  if (!str) {
302  RZ_LOG_ERROR("Type \"%s\" not found\n", argv[1]);
303  return RZ_CMD_STATUS_ERROR;
304  }
305  rz_cons_print(str);
306  free(str);
307  } else {
308  type_list_c_all(core);
309  }
310  return RZ_CMD_STATUS_OK;
311 }
312 
313 RZ_IPI RzCmdStatus rz_type_list_c_nl_handler(RzCore *core, int argc, const char **argv) {
314  if (argc > 1) {
315  char *str = rz_core_types_as_c(core, argv[1], false);
316  if (!str) {
317  RZ_LOG_ERROR("Type \"%s\" not found\n", argv[1]);
318  return RZ_CMD_STATUS_ERROR;
319  }
320  rz_cons_print(str);
321  free(str);
322  } else {
323  type_list_c_all_nl(core);
324  }
325  return RZ_CMD_STATUS_OK;
326 }
327 
328 RZ_IPI RzCmdStatus rz_type_define_handler(RzCore *core, int argc, const char **argv) {
329  const char *type = argc > 1 ? argv[1] : NULL;
330  rz_types_define(core, type);
331  return RZ_CMD_STATUS_OK;
332 }
333 
335  if (argc > 1) {
336  if (argc > 2) {
337  // TODO: Reconsider the `te <enum_name> <member_value>` syntax change
338  return types_enum_member_find(core, argv[1], argv[2]);
339  } else {
340  PJ *pj = (mode == RZ_OUTPUT_MODE_JSON) ? pj_new() : NULL;
341  RzBaseType *btype = rz_type_db_get_enum(core->analysis->typedb, argv[1]);
342  if (!btype) {
343  RZ_LOG_ERROR("Cannot find \"%s\" enum type\n", argv[1]);
344  pj_free(pj);
345  return RZ_CMD_STATUS_ERROR;
346  }
347  rz_core_types_enum_print(core, btype, mode, pj);
348  if (mode == RZ_OUTPUT_MODE_JSON) {
350  pj_free(pj);
351  }
352  }
353  } else {
354  // A special case, since by default `te` returns only the list of all enums
355  if (mode == RZ_OUTPUT_MODE_STANDARD) {
357  }
359  }
360  return RZ_CMD_STATUS_OK;
361 }
362 
364  const char *enum_name = argc > 1 ? argv[1] : NULL;
365  const char *enum_member = argc > 2 ? argv[2] : NULL;
366  int value = rz_type_db_enum_member_by_name(core->analysis->typedb, enum_name, enum_member);
367  if (value == -1) {
368  RZ_LOG_ERROR("Cannot find anything matching the specified bitfield");
369  return RZ_CMD_STATUS_ERROR;
370  }
371  rz_cons_printf("0x%x\n", value);
372  return RZ_CMD_STATUS_OK;
373 }
374 
375 RZ_IPI RzCmdStatus rz_type_enum_c_handler(RzCore *core, int argc, const char **argv) {
376  if (argc > 1) {
377  RzBaseType *btype = rz_type_db_get_enum(core->analysis->typedb, argv[1]);
378  if (!btype) {
379  RZ_LOG_ERROR("Cannot find \"%s\" enum type\n", argv[1]);
380  return RZ_CMD_STATUS_ERROR;
381  }
382  char *str = rz_core_types_enum_as_c(core->analysis->typedb, btype, true);
383  if (!str) {
384  RZ_LOG_ERROR("Cannot get C representation of \"%s\" enum type\n", argv[1]);
385  return RZ_CMD_STATUS_ERROR;
386  }
387  rz_cons_print(str);
388  free(str);
389  } else {
390  char *str = rz_core_types_enum_as_c_all(core->analysis->typedb, true);
391  if (!str) {
392  return RZ_CMD_STATUS_ERROR;
393  }
394  rz_cons_print(str);
395  free(str);
396  }
397  return RZ_CMD_STATUS_OK;
398 }
399 
400 RZ_IPI RzCmdStatus rz_type_enum_c_nl_handler(RzCore *core, int argc, const char **argv) {
401  if (argc > 1) {
402  RzBaseType *btype = rz_type_db_get_enum(core->analysis->typedb, argv[1]);
403  if (!btype) {
404  RZ_LOG_ERROR("Cannot find \"%s\" enum type\n", argv[1]);
405  return RZ_CMD_STATUS_ERROR;
406  }
407  char *str = rz_core_types_enum_as_c(core->analysis->typedb, btype, false);
408  if (!str) {
409  RZ_LOG_ERROR("Cannot get C representation of \"%s\" enum type\n", argv[1]);
410  return RZ_CMD_STATUS_ERROR;
411  }
412  rz_cons_print(str);
413  free(str);
414  } else {
415  char *str = rz_core_types_enum_as_c_all(core->analysis->typedb, false);
416  if (!str) {
417  return RZ_CMD_STATUS_ERROR;
418  }
419  rz_cons_print(str);
420  free(str);
421  }
422  return RZ_CMD_STATUS_OK;
423 }
424 
425 RZ_IPI RzCmdStatus rz_type_enum_find_handler(RzCore *core, int argc, const char **argv) {
426  const char *enum_value = argc > 1 ? argv[1] : NULL;
427  return types_enum_member_find_all(core, enum_value);
428 }
429 
431  const char *function = argc > 1 ? argv[1] : NULL;
432  if (function) {
433  PJ *pj = (mode == RZ_OUTPUT_MODE_JSON) ? pj_new() : NULL;
434  rz_core_types_function_print(core->analysis->typedb, function, mode, pj);
435  if (mode == RZ_OUTPUT_MODE_JSON) {
437  pj_free(pj);
438  }
439  } else {
441  }
442  return RZ_CMD_STATUS_OK;
443 }
444 
447  return RZ_CMD_STATUS_OK;
448 }
449 
452  return RZ_CMD_STATUS_OK;
453 }
454 
455 RZ_IPI RzCmdStatus rz_type_function_cc_handler(RzCore *core, int argc, const char **argv) {
456  if (argc > 2) {
457  if (!rz_type_func_cc_set(core->analysis->typedb, argv[1], argv[2])) {
458  RZ_LOG_ERROR("Cannot set function \"%s\" calling convention \"%s\"\n", argv[1], argv[2]);
459  return RZ_CMD_STATUS_ERROR;
460  }
461  } else {
462  const char *cc = rz_type_func_cc(core->analysis->typedb, argv[1]);
463  if (!cc) {
464  RZ_LOG_ERROR("Cannot find function \"%s\" in types database\n", argv[1]);
465  return RZ_CMD_STATUS_ERROR;
466  }
467  rz_cons_println(cc);
468  }
469  return RZ_CMD_STATUS_OK;
470 }
471 
473  const char *name = argc > 1 ? argv[1] : NULL;
474  ut64 addr = argc > 2 ? rz_num_math(core->num, argv[2]) : core->offset;
475  if (name) {
476  rz_core_types_link(core, name, addr);
477  } else {
479  }
480  return RZ_CMD_STATUS_OK;
481 }
482 
483 RZ_IPI RzCmdStatus rz_type_link_show_handler(RzCore *core, int argc, const char **argv) {
484  ut64 addr = rz_num_math(core->num, argv[1]);
486  return RZ_CMD_STATUS_OK;
487 }
488 
489 RZ_IPI RzCmdStatus rz_type_link_del_handler(RzCore *core, int argc, const char **argv) {
490  ut64 addr = rz_num_math(core->num, argv[1]);
492  return RZ_CMD_STATUS_OK;
493 }
494 
497  return RZ_CMD_STATUS_OK;
498 }
499 
501  const char *name = argc > 1 ? argv[1] : NULL;
502  if (name) {
503  ut64 n = rz_num_math(core->num, name);
504  if (n) {
506  } else {
508  }
509  } else {
511  }
512  return RZ_CMD_STATUS_OK;
513 }
514 
516  for (int i = 1; i < argc; i++) {
518  }
519  return RZ_CMD_STATUS_OK;
520 }
521 
524  RzListIter *iter;
525  char *name;
526  rz_list_foreach (noretl, iter, name) {
528  }
529  return RZ_CMD_STATUS_OK;
530 }
531 
532 RZ_IPI RzCmdStatus rz_type_open_file_handler(RzCore *core, int argc, const char **argv) {
533  if (!rz_types_open_file(core, argv[1])) {
534  return RZ_CMD_STATUS_ERROR;
535  }
536  return RZ_CMD_STATUS_OK;
537 }
538 
539 RZ_IPI RzCmdStatus rz_type_open_editor_handler(RzCore *core, int argc, const char **argv) {
540  if (!rz_types_open_editor(core, argv[1])) {
541  return RZ_CMD_STATUS_ERROR;
542  }
543  return RZ_CMD_STATUS_OK;
544 }
545 
546 RZ_IPI RzCmdStatus rz_type_open_sdb_handler(RzCore *core, int argc, const char **argv) {
548  return RZ_CMD_STATUS_OK;
549 }
550 
551 RZ_IPI RzCmdStatus rz_type_print_handler(RzCore *core, int argc, const char **argv) {
552  const char *addr_or_var = argc > 2 ? argv[2] : NULL;
553  if (!addr_or_var) {
554  return type_format_print(core, argv[1], core->offset);
555  }
556  ut64 addr = rz_num_math(core->num, addr_or_var);
557  if (!addr) {
558  return type_format_print_variable(core, argv[1], addr_or_var);
559  }
560  return type_format_print(core, argv[1], addr);
561 }
562 
563 RZ_IPI RzCmdStatus rz_type_print_value_handler(RzCore *core, int argc, const char **argv) {
564  const char *value = argc > 2 ? argv[2] : NULL;
565  if (!value) {
566  return type_format_print_value(core, argv[1], core->offset);
567  }
568  return type_format_print_value(core, argv[1], rz_num_math(core->num, value));
569 }
570 
572  return type_format_print_hexstring(core, argv[1], argv[2]);
573 }
574 
576  if (argc > 1) {
577  if (mode == RZ_OUTPUT_MODE_STANDARD) {
579  } else {
580  PJ *pj = (mode == RZ_OUTPUT_MODE_JSON) ? pj_new() : NULL;
581  RzBaseType *btype = rz_type_db_get_struct(core->analysis->typedb, argv[1]);
582  if (!btype) {
583  RZ_LOG_ERROR("Cannot find \"%s\" struct type\n", argv[1]);
584  pj_free(pj);
585  return RZ_CMD_STATUS_ERROR;
586  }
587  rz_core_types_struct_print(core, btype, mode, pj);
588  if (mode == RZ_OUTPUT_MODE_JSON) {
590  pj_free(pj);
591  }
592  }
593  } else {
594  if (mode == RZ_OUTPUT_MODE_RIZIN) {
596  } else {
598  }
599  }
600  return RZ_CMD_STATUS_OK;
601 }
602 
603 RZ_IPI RzCmdStatus rz_type_structure_c_handler(RzCore *core, int argc, const char **argv) {
604  if (argc > 1) {
605  RzBaseType *btype = rz_type_db_get_struct(core->analysis->typedb, argv[1]);
606  if (!btype) {
607  RZ_LOG_ERROR("Cannot find \"%s\" struct type\n", argv[1]);
608  return RZ_CMD_STATUS_ERROR;
609  }
610  char *str = rz_core_types_struct_as_c(core->analysis->typedb, btype, true);
611  if (!str) {
612  RZ_LOG_ERROR("Cannot get C representation of \"%s\" struct type\n", argv[1]);
613  return RZ_CMD_STATUS_ERROR;
614  }
615  rz_cons_print(str);
616  free(str);
617  } else {
618  char *str = rz_core_types_struct_as_c_all(core->analysis->typedb, true);
619  if (!str) {
620  return RZ_CMD_STATUS_ERROR;
621  }
622  rz_cons_print(str);
623  free(str);
624  }
625  return RZ_CMD_STATUS_OK;
626 }
627 
629  if (argc > 1) {
630  RzBaseType *btype = rz_type_db_get_struct(core->analysis->typedb, argv[1]);
631  if (!btype) {
632  RZ_LOG_ERROR("Cannot find \"%s\" struct type\n", argv[1]);
633  return RZ_CMD_STATUS_ERROR;
634  }
635  char *str = rz_core_types_struct_as_c(core->analysis->typedb, btype, false);
636  if (!str) {
637  RZ_LOG_ERROR("Cannot get C representation of \"%s\" struct type\n", argv[1]);
638  return RZ_CMD_STATUS_ERROR;
639  }
640  rz_cons_print(str);
641  free(str);
642  } else {
643  char *str = rz_core_types_struct_as_c_all(core->analysis->typedb, false);
644  if (!str) {
645  return RZ_CMD_STATUS_ERROR;
646  }
647  rz_cons_print(str);
648  free(str);
649  }
650  return RZ_CMD_STATUS_OK;
651 }
652 
654  if (argc > 1) {
655  PJ *pj = (mode == RZ_OUTPUT_MODE_JSON) ? pj_new() : NULL;
657  if (!btype) {
658  RZ_LOG_ERROR("Cannot find \"%s\" typedef type\n", argv[1]);
659  pj_free(pj);
660  return RZ_CMD_STATUS_ERROR;
661  }
662  rz_core_types_typedef_print(core, btype, mode, pj);
663  if (mode == RZ_OUTPUT_MODE_JSON) {
665  pj_free(pj);
666  }
667  } else {
669  }
670  return RZ_CMD_STATUS_OK;
671 }
672 
673 RZ_IPI RzCmdStatus rz_type_typedef_c_handler(RzCore *core, int argc, const char **argv) {
674  RzTypeDB *typedb = core->analysis->typedb;
675  if (argc > 1) {
677  if (!btype) {
678  RZ_LOG_ERROR("Cannot find \"%s\" typedef type\n", argv[1]);
679  return RZ_CMD_STATUS_ERROR;
680  }
681  char *str = rz_core_types_typedef_as_c(typedb, btype);
682  if (!str) {
683  RZ_LOG_ERROR("Cannot get C representation of \"%s\" typedef type\n", argv[1]);
684  return RZ_CMD_STATUS_ERROR;
685  }
686  rz_cons_print(str);
687  free(str);
688  } else {
689  char *str = rz_core_types_typedef_as_c_all(typedb);
690  if (!str) {
691  return RZ_CMD_STATUS_ERROR;
692  }
693  rz_cons_print(str);
694  free(str);
695  }
696  return RZ_CMD_STATUS_OK;
697 }
698 
700  if (argc > 1) {
701  if (mode == RZ_OUTPUT_MODE_STANDARD) {
703  } else {
704  PJ *pj = (mode == RZ_OUTPUT_MODE_JSON) ? pj_new() : NULL;
705  RzBaseType *btype = rz_type_db_get_union(core->analysis->typedb, argv[1]);
706  if (!btype) {
707  RZ_LOG_ERROR("Cannot find \"%s\" union type\n", argv[1]);
708  pj_free(pj);
709  return RZ_CMD_STATUS_ERROR;
710  }
711  rz_core_types_union_print(core, btype, mode, pj);
712  if (mode == RZ_OUTPUT_MODE_JSON) {
714  pj_free(pj);
715  }
716  }
717  } else {
718  if (mode == RZ_OUTPUT_MODE_RIZIN) {
720  } else {
722  }
723  }
724  return RZ_CMD_STATUS_OK;
725 }
726 
727 RZ_IPI RzCmdStatus rz_type_union_c_handler(RzCore *core, int argc, const char **argv) {
728  if (argc > 1) {
729  RzBaseType *btype = rz_type_db_get_union(core->analysis->typedb, argv[1]);
730  if (!btype) {
731  RZ_LOG_ERROR("Cannot find \"%s\" union type\n", argv[1]);
732  return RZ_CMD_STATUS_ERROR;
733  }
734  char *str = rz_core_types_union_as_c(core->analysis->typedb, btype, true);
735  if (!str) {
736  RZ_LOG_ERROR("Cannot get C representation of \"%s\" union type\n", argv[1]);
737  return RZ_CMD_STATUS_ERROR;
738  }
739  rz_cons_print(str);
740  free(str);
741  } else {
742  char *str = rz_core_types_union_as_c_all(core->analysis->typedb, true);
743  if (!str) {
744  return RZ_CMD_STATUS_ERROR;
745  }
746  rz_cons_print(str);
747  free(str);
748  }
749  return RZ_CMD_STATUS_OK;
750 }
751 
752 RZ_IPI RzCmdStatus rz_type_union_c_nl_handler(RzCore *core, int argc, const char **argv) {
753  if (argc > 1) {
754  RzBaseType *btype = rz_type_db_get_union(core->analysis->typedb, argv[1]);
755  if (!btype) {
756  RZ_LOG_ERROR("Cannot find \"%s\" union type\n", argv[1]);
757  return RZ_CMD_STATUS_ERROR;
758  }
759  char *str = rz_core_types_union_as_c(core->analysis->typedb, btype, false);
760  if (!str) {
761  RZ_LOG_ERROR("Cannot get C representation of \"%s\" union type\n", argv[1]);
762  return RZ_CMD_STATUS_ERROR;
763  }
764  rz_cons_print(str);
765  free(str);
766  } else {
767  char *str = rz_core_types_union_as_c_all(core->analysis->typedb, false);
768  if (!str) {
769  return RZ_CMD_STATUS_ERROR;
770  }
771  rz_cons_print(str);
772  free(str);
773  }
774  return RZ_CMD_STATUS_OK;
775 }
776 
777 RZ_IPI RzCmdStatus rz_type_xrefs_list_handler(RzCore *core, int argc, const char **argv) {
778  const char *typename = argc > 1 ? argv[1] : NULL;
779  if (typename) {
780  types_xrefs(core, typename);
781  } else {
782  types_xrefs_summary(core);
783  }
784  return RZ_CMD_STATUS_OK;
785 }
786 
788  ut64 addr = argc > 1 ? rz_num_math(core->num, argv[1]) : core->offset;
789  return types_xrefs_function(core, addr);
790 }
791 
792 RZ_IPI RzCmdStatus rz_type_xrefs_graph_handler(RzCore *core, int argc, const char **argv) {
793  types_xrefs_graph(core);
794  return RZ_CMD_STATUS_OK;
795 }
796 
798  types_xrefs_all(core);
799  return RZ_CMD_STATUS_OK;
800 }
RZ_API RzAnalysisFunction * rz_analysis_get_function_at(RzAnalysis *analysis, ut64 addr)
Definition: function.c:184
RZ_API bool rz_analysis_noreturn_add(RzAnalysis *analysis, const char *name, ut64 addr)
Definition: analysis.c:466
#define RZ_IPI
Definition: analysis_wasm.c:11
lzma_index ** i
Definition: index.h:629
ut16 val
Definition: armass64_const.h:6
RZ_API RZ_OWN RzType * rz_type_parse_string_single(RzTypeParser *parser, const char *code, char **error_msg)
Parses the single C type definition.
Definition: c_cpp_parser.c:309
RZ_API void rz_type_parse_reset(RzTypeDB *typedb)
Reset the C parser state.
Definition: c_cpp_parser.c:297
RZ_API void rz_analysis_cc_del(RzAnalysis *analysis, const char *name)
Definition: cc.c:10
RZ_API char * rz_analysis_cc_get(RzAnalysis *analysis, const char *name)
Definition: cc.c:75
RZ_API bool rz_analysis_cc_set(RzAnalysis *analysis, const char *expr)
Definition: cc.c:25
RZ_API int rz_core_cmdf(RzCore *core, const char *fmt,...)
Definition: cmd.c:5413
static int value
Definition: cmd_api.c:93
RZ_IPI RzCmdStatus rz_type_link_del_all_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_type.c:495
static RzCmdStatus type_format_print_hexstring(RzCore *core, const char *type, const char *hexpairs)
Definition: cmd_type.c:137
RZ_IPI RzCmdStatus rz_type_function_del_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_type.c:445
static RzCmdStatus type_format_print(RzCore *core, const char *type, ut64 address)
Definition: cmd_type.c:88
RZ_IPI RzCmdStatus rz_type_noreturn_del_all_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_type.c:522
static void types_xrefs_all(RzCore *core)
Definition: cmd_type.c:231
RZ_IPI RzCmdStatus rz_type_union_c_nl_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_type.c:752
RZ_IPI RzCmdStatus rz_type_structure_c_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_type.c:603
RZ_IPI RzCmdStatus rz_type_xrefs_list_all_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_type.c:797
RZ_IPI RzCmdStatus rz_type_link_handler(RzCore *core, int argc, const char **argv, RzOutputMode mode)
Definition: cmd_type.c:472
RZ_IPI RzCmdStatus rz_type_xrefs_function_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_type.c:787
RZ_IPI RzCmdStatus rz_type_function_del_all_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_type.c:450
RZ_IPI RzCmdStatus rz_type_del_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_type.c:266
static void types_cc_print(RzCore *core, const char *cc, RzOutputMode mode)
Definition: cmd_type.c:16
RZ_IPI RzCmdStatus rz_type_cc_list_handler(RzCore *core, int argc, const char **argv, RzOutputMode mode)
Definition: cmd_type.c:277
RZ_IPI RzCmdStatus rz_type_list_structure_handler(RzCore *core, int argc, const char **argv, RzOutputMode mode)
Definition: cmd_type.c:575
RZ_IPI RzCmdStatus rz_type_open_sdb_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_type.c:546
RZ_IPI RzCmdStatus rz_type_cc_del_all_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_type.c:293
static RzCmdStatus types_enum_member_find_all(RzCore *core, const char *enum_value)
Definition: cmd_type.c:55
RZ_IPI RzCmdStatus rz_type_del_all_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_type.c:271
static void types_xrefs(RzCore *core, const char *typestr)
Definition: cmd_type.c:149
static RzCmdStatus types_enum_member_find(RzCore *core, const char *enum_name, const char *enum_value)
Definition: cmd_type.c:43
static void type_list_c_all_nl(RzCore *core)
Definition: cmd_type.c:80
static RzCmdStatus type_format_print_value(RzCore *core, const char *type, ut64 val)
Definition: cmd_type.c:125
RZ_IPI RzCmdStatus rz_type_noreturn_del_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_type.c:515
RZ_IPI RzCmdStatus rz_type_open_file_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_type.c:532
RZ_IPI RzCmdStatus rz_type_function_cc_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_type.c:455
RZ_IPI RzCmdStatus rz_type_print_hexstring_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_type.c:571
RZ_IPI RzCmdStatus rz_type_cc_del_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_type.c:287
RZ_IPI RzCmdStatus rz_type_list_c_nl_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_type.c:313
RZ_IPI RzCmdStatus rz_type_xrefs_graph_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_type.c:792
RZ_IPI RzCmdStatus rz_type_list_enum_handler(RzCore *core, int argc, const char **argv, RzOutputMode mode)
Definition: cmd_type.c:334
RZ_IPI RzCmdStatus rz_type_enum_bitfield_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_type.c:363
RZ_IPI RzCmdStatus rz_type_enum_c_nl_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_type.c:400
static RzCmdStatus types_xrefs_function(RzCore *core, ut64 addr)
Definition: cmd_type.c:193
RZ_IPI RzCmdStatus rz_type_list_union_handler(RzCore *core, int argc, const char **argv, RzOutputMode mode)
Definition: cmd_type.c:699
RZ_IPI RzCmdStatus rz_type_handler(RzCore *core, int argc, const char **argv, RzOutputMode mode)
Definition: cmd_type.c:256
RZ_IPI RzCmdStatus rz_type_enum_find_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_type.c:425
static void types_xrefs_graph(RzCore *core)
Definition: cmd_type.c:212
RZ_IPI RzCmdStatus rz_type_list_typedef_handler(RzCore *core, int argc, const char **argv, RzOutputMode mode)
Definition: cmd_type.c:653
RZ_IPI RzCmdStatus rz_type_list_c_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_type.c:298
RZ_IPI RzCmdStatus rz_type_xrefs_list_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_type.c:777
RZ_IPI RzCmdStatus rz_type_list_noreturn_handler(RzCore *core, int argc, const char **argv, RzOutputMode mode)
Definition: cmd_type.c:500
RZ_IPI RzCmdStatus rz_type_link_show_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_type.c:483
static RzCmdStatus type_format_print_variable(RzCore *core, const char *type, const char *varname)
Definition: cmd_type.c:100
RZ_IPI RzCmdStatus rz_type_list_function_handler(RzCore *core, int argc, const char **argv, RzOutputMode mode)
Definition: cmd_type.c:430
RZ_IPI RzCmdStatus rz_type_define_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_type.c:328
static void types_xrefs_summary(RzCore *core)
Definition: cmd_type.c:173
RZ_IPI RzCmdStatus rz_type_open_editor_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_type.c:539
RZ_IPI RzCmdStatus rz_type_structure_c_nl_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_type.c:628
RZ_IPI RzCmdStatus rz_type_enum_c_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_type.c:375
RZ_IPI RzCmdStatus rz_type_typedef_c_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_type.c:673
RZ_IPI RzCmdStatus rz_type_print_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_type.c:551
static void type_list_c_all(RzCore *core)
Definition: cmd_type.c:72
RZ_IPI RzCmdStatus rz_type_link_del_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_type.c:489
RZ_IPI RzCmdStatus rz_type_print_value_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_type.c:563
RZ_IPI RzCmdStatus rz_type_union_c_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_type.c:727
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
RZ_IPI void rz_core_types_link_print_all(RzCore *core, RzOutputMode mode)
Definition: ctypes.c:931
RZ_IPI void rz_core_types_union_print_format_all(RzCore *core)
Definition: ctypes.c:613
RZ_IPI bool rz_types_open_editor(RzCore *core, RZ_NONNULL const char *typename)
Definition: ctypes.c:1075
RZ_IPI void rz_core_types_function_noreturn_print(RzCore *core, RzOutputMode mode)
Definition: ctypes.c:553
RZ_IPI void rz_core_types_typedef_print_all(RzCore *core, RzOutputMode mode)
Definition: ctypes.c:366
RZ_IPI RZ_OWN char * rz_core_types_enum_as_c(RzTypeDB *typedb, const RzBaseType *btype, bool multiline)
Definition: ctypes.c:123
RZ_IPI RZ_OWN char * rz_core_types_struct_as_c_all(RzTypeDB *typedb, bool multiline)
Definition: ctypes.c:320
RZ_IPI void rz_core_types_link_show(RzCore *core, ut64 addr)
Definition: ctypes.c:975
RZ_IPI void rz_core_types_function_print(RzTypeDB *typedb, const char *function, RzOutputMode mode, PJ *pj)
Definition: ctypes.c:472
RZ_IPI void rz_core_types_function_print_all(RzCore *core, RzOutputMode mode)
Definition: ctypes.c:509
RZ_IPI bool rz_types_open_file(RzCore *core, const char *path)
Definition: ctypes.c:1046
RZ_IPI void rz_core_types_union_print_all(RzCore *core, RzOutputMode mode)
Definition: ctypes.c:198
RZ_IPI RZ_OWN char * rz_core_types_typedef_as_c_all(RzTypeDB *typedb)
Definition: ctypes.c:392
RZ_IPI void rz_core_types_struct_print_all(RzCore *core, RzOutputMode mode)
Definition: ctypes.c:293
RZ_IPI void rz_core_types_struct_print_format_all(RzCore *core)
Definition: ctypes.c:602
RZ_IPI void rz_core_types_print_all(RzCore *core, RzOutputMode mode)
Definition: ctypes.c:984
RZ_IPI void rz_core_types_enum_print(RzCore *core, const RzBaseType *btype, RzOutputMode mode, PJ *pj)
Definition: ctypes.c:65
RZ_IPI RZ_OWN char * rz_core_types_enum_as_c_all(RzTypeDB *typedb, bool multiline)
Definition: ctypes.c:134
RZ_IPI RZ_OWN char * rz_core_types_union_as_c_all(RzTypeDB *typedb, bool multiline)
Definition: ctypes.c:228
RZ_IPI void rz_core_types_show_format(RzCore *core, const char *name, RzOutputMode mode)
Definition: ctypes.c:568
RZ_IPI void rz_core_types_struct_print(RzCore *core, const RzBaseType *btype, RzOutputMode mode, PJ *pj)
Definition: ctypes.c:246
RZ_IPI RZ_OWN char * rz_core_types_typedef_as_c(RzTypeDB *typedb, const RzBaseType *btype)
Definition: ctypes.c:385
RZ_IPI RZ_OWN char * rz_core_types_struct_as_c(RzTypeDB *typedb, const RzBaseType *btype, bool multiline)
Definition: ctypes.c:312
RZ_IPI void rz_types_define(RzCore *core, const char *type)
Definition: ctypes.c:1029
RZ_IPI void rz_core_types_enum_print_all(RzCore *core, RzOutputMode mode)
Definition: ctypes.c:104
RZ_IPI RZ_OWN char * rz_core_types_union_as_c(RzTypeDB *typedb, const RzBaseType *btype, bool multiline)
Definition: ctypes.c:217
RZ_IPI void rz_core_types_union_print(RzCore *core, const RzBaseType *btype, RzOutputMode mode, PJ *pj)
Definition: ctypes.c:152
RZ_IPI void rz_core_types_typedef_print(RzCore *core, const RzBaseType *btype, RzOutputMode mode, PJ *pj)
Definition: ctypes.c:338
RZ_IPI void rz_core_types_calling_conventions_print(RzCore *core, RzOutputMode mode)
Definition: ctypes.c:19
#define NULL
Definition: cris-opc.c:27
RZ_API RZ_OWN char * rz_core_types_as_c(RZ_NONNULL RzCore *core, RZ_NONNULL const char *name, bool multiline)
Get a type string by name (.
Definition: ctypes.c:424
RZ_API RZ_OWN char * rz_core_types_as_c_all(RZ_NONNULL RzCore *core, bool multiline)
Get all types with pretty printing.
Definition: ctypes.c:439
RZ_API void rz_core_types_link(RzCore *core, const char *typestr, ut64 addr)
Link an address addr to the type referenced by typestr.
Definition: ctypes.c:954
RZ_DEPRECATE RZ_API RzAnalysisFunction * rz_analysis_get_fcn_in(RzAnalysis *analysis, ut64 addr, int type)
Definition: fcn.c:1687
RZ_API RZ_OWN RzList * rz_analysis_types_from_fcn(RzAnalysis *analysis, RzAnalysisFunction *fcn)
Definition: fcn.c:2545
RZ_API RZ_OWN char * rz_type_format(RZ_NONNULL const RzTypeDB *typedb, RZ_NONNULL const char *name)
Represents the RzBaseType as a pf format string.
Definition: format.c:2965
unsigned char match[65280+2]
Definition: gun.c:165
RZ_API void Ht_() free(HtName_(Ht) *ht)
Definition: ht_inc.c:130
const char int mode
Definition: ioapi.h:137
RZ_API RZ_OWN RzList * rz_list_uniq(RZ_NONNULL const RzList *list, RZ_NONNULL RzListComparator cmp)
Returns a new RzList which contains only unique values.
Definition: list.c:756
RZ_API RZ_OWN RzList * rz_list_newf(RzListFree f)
Returns a new initialized RzList pointer and sets the free method.
Definition: list.c:248
RZ_API void rz_list_sort(RZ_NONNULL RzList *list, RZ_NONNULL RzListComparator cmp)
Sorts via merge sort or via insertion sort a list.
Definition: list.c:743
RZ_API RZ_BORROW RzListIter * rz_list_push(RZ_NONNULL RzList *list, void *item)
Alias for rz_list_append.
Definition: list.c:60
RZ_API ut32 rz_list_length(RZ_NONNULL const RzList *list)
Returns the length of the list.
Definition: list.c:109
RZ_API void rz_list_free(RZ_NONNULL RzList *list)
Empties the list and frees the list pointer.
Definition: list.c:137
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")
int n
Definition: mipsasm.c:19
int type
Definition: mipsasm.c:17
const char * name
Definition: op.c:541
insn_type_descr_t types[]
Definition: or1k_disas.c:7
#define rz_return_if_fail(expr)
Definition: rz_assert.h:100
#define rz_return_val_if_fail(expr, val)
Definition: rz_assert.h:108
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
int(* RzListComparator)(const void *value, const void *list_data)
Definition: rz_list.h:33
#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_new(void)
Definition: pj.c:25
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_ks(PJ *j, const char *k, const char *v)
Definition: pj.c:170
RZ_API PJ * pj_a(PJ *j)
Definition: pj.c:81
#define RZ_STR_ISEMPTY(x)
Definition: rz_str.h:67
RZ_API const char * rz_str_trim_head_ro(const char *str)
Definition: str_trim.c:86
RZ_API int rz_str_replace_ch(char *s, char a, char b, bool g)
Definition: str.c:139
RzOutputMode
Enum to describe the way data are printed.
Definition: rz_types.h:38
@ 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 PFMT64x
Definition: rz_types.h:393
RZ_API void sdb_reset(Sdb *s)
Definition: sdb.c:433
RZ_API bool rz_type_db_load_sdb(RzTypeDB *typedb, RZ_NONNULL const char *path)
Loads the types from compiled SDB specified by path.
Definition: engine.c:71
Definition: z80asm.h:102
Definition: rz_pj.h:12
RzList * fcns
Definition: rz_analysis.h:565
RzTypeDB * typedb
Definition: rz_analysis.h:602
ut64 offset
Definition: rz_core.h:301
RzAnalysis * analysis
Definition: rz_core.h:322
RzNum * num
Definition: rz_core.h:316
struct rz_list_iter_t * n
Definition: rz_list.h:15
RzTypeParser * parser
Definition: rz_type.h:37
RZ_API bool rz_type_func_cc_set(RzTypeDB *typedb, const char *name, const char *cc)
Searches for the RzCallable type in types database and set the calling convention.
Definition: function.c:246
RZ_API bool rz_type_func_noreturn_drop(RzTypeDB *typedb, RZ_NONNULL const char *name)
Drops the "noreturn" attribute from the RzCallable type.
Definition: function.c:543
RZ_API void rz_type_func_delete_all(RzTypeDB *typedb)
Removes all RzCallable types.
Definition: function.c:192
RZ_API RZ_OWN RzList * rz_type_noreturn_function_names(RzTypeDB *typedb)
Returns the list of all noreturn function type names.
Definition: function.c:588
RZ_API bool rz_type_func_delete(RzTypeDB *typedb, RZ_NONNULL const char *name)
Removes RzCallable type from the types database.
Definition: function.c:179
RZ_API RZ_BORROW const char * rz_type_func_cc(RzTypeDB *typedb, RZ_NONNULL const char *name)
Searches for the RzCallable type in types database and returns calling convention.
Definition: function.c:230
RZ_API bool rz_type_func_noreturn_add(RzTypeDB *typedb, RZ_NONNULL const char *name)
Adds the "noreturn" attribute to the RzCallable type.
Definition: function.c:518
RZ_API RZ_BORROW const char * rz_type_identifier(RZ_NONNULL const RzType *type)
Returns the type C identifier.
Definition: type.c:1155
RZ_API bool rz_types_equal(RZ_NONNULL const RzType *type1, RZ_NONNULL const RzType *type2)
Checks if two types are identical.
Definition: type.c:1218
RZ_API void rz_type_db_purge(RzTypeDB *typedb)
Purges the instance of the RzTypeDB.
Definition: type.c:96
RZ_API RZ_BORROW const char * rz_type_db_enum_member_by_val(const RzTypeDB *typedb, RZ_NONNULL const char *name, ut64 val)
Returns the enum case name matching the cpecified value.
Definition: type.c:508
RZ_API RzBaseType * rz_type_db_get_enum(const RzTypeDB *typedb, RZ_NONNULL const char *name)
Returns the enum base type matching the specified name.
Definition: type.c:489
RZ_API bool rz_type_db_del(RzTypeDB *typedb, RZ_NONNULL const char *name)
Removes the type from the database.
Definition: type.c:223
RZ_API int rz_type_db_enum_member_by_name(const RzTypeDB *typedb, RZ_NONNULL const char *name, const char *member)
Returns the enum case value matched by the enum case name.
Definition: type.c:533
RZ_API RzBaseType * rz_type_db_get_typedef(const RzTypeDB *typedb, RZ_NONNULL const char *name)
Returns the typedef base type matching the specified name.
Definition: type.c:666
RZ_API RzBaseType * rz_type_db_get_union(const RzTypeDB *typedb, RZ_NONNULL const char *name)
Returns the union base type matching the specified name.
Definition: type.c:630
RZ_API RZ_OWN char * rz_type_as_string(const RzTypeDB *typedb, RZ_NONNULL const RzType *type)
Returns the type C representation.
Definition: type.c:817
RZ_API RzBaseType * rz_type_db_get_struct(const RzTypeDB *typedb, RZ_NONNULL const char *name)
returns the struct base type matching the specified name
Definition: type.c:648
RZ_API RZ_OWN RzList * rz_type_db_find_enums_by_val(const RzTypeDB *typedb, ut64 val)
Returns all enums and cases name matching the specified value.
Definition: type.c:559
RZ_API ut64 rz_analysis_var_addr(RzAnalysisVar *var)
Definition: var.c:270
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