28 #define MAX_SCAN_SIZE 0x7ffffff
37 return (
a->addr >
b->addr) - (
a->addr <
b->addr);
42 return (
a->addr >
b->addr) - (
a->addr <
b->addr);
100 ut8 rstr[128] = { 0 };
101 int ret = 0,
len = 0;
120 ut64 lowptr = cstr[0];
125 if (cstr[0] == 0 && cstr[1] < 0x1000) {
135 strcpy((
char *)
str, (
char *)rstr);
148 strcpy((
char *)
str, (
char *)rstr);
164 return ret ? (
char *)
str :
NULL;
178 rz_list_foreach (
rs->regs,
iter,
r) {
202 if (
addr >=
map->addr && addr < map->addr_end) {
203 if (
map->name &&
map->name[0] ==
'/') {
223 if (
map->name && strstr(
map->name,
"heap")) {
226 if (
map->name && strstr(
map->name,
"stack")) {
240 if (
addr >=
s->itv.addr &&
addr < (
s->itv.addr +
s->itv.size)) {
242 _perm = (_perm != -1) ?
RZ_MIN(_perm,
s->perm) :
s->perm;
246 if (
s->name && strstr(
s->name,
"heap")) {
249 if (
s->name && strstr(
s->name,
"stack")) {
271 int i, failed_sequence, dir, on;
272 for (
i = 0;
i < 8;
i++) {
283 for (
i = 0;
i < 8;
i++) {
287 dir = (
n > on) ? 1 : -1;
298 if (!failed_sequence) {
343 static int casecmp(
const void *_a,
const void *_b) {
346 return a->addr !=
b->addr;
351 if (
addr >=
b->addr &&
addr < (
b->addr +
b->size)) {
352 for (
i = 0;
i <
b->ninstr;
i++) {
370 rz_list_foreach (fcn->
bbs,
iter, bb2) {
397 rz_list_foreach (unique_cases,
iter, cop) {
413 pj_k(pj,
"switch_op");
435 pj_kn(pj,
"opaddr", opaddr);
438 pj_ki(pj,
"inputs", inputs);
439 pj_ki(pj,
"outputs", outputs);
489 rz_list_foreach (fcn->
bbs,
iter, bb) {
509 if (!strncmp(fcn->
name,
"fcn.", 4) || !strncmp(fcn->
name,
"sym.func.", 9)) {
527 const char *
list[] = {
550 bool use_getopt =
false;
551 bool use_isatty =
false;
552 char *do_call =
NULL;
554 rz_list_foreach (xrefs,
iter, xref) {
557 if (strstr(
f->name,
".isatty")) {
560 if (strstr(
f->name,
".getopt")) {
563 if (!strncmp(
f->name,
"method.", 7)) {
568 if (!strncmp(
f->name,
"str.", 4)) {
573 if (!strncmp(
f->name,
"sym.imp.", 8)) {
578 if (!strncmp(
f->name,
"reloc.", 6)) {
591 if (item && item->
offset == fcn->addr) {
594 return strdup(
"parse_args");
618 rz_list_foreach (xrefs,
iter, xref) {
627 pj_ks(pj,
"flag",
f->name);
648 bool is_va = core->
io->
va;
656 rz_list_foreach (xrefs,
iter, xref) {
678 map->itv.addr +
map->itv.size);
679 if (looksLikeAFunction) {
698 ut64 offe = offs + 1024;
699 for (offs = 0; offs < offe; offs += sz, xref1.
from += sz) {
731 rz_list_foreach (xrefs,
iter, xref) {
735 switch (xref->
type) {
756 const char *locname =
"loc.";
757 const size_t locsize = strlen(locname);
758 char *fcnname = fcn->
name;
760 if (strncmp(fcn->
name, locname, locsize) == 0) {
761 const char *fcnpfx, *restofname;
766 restofname = fcn->
name + locsize;
794 bool nameChanged =
false;
796 if (!strncmp(fcn->
name,
"loc.", 4) || !strncmp(fcn->
name,
"fcn.", 4)) {
799 }
else if (strncmp(
f->name,
"sect", 4)) {
836 if (hint && hint->
bits == 16) {
890 if (
f &&
f->name && strncmp(
f->name,
"sect", 4)) {
891 char *new_name =
strdup(
f->name);
897 rz_list_foreach (syms,
iter, sym) {
906 fcn->
name = new_name;
910 if (!fcnpfx || !*fcnpfx || !strcmp(fcnpfx,
"fcn")) {
918 rz_flag_space_pop(core->
flags);
932 for (
i = 0;
i < nexti;
i++) {
933 if (next[
i] ==
addr) {
963 for (
i = 0;
i < nexti;
i++) {
999 rz_flag_space_pop(core->
flags);
1003 if (fcn && has_next) {
1008 for (
i = 0;
i < nexti;
i++) {
1067 RZ_LOG_DEBUG(
"Unimplemented RZ_ANALYSIS_OP_MASK_DISASM for current analysis.arch. Using the RzAsmOp as fallback for now.\n");
1098 switch (node->
type) {
1099 case HINT_NODE_ADDR: {
1159 case HINT_NODE_ARCH:
1163 rz_cons_print(
" arch=RESET");
1166 case HINT_NODE_BITS:
1170 rz_cons_print(
" bits=RESET");
1179 #define HINTCMD_ADDR(hint, fmt, x) rz_cons_printf(fmt " @ 0x%" PFMT64x "\n", x, (hint)->addr)
1180 switch (node->
type) {
1181 case HINT_NODE_ADDR: {
1241 case HINT_NODE_ARCH:
1244 case HINT_NODE_BITS:
1251 switch (node->
type) {
1252 case HINT_NODE_ADDR: {
1303 pj_kb(pj,
"high",
true);
1312 case HINT_NODE_ARCH:
1319 case HINT_NODE_BITS:
1339 }
else if (ia > ta) {
1351 node->
type = HINT_NODE_ADDR;
1363 node->
type = HINT_NODE_ARCH;
1375 node->
type = HINT_NODE_BITS;
1389 } else if (state->mode == RZ_OUTPUT_MODE_STANDARD) { \
1390 rz_cons_newline(); \
1402 last_addr = node->
addr;
1457 int line = 0, oline = 0,
idx = 0;
1461 for (at = bb->
addr; at < bb->
addr + bb->
size; at += 2) {
1463 if (
line != 0 &&
line != oline && strcmp(
file,
"??")) {
1466 int flen = strlen(filestr);
1473 }
else if (is_html) {
1516 bool current = rz_analysis_block_contains(bbi, core->
offset);
1518 if (current && color_current) {
1520 rz_cons_printf(
"\t[fillcolor=%s style=filled shape=box];\n", pal_curr);
1536 rz_list_foreach (fcn->
bbs,
iter, bbi) {
1551 }
else if (is_html) {
1553 " <img class=\"connector-end\" src=\"img/arrow.gif\" /></div>\n",
1555 }
else if (!is_json && !is_keva) {
1564 "[color=\"%s\"];\n",
1566 bbi->
fail != -1 ? pal_jump : pal_trfa);
1571 if (bbi->
fail != -1) {
1575 " <img class=\"connector-end\" src=\"img/arrow.gif\"/></div>\n",
1577 }
else if (!is_keva && !is_json) {
1586 "[color=\"%s\"];\n",
1599 " <img class=\"connector-end\" src=\"img/arrow.gif\"/></div>\n",
1601 }
else if (!is_keva && !is_json) {
1610 "[color=\"%s\"];\n",
1627 }
else if (is_html) {
1629 " <img class=\"connector-end\" src=\"img/arrow.gif\"/></div>\n",
1631 }
else if (!is_json && !is_keva) {
1640 "[color2=\"%s\"];\n",
1641 caseop->
addr, caseop->
jump, pal_fail);
1672 rz_list_foreach (fcn->
bbs,
iter, bbi) {
1678 }
else if (is_json) {
1687 if (bbi->
fail != -1) {
1692 pj_k(pj,
"switchop");
1694 pj_kn(pj,
"offset",
op->addr);
1695 pj_kn(pj,
"defval",
op->def_val);
1696 pj_kn(pj,
"maxval",
op->max_val);
1697 pj_kn(pj,
"minval",
op->min_val);
1702 rz_list_foreach (
op->cases, case_iter, case_op) {
1724 if (is_json_format_disasm) {
1729 RzCoreDisasmOptions disasm_options = {
1746 const char *difftype = bbi->
diff ? (
1750 const char *diffname = bbi->
diff ? (
1757 }
else if (!is_json) {
1761 "asm.cmt.right",
"asm.lines.fcn",
"asm.bytes",
NULL);
1773 char dff_from[32], dff_to[32];
1789 char *nl = strchr(diffstr,
'\n');
1791 nl = strchr(nl + 1,
'\n');
1793 nl = strchr(nl + 1,
'\n');
1821 "color=\"black\", fontname=\"%s\","
1822 " label=\"%s\", URL=\"%s/0x%08" PFMT64x "\"]\n",
1823 bbi->
addr, difftype, diffstr, font, fcn->
name,
1837 if (!title || !body_b64) {
1849 "color=\"black\", fontname=\"%s\","
1850 " label=\"%s\", URL=\"%s/0x%08" PFMT64x "\"]\n",
1861 "top: %dpx; left: %dpx; width: 400px;\" id=\""
1862 "_0x%08" PFMT64x "\">\n%s</p>\n",
1864 left = left ? 0 : 600;
1868 }
else if (!is_json && !is_keva) {
1869 bool current = rz_analysis_block_contains(bbi, core->
offset);
1870 const char *label_color = bbi->
traced
1872 : (current && color_current)
1875 const char *fill_color = ((current && color_current) || label_color == pal_traced) ? pal_traced :
"white";
1881 if (!title || !body_b64) {
1892 "URL=\"%s/0x%08" PFMT64x "\", fillcolor=\"%s\","
1893 "color=\"%s\", fontname=\"%s\","
1896 fill_color, label_color, font,
str);
1937 }
else if (is_json) {
1942 free(fcn_name_escaped);
1949 pj_ki(pj,
"nlocals",
2062 if (fcn->
addr == at) {
2074 if (l && !rz_list_empty(l)) {
2126 rz_config_hold_i(hc,
"scr.color",
"scr.utf8",
"asm.marks",
"asm.offset",
"asm.lines",
2127 "asm.cmt.right",
"asm.cmt.col",
"asm.lines.fcn",
"asm.bytes",
NULL);
2138 rz_list_foreach (fcn->
bbs,
iter, bb) {
2145 if (!title || !body || !body_b64) {
2163 rz_list_foreach (fcn->
bbs,
iter, bb) {
2200 HtUUOptions opt = { 0 };
2201 HtUU *ht = ht_uu_new_opt(&opt);
2208 rz_list_foreach (fcn->
bbs,
iter, bb) {
2212 ht_uu_insert(ht, bb->
addr,
id);
2229 rz_list_foreach (fcn->
bbs,
iter, bb) {
2318 const char *me = fcn->
name;
2322 rz_list_foreach (xrefs,
iter, xref) {
2325 if (binsec && binsec->
is_data) {
2338 eprintf(
"Not in a function. Use 'df' to define it.\n");
2345 const char *me = fcn->
name;
2350 rz_list_foreach (xrefs,
iter, xref) {
2358 eprintf(
"Not in a function. Use 'df' to define it.\n");
2365 char *me = (
f &&
f->offset ==
addr)
2377 rz_list_foreach (
list,
iter, xref) {
2422 return xref1->
to != xref2->
to;
2460 if (!gv_edge || !*gv_edge) {
2461 gv_edge =
"arrowhead=\"normal\" style=bold weight=2";
2463 if (!gv_node || !*gv_node) {
2465 gv_node =
rz_str_newf(
"penwidth=4 fillcolor=white style=filled fontname=\"%s Bold\" fontsize=14 shape=box", font);
2467 if (!gv_grph || !*gv_grph) {
2468 gv_grph =
"bgcolor=azure";
2470 if (!gv_spline || !*gv_spline) {
2472 gv_spline =
"splines=\"curved\"";
2476 "outputorder=edgesfirst;\n"
2477 "graph [%s fontname=\"%s\" %s];\n"
2480 gv_grph, font, gv_spline,
2505 rz_list_foreach (xrefs, iter2, fcnr) {
2511 if (rz_list_empty(calls)) {
2523 if (iteration == 0) {
2541 pj_ks(pj,
"name", fcni_addr);
2544 pj_ka(pj,
"imports");
2549 " URL=\"%s/0x%08" PFMT64x "\"];\n",
2553 rz_list_foreach (calls, iter2, fcnr) {
2559 if (iteration == 0) {
2564 fcnr->
to - base, fcnr_name);
2569 fcni->
addr - base, fcnr->
to - base);
2573 if (iteration != 0) {
2578 fcni->
addr - base, fcnr->
to - base);
2583 "[color=\"%s\" URL=\"%s/0x%08" PFMT64x "\"];\n",
2587 fcnr_name, fcnr->
to);
2590 " URL=\"%s/0x%08" PFMT64x "\"];\n",
2591 fcnr->
to, fcnr_name,
2592 fcnr_name, fcnr->
to);
2596 pj_s(pj, fcnr_name);
2600 pj_s(pj, fcnr_addr);
2613 if (!(flag && flag->
name)) {
2670 if (!rz_list_empty(xrefs)) {
2672 rz_list_foreach_safe (xrefs,
iter, iter2, xrefi) {
2701 #define REG_SET_SIZE (RZ_ANALYSIS_CC_MAXARG + 2)
2716 if (!prev_regset[
i] && cur_regset[
i] == 1) {
2731 if (bb->
size >
ctx->core->analysis->opt.bb_max_size) {
2742 while (pos < bb->
addr + bb->
size) {
2752 if (!
ctx->argonly) {
2760 int opsize =
op->size;
2788 int saved_stack = fcn->
stack;
2794 fcn->
stack = saved_stack;
2815 if (rz_analysis_block_contains(bb,
to) ||
2816 ((!ht_up_find(avoid, bb->
jump,
NULL) &&
2819 ((!ht_up_find(avoid, bb->
fail,
NULL) &&
2833 rz_list_foreach (xrefs,
iter, xrefi) {
2835 if (rz_analysis_block_contains(bb, xrefi->
from)) {
2854 HtUP *
state = ht_up_new0();
2873 rz_list_foreach (xrefs,
iter, xref) {
2898 HtUP *avoid = ht_up_new0();
2905 ht_up_update(avoid, last->
addr, last);
2947 if (!is_json_format_disasm) {
2951 if (!is_html && !is_json && !is_keva && !is_star) {
2955 if (!gv_edge || !*gv_edge) {
2956 gv_edge =
"arrowhead=\"normal\"";
2958 if (!gv_node || !*gv_node) {
2959 gv_node =
"fillcolor=gray style=filled shape=box";
2961 if (!gv_spline || !*gv_spline) {
2962 gv_spline =
"splines=\"ortho\"";
2965 "\tgraph [bgcolor=azure fontsize=8 fontname=\"%s\" %s];\n"
2968 font, gv_spline, gv_node, gv_edge);
2994 if (!is_html && !is_json && !is_keva) {
3004 if (!is_keva && !is_html && !is_json && !is_star && !is_json_format_disasm) {
3022 if (ref ==
UT64_MAX || ptr == ref) {
3045 char diff =
addr % 4;
3050 if (
buf[3] == 0x94) {
3080 char bckwrds, do_bckwrd_srch;
3084 if (!strncmp(core->
rasm->
cur->name,
"arm", 3)) {
3096 eprintf(
"Null reference search is not supported\n");
3105 do_bckwrd_srch =
false;
3112 while ((!bckwrds && at <
to) || bckwrds) {
3125 bckwrds ?
i-- :
i++) {
3144 if (
op.direction ==
mask) {
3206 if (!do_bckwrd_srch) {
3212 do_bckwrd_srch =
false;
3220 eprintf(
"error: block size too small\n");
3246 bool analyze_recursively =
rz_config_get_b(core->config,
"analysis.calls");
3248 rz_list_foreach (xrefs,
iter, xref) {
3279 from = core->offset;
3282 }
else if (cfg_debug) {
3286 RZ_LOG_ERROR(
"Cannot find debug map boundaries at current offset\n");
3298 RZ_LOG_ERROR(
"cannot find maps with exec permisions\n");
3332 }
else if (core->
io->
va) {
3355 char *str_flagname =
rz_str_newf(
"str.%s", str_string);
3358 rz_flag_space_pop(core->
flags);
3387 const int bsz = 8096;
3395 }
else if (core->blocksize <=
OPSZ) {
3418 int i = 0, ret = bsz;
3424 if (!memcmp(
buf, block, bsz)) {
3429 if (!memcmp(
buf, block, bsz)) {
3435 ret = ret > 0 ? ret : 1;
3437 if (ret <= 0 || i > bsz) {
3447 for (
ut8 i = 0;
i < 6; ++
i) {
3448 st64 aval =
op.analysis_vals[
i].imm;
3528 if (symbol && symbol->
type) {
3536 if (
s &&
s->name &&
s->bind) {
3540 if (!strcmp(
s->name,
"__mh_execute_header")) {
3543 if (!strcmp(
s->bind,
"NONE")) {
3544 if (
s->is_imported &&
s->libname && strstr(
s->libname,
".dll")) {
3581 rz_list_foreach (
list,
iter, symbol) {
3614 if (analysis_vars) {
3621 if (!strncmp(fcni->
name,
"sym.", 4) || !strncmp(fcni->
name,
"main", 4)) {
3640 int word = wordsize ? wordsize : core->
rasm->
bits / 8;
3654 for (
i = j = 0; j <
count; j++) {
3681 i += strlen((
const char *)
buf +
i) + 1;
3684 i += (
d->len > 3) ?
d->len : word;
3706 u->
blocks[piece].flags++;
3729 RzCoreAnalysisStats *as =
RZ_NEW0(RzCoreAnalysisStats);
3741 if (!
count || SZT_MUL_OVFCHK(
count,
sizeof(RzCoreAnalysisStatsItem))) {
3751 for (at =
from; at <
to;) {
3754 blocks[piece].perm =
map ?
map->perm : (core->io->desc ? core->io->desc->perm : 0);
3765 rz_list_foreach (core->analysis->fcns,
iter,
F) {
3766 if (
F->addr <
from ||
F->addr >
to) {
3770 blocks[piece].functions++;
3772 for (; piece <= last_piece; piece++) {
3773 blocks[piece].in_functions++;
3776 rz_list_foreach (
F->bbs, iter2,
B) {
3777 if (
B->addr <
from ||
B->addr >
to) {
3786 if (
S->vaddr <
from ||
S->vaddr >
to) {
3789 size_t piece = (
S->vaddr -
from) /
step;
3807 blocks[piece].comments++;
3831 return s->from +
s->step *
i;
3913 ccl -=
op->failcycles;
3924 if (
op->addr !=
op->jump) {
3977 ccl -=
op->failcycles;
4031 if (!strncmp(
f->name,
"fcn.", 4)) {
4051 eprintf(
"Cannot find function\n");
4055 eprintf(
"Cannot merge the same function\n");
4061 rz_list_foreach (
f1->bbs,
iter, bb) {
4075 rz_list_foreach (
f2->bbs,
iter, bb) {
4104 if (xref_to ==
UT64_MAX || !xref_to) {
4107 if (!xref_from || xref_from ==
UT64_MAX) {
4114 char *flagname =
sdb_fmt(
"str.%s", str_flagname);
4117 rz_flag_space_pop(core->
flags);
4146 if (
op->dst &&
op->dst->reg) {
4147 return op->dst->reg->name;
4150 if (
op->src[0] &&
op->src[0]->reg) {
4151 return op->src[0]->reg->name;
4160 return op->dst->imm +
op->dst->delta;
4163 if (
op->src[1] && (
op->src[1]->imm ||
op->src[1]->delta)) {
4164 return op->src[1]->imm +
op->src[1]->delta;
4167 return op->src[0]->imm +
op->src[0]->delta;
4178 if (
addr >= spaddr && addr < ctx->initial_sp) {
4179 int stack_off =
addr -
ctx->initial_sp;
4184 if (!var && stack_off >= -
ctx->fcn->maxstack) {
4186 varname =
ctx->fcn->analysis->opt.varname_stack
4237 bool validRef =
false;
4238 if (trace &&
myvalid(core->
io, refptr)) {
4247 str[
sizeof(
str) - 1] = 0;
4276 if (analysis->
cur && analysis->
cur->
arch && analysis->
bits < 33 &&
4277 strstr(analysis->
cur->
arch,
"arm") && !strcmp(
name,
"pc") &&
op) {
4315 char *tmp_esil_str =
NULL;
4316 int tmp_esil_str_len;
4317 const char *esilstr;
4318 const int maxaddrlen = 20;
4319 const char *spname =
NULL;
4324 memcpy(&esil_cpy, esil,
sizeof(esil_cpy));
4349 goto err_analysis_op;
4355 goto err_analysis_op;
4360 if (!spname || !*spname) {
4361 goto err_analysis_op;
4363 tmp_esil_str_len = strlen(esilstr) + strlen(spname) + maxaddrlen;
4364 tmp_esil_str = (
char *)
malloc(tmp_esil_str_len);
4365 if (!tmp_esil_str) {
4366 goto err_analysis_op;
4368 tmp_esil_str[tmp_esil_str_len - 1] =
'\0';
4369 snprintf(tmp_esil_str, tmp_esil_str_len - 1,
"%s,[", spname);
4370 if (!*esilstr || (strncmp(esilstr, tmp_esil_str, strlen(tmp_esil_str)))) {
4372 goto err_analysis_op;
4375 snprintf(tmp_esil_str, tmp_esil_str_len - 1,
"%20" PFMT64u "%s", esil_cpy.
old, &esilstr[strlen(spname) + 4]);
4388 goto err_analysis_op;
4394 if (!esilstr || !*esilstr) {
4395 goto err_analysis_op;
4400 memcpy(esil, &esil_cpy,
sizeof(esil_cpy));
4421 ut64 cur_addr = *next_i +
ctx->start_addr;
4431 if (cur_addr >= bb->
addr + bb->
size) {
4459 if (!bbit && cop_it) {
4461 if (cop->
jump == prev_bb->
addr && cop_it->
n) {
4462 cop = cop_it->
n->
data;
4469 if (cop_it && !cop_it->
n) {
4473 }
while (!bbit && !rz_list_empty(
ctx->path));
4484 *next_i =
ctx->cur_bb->addr -
ctx->start_addr;
4486 }
else if (cur_addr >=
ctx->end_addr) {
4509 bool archIsArm =
false;
4537 eprintf(
"ESIL not initialized\n");
4555 if (fcn && fcn->reg_save_area) {
4561 if (!pcname || !*pcname) {
4562 eprintf(
"Cannot find program counter register in the current profile.\n");
4579 const char *gp_reg =
NULL;
4604 switch (meta->
type) {
4622 cur -= (cur % opalign);
4694 if (!esilstr || !*esilstr) {
4699 if (gp_fixed && gp_reg) {
4703 #define CHECKREF(x) ((refptr && (x) == refptr) || !refptr)
4719 if (cfg_analysis_strings) {
4731 if (cfg_analysis_strings) {
4736 if (!
op.src[0] || !
op.src[0]->reg || !
op.src[0]->reg->name) {
4739 if (!strcmp(
op.src[0]->reg->name,
"sp")) {
4742 if (!strcmp(
op.src[0]->reg->name,
"zero")) {
4745 if (
dst > 0xffff &&
op.src[1] && (
dst & 0xffff) == (
op.src[1]->imm & 0xffff) &&
myvalid(core->
io,
dst)) {
4750 if (cfg_analysis_strings) {
4772 if (cfg_analysis_strings) {
4781 if (cfg_analysis_strings) {
4801 ESIL->old = cur +
op.size;
4839 for (
size_t bb_i = i_old + 1; bb_i <=
i; bb_i++) {
4870 if (fdsz > 0 &&
map->delta > fdsz) {
4879 if (!strncmp(
desc->name,
"null://", 7)) {
4896 ut64 vmax,
int vsize, inRangeCb
cb,
void *cb_user) {
4907 eprintf(
"Error: from must be lower than to\n");
4910 bool maybeThumb =
false;
4918 eprintf(
"Error: vmin must be lower than vmax\n");
4922 eprintf(
"Error: Invalid destination boundary\n");
4937 if (!res || !memcmp(
buf,
"\xff\xff\xff\xff", 4) || !memcmp(
buf,
"\x00\x00\x00\x00", 4)) {
4948 for (
i = 0;
i <= (
size - vsize);
i++) {
4949 void *
v = (
buf +
i);
4954 if (align && (
addr) % align) {
4958 int left =
size -
i;
4969 match = (v16 >= vmin && v16 <= vmax);
4974 match = (v32 >= vmin && v32 <= vmax);
4979 match = (v64 >= vmin && v64 <= vmax);
4982 default:
eprintf(
"Unknown vsize %d\n", vsize);
return -1;
4984 if (
match && !vinfun) {
4996 bool isValidMatch =
true;
4997 if (align && (
value % align)) {
4999 isValidMatch =
false;
5000 if (maybeThumb && (
value & 1)) {
5001 isValidMatch =
true;
5059 return (
p->count < 1 || --
p->count > 0);
5085 ht_uu_insert(
p->visited, cur->
addr, 1);
5087 if (
p->followDepth && --
p->followDepth == 0) {
5090 if (
p->toBB && cur->
addr ==
p->toBB->addr) {
5101 if (
p->followCalls) {
5115 ht_uu_delete(
p->visited, cur->
addr);
5116 if (
p->followDepth) {
5171 rz_list_foreach (
f->bbs,
iter, bb) {
5210 rz_flag_space_pop(core->
flags);
5214 const char *
name =
v;
5218 rz_flag_space_pop(
flags);
5223 const char *
name =
v;
5227 rz_flag_space_pop(
flags);
5251 rz_flag_space_pop(core->
flags);
5285 rz_flag_space_pop(core->
flags);
5315 if (analyze_recursively) {
5321 rz_list_foreach (xrefs,
iter, xref) {
5340 rz_list_foreach (xrefs1,
iter, xref1) {
5391 fcn_name = fcn->
name;
5413 char *ret_type_str =
NULL;
5421 pj_ks(j,
"return", ret_type_str);
5448 RzAnalysisFcnVarsCache cache;
5452 rz_list_foreach (cache.rvars,
iter, var) {
5457 pj_ks(j,
"type", vartype);
5461 rz_list_foreach (cache.bvars,
iter, var) {
5462 if (var->
delta <= 0) {
5469 pj_ks(j,
"type", vartype);
5473 rz_list_foreach (cache.svars,
iter, var) {
5481 pj_ks(j,
"type", vartype);
5508 rz_list_foreach (
blocks,
bit, block_cur) {
5528 rz_list_foreach (
b->fcns, it, fcn) {
5540 rz_list_foreach (noretl, iter3, noret) {
5545 }
else if (rel->
symbol) {
5546 rz_list_foreach (noretl, iter3, noret) {
5554 #define CALL_BUF_SIZE 32
5595 HtUP *ht = (HtUP *)
v;
5636 HtUU *
done = ht_uu_new0();
5660 if (
f->is_noreturn) {
5661 ut64 *
n = ut64_new(
f->addr);
5665 while (!rz_list_empty(
todo)) {
5667 ut64 noret_addr = *paddr;
5674 rz_list_foreach (xrefs,
iter, xref) {
5681 ut64 chop_addr = call_addr + xrefop->
size;
5705 rz_list_foreach (block_fcns, fit,
f) {
5708 f->is_noreturn =
true;
5713 ht_uu_insert(
done, *
n, 1);
5746 eprintf(
"Cant find var by name\n");
5767 if (!strstr(
arch,
"ppc") && !strstr(
arch,
"arm") && !strstr(
arch,
"x86")) {
5772 return bo ? strstr(bo->
plugin->
name,
"mach") :
false;
5785 bool didAap =
false;
5786 const char *notify =
NULL;
5798 if (dh_orig && strcmp(dh_orig,
"esil")) {
5811 notify =
"Analyze function calls";
5822 notify =
"find and analyze function preludes";
5833 notify =
"Analyze len bytes of instructions for references";
5843 notify =
"Check for objc references";
5850 notify =
"Check for classes";
5867 notify =
"Emulate functions to find computed references";
5869 if (plugin_supports_esil) {
5881 notify =
"Speculatively constructing a function name "
5882 "for fcn.* and sym.func.* functions (aan)";
5890 notify =
"Analyze local variables and arguments";
5899 if (!rz_list_empty(
list)) {
5911 if (plugin_supports_esil) {
5912 notify =
"Type matching analysis for all functions";
5927 notify =
"Propagate noreturn information";
5936 notify =
"Integrate dwarf function information.";
5944 notify =
"Finding function preludes";
5950 notify =
"Enable constraint types analysis for variables";
6040 rz_list_foreach (sigdb,
iter, sig) {
6067 int n_flags_new, n_flags_old;
6072 if ((!obj || !obj->
plugin)) {
6073 RZ_LOG_INFO(
"Cannot apply signatures due unknown bin type\n");
6075 }
else if (!strcmp(obj->
plugin->
name,
"elf64")) {
6077 }
else if (!strcmp(obj->
plugin->
name,
"pe64")) {
6098 rz_list_foreach (sigdb,
iter, sig) {
6106 }
else if (strstr(sig->
base_name,
"c++") &&
6128 *n_applied = n_flags_new - n_flags_old;
6141 if (!var || var->
kind != kind) {
6160 switch (var->
kind) {
6179 const char sign = real_delta >= 0 ?
'+' :
'-';
6241 char *var_type =
NULL;
6250 rz_list_foreach (global_vars, it, glob) {
6255 switch (
state->mode) {
6263 pj_ks(pj,
"type", var_type);
6297 if (!o || !analysis) {
6302 if (rom_address == 0 || rom_size == 0) {
6316 s->vaddr = rom_address;
6317 s->vsize = rom_size;
6319 s->paddr = rom_address;
6330 eprintf(
"TOFIX: aaft can't run in debugger mode.\n");
6351 HtUU *loop_table = ht_uu_new0();
6376 ht_uu_free(loop_table);
6382 char *fcnname =
NULL;
6384 char *fcnstr_copy =
strdup(fcnstr);
6385 char *fcnname_aux = strtok(fcnstr_copy,
"(");
6391 fcnname =
strdup(ls ? ls : fcnname_aux);
6396 if (strcmp(fcn->
name, fcnname)) {
6455 if (as && as->
cur && as->
bits <= 32 && as->
cur->name) {
6456 return strstr(as->
cur->name,
"arm");
6466 int align = (searchAlign > 0) ? searchAlign : arch_align;
6468 if ((
from % align) || (
to % align)) {
6469 bool itsFine =
false;
6471 if ((
from & 1) || (
to & 1)) {
6546 rz_list_foreach (
list, iter2, map2) {
6583 int stack = 0, maxstack = 0;
6590 const int minopcode =
RZ_MAX(1, mininstrsz);
6593 if (!
op ||
op->size <= 0) {
6600 if (
stack > maxstack) {
6631 if (!strcmp(analysis_arch,
"null")) {
6644 free(home_types_dir);
6647 if (cc->
path && (!strcmp(cc->
path, dbpath) || !strcmp(cc->
path, dbhomepath))) {
6666 eprintf(
"Warning: Invalid CC from reg profile.\n");
6670 eprintf(
"Warning: Cannot derive CC from reg profile.\n");
6673 eprintf(
"Warning: Missing calling conventions for '%s'. Deriving it from the regprofile.\n", analysis_arch);
6692 pj_ks(pj,
"name", cc);
6708 for (
int i = 0;
i < maxargs;
i++) {
6749 RZ_LOG_ERROR(
"ESIL is not initialized. Use `aeim` first.\n");
6773 RZ_LOG_ERROR(
"ESIL is not initialized. Use `aeim` first.\n");
6795 RzAnalysisBytes *ab = ptr;
6801 free(ab->description);
6825 min_op_size = min_op_size > 0 ? min_op_size : 1;
6837 for (
int i_ops = 0, i_offset = 0, i_delta = 0;
6839 i_ops++, i_offset += oplen, i_delta += oplen) {
6841 RzAnalysisBytes *ab =
RZ_NEW0(RzAnalysisBytes);
6849 const ut8 *ptr =
buf + i_offset;
6852 if (nops > 0 && i_delta >=
len - 32) {
6866 if (reta < 1 || ret < 1) {
6867 oplen = min_op_size;
6868 ab->opcode =
strdup(
"invalid");
6869 ab->disasm =
strdup(
"invalid");
6884 ab->opcode =
strdup(an_asm);
6886 char *
sp = strchr(
mnem,
' ');
6891 sp = strchr(
arg,
' ');
6902 char *asm_buff =
calloc(strlen(an_asm) + 128,
sizeof(
char));
6903 strcpy(asm_buff, an_asm);
6909 asm_buff, asm_buff,
sizeof(asmop.buf_asm));
6913 asm_buff, disasm,
sizeof(disasm), bigendian);
6917 ab->disasm =
strdup(disasm);
6925 char *opname =
strdup(disasm);
6926 sp = strchr(opname,
' ');
6961 for (
int i = 0;
i < 3;
i++) {
6963 if (
op.src[
i]->imm) {
6964 offimm =
op.src[
i]->imm;
6965 }
else if (
op.src[
i]->delta) {
6966 offimm =
op.src[
i]->delta;
6970 if (!offimm &&
op.dst) {
6972 offimm =
op.dst->imm;
6973 }
else if (
op.dst->delta) {
6974 offimm =
op.dst->delta;
6984 rz_list_foreach (otypes,
iter, tpath) {
6987 if (!strcmp(struct_member, tpath->
path)) {
7084 ut64 section_end =
map->itv.addr +
map->itv.size;
7086 if (fcn->
addr >=
map->itv.addr && (fcn->
addr +
s) < section_end) {
7142 case RZ_CORE_ANALYSIS_NAME_TYPE_VAR:
7143 case RZ_CORE_ANALYSIS_NAME_TYPE_FUNCTION:
7144 case RZ_CORE_ANALYSIS_NAME_TYPE_FLAG:
7145 case RZ_CORE_ANALYSIS_NAME_TYPE_ADDRESS:
7181 bool result =
false;
7211 RzCoreAnalysisName *
p =
RZ_NEW0(RzCoreAnalysisName);
7224 p->type = RZ_CORE_ANALYSIS_NAME_TYPE_VAR;
7226 p->offset =
op.addr;
7231 p->type = RZ_CORE_ANALYSIS_NAME_TYPE_FUNCTION;
7233 p->offset = tgt_addr;
7235 p->type = RZ_CORE_ANALYSIS_NAME_TYPE_FLAG;
7238 p->offset = tgt_addr;
7240 p->type = RZ_CORE_ANALYSIS_NAME_TYPE_ADDRESS;
7241 p->offset = tgt_addr;
RZ_API void rz_analysis_function_add_block(RzAnalysisFunction *fcn, RzAnalysisBlock *bb)
RZ_API RzAnalysisFunction * rz_analysis_get_function_at(RzAnalysis *analysis, ut64 addr)
RZ_API ut64 rz_analysis_function_max_addr(RzAnalysisFunction *fcn)
RZ_API ut64 rz_analysis_function_size_from_entry(RzAnalysisFunction *fcn)
RZ_API bool rz_analysis_function_relocate(RzAnalysisFunction *fcn, ut64 addr)
RZ_API ut64 rz_analysis_function_linear_size(RzAnalysisFunction *fcn)
RZ_API ut64 rz_analysis_function_realsize(const RzAnalysisFunction *fcn)
RZ_API bool rz_analysis_add_function(RzAnalysis *analysis, RzAnalysisFunction *fcn)
RZ_API bool rz_analysis_function_rename(RzAnalysisFunction *fcn, const char *name)
RZ_API RzAnalysisFunction * rz_analysis_function_new(RzAnalysis *analysis)
RZ_API bool rz_analysis_function_delete(RzAnalysisFunction *fcn)
RZ_API ut64 rz_analysis_function_min_addr(RzAnalysisFunction *fcn)
RZ_API void rz_analysis_function_free(void *_fcn)
RZ_API bool rz_analysis_function_contains(RzAnalysisFunction *fcn, ut64 addr)
RZ_API RzList * rz_analysis_noreturn_functions(RzAnalysis *analysis)
RZ_API ut8 * rz_analysis_mask(RzAnalysis *analysis, ut32 size, const ut8 *data, ut64 at)
RZ_API int rz_analysis_archinfo(RzAnalysis *analysis, int query)
RZ_API bool rz_analysis_noreturn_add(RzAnalysis *analysis, const char *name, ut64 addr)
RZ_API bool cmd_analysis_objc(RzCore *core, bool auto_analysis)
RZ_API void rz_core_analysis_type_match(RzCore *core, RzAnalysisFunction *fcn, HtUU *loop_table)
RZ_API int rz_asm_op_get_size(RzAsmOp *op)
RZ_API void rz_asm_op_fini(RzAsmOp *op)
RZ_API void rz_asm_op_init(RzAsmOp *op)
RZ_API char * rz_asm_op_get_hex(RzAsmOp *op)
RZ_API void rz_asm_op_set_asm(RzAsmOp *op, const char *str)
RZ_API char * rz_asm_op_get_asm(RzAsmOp *op)
RZ_API ut8 * rz_reg_arena_peek(RzReg *reg)
RZ_API int rz_reg_arena_push(RzReg *reg)
RZ_API void rz_reg_arena_pop(RzReg *reg)
RZ_API void rz_reg_arena_zero(RzReg *reg, RzRegisterType type)
RZ_API void rz_reg_arena_poke(RzReg *reg, const ut8 *ret)
static const char * arg(RzAnalysis *a, csh *handle, cs_insn *insn, char *buf, int n)
RZ_API int sdb_array_add_num(Sdb *s, const char *key, ut64 val, ut32 cas)
RZ_API int sdb_array_push_num(Sdb *s, const char *key, ut64 num, ut32 cas)
RZ_API char * rz_asm_describe(RzAsm *a, const char *str)
RZ_API int rz_asm_set_pc(RzAsm *a, ut64 pc)
RZ_API int rz_asm_disassemble(RzAsm *a, RzAsmOp *op, const ut8 *buf, int len)
RZ_API char * sdb_encode(const ut8 *bin, int len)
RZ_DEPRECATE RZ_API RZ_BORROW RzList * rz_bin_get_entries(RZ_NONNULL RzBin *bin)
RZ_API RzBinObject * rz_bin_cur_object(RzBin *bin)
RZ_DEPRECATE RZ_API RZ_BORROW RzList * rz_bin_get_symbols(RZ_NONNULL RzBin *bin)
RZ_API RZ_BORROW RzBinSection * rz_bin_get_section_at(RzBinObject *o, ut64 off, int va)
Find the binary section at offset off.
RZ_API RZ_OWN char * rz_bin_demangle(RZ_NULLABLE RzBinFile *bf, RZ_NULLABLE const char *language, RZ_NULLABLE const char *symbol, ut64 vaddr, bool libs)
Demangles a symbol based on the language or the RzBinFile data.
RZ_API RzBinFile * rz_bin_cur(RzBin *bin)
static ut64 baddr(RzBinFile *bf)
static RzList * maps(RzBinFile *bf)
RzBinInfo * info(RzBinFile *bf)
RzList * sections(RzBinFile *bf)
static char * signature(RzBinFile *bf, bool json)
int bits(struct state *s, int need)
RZ_API RzAnalysisBlock * rz_analysis_block_chop_noreturn(RzAnalysisBlock *block, ut64 addr)
RZ_API void rz_analysis_block_ref(RzAnalysisBlock *bb)
RZ_API bool rz_analysis_block_recurse_depth_first(RzAnalysisBlock *block, RzAnalysisBlockCb cb, RZ_NULLABLE RzAnalysisBlockCb on_exit, void *user)
RZ_API RzAnalysisBlock * rz_analysis_get_block_at(RzAnalysis *analysis, ut64 addr)
RZ_API ut64 rz_analysis_block_get_op_addr(RzAnalysisBlock *block, size_t i)
RZ_API void rz_analysis_block_unref(RzAnalysisBlock *bb)
RZ_API RzList * rz_analysis_get_blocks_in(RzAnalysis *analysis, ut64 addr)
RZ_API RzAnalysisBlock * rz_analysis_find_most_relevant_block_in(RzAnalysis *analysis, ut64 off)
RZ_API bool rz_analysis_block_op_starts_at(RzAnalysisBlock *bb, ut64 addr)
RZ_API RZ_BORROW RzBinString * rz_bin_object_get_string_at(RZ_NONNULL RzBinObject *obj, ut64 address, bool is_va)
Return RzBinString if at address there is an entry in the RzBinObject string database.
RZ_API const RzBinAddr * rz_bin_object_get_special_symbol(RzBinObject *o, RzBinSpecialSymbol sym)
Return the RzBinAddr structure representing the special symbol sym.
RZ_API RzBinSymbol * rz_bin_object_get_symbol_of_import(RzBinObject *o, RzBinImport *imp)
Find the symbol that represents the given import This is necessary for example to determine the addre...
RZ_API ut64 rz_bin_object_get_vaddr(RzBinObject *o, ut64 paddr, ut64 vaddr)
static bool is_unknown_file(RzCore *core)
RZ_API void rz_core_analysis_function_strings_print(RZ_NONNULL RzCore *core, RZ_NONNULL RzAnalysisFunction *fcn, RZ_NULLABLE PJ *pj)
Print all string flags referenced by the function.
RZ_IPI void rz_core_analysis_bb_info_print(RzCore *core, RzAnalysisBlock *bb, ut64 addr, RzCmdStateOutput *state)
RZ_API RzGraph * rz_core_analysis_codexrefs(RzCore *core, ut64 addr)
RZ_API void rz_core_analysis_fcn_merge(RzCore *core, ut64 addr, ut64 addr2)
static bool is_apple_target(RzCore *core)
RZ_IPI char * rz_core_analysis_all_vars_display(RzCore *core, RzAnalysisFunction *fcn, bool add_name)
RZ_API RzList * rz_core_analysis_fcn_get_calls(RzCore *core, RzAnalysisFunction *fcn)
RZ_API char * rz_core_analysis_fcn_name(RzCore *core, RzAnalysisFunction *fcn)
RZ_IPI void rz_core_analysis_cc_print(RzCore *core, RZ_NONNULL const char *cc, RZ_NULLABLE PJ *pj)
Print Calling Convention info.
RZ_API RZ_OWN RzPVector * rz_core_analysis_bytes(RZ_NONNULL RzCore *core, RZ_NONNULL const ut8 *buf, int len, int nops)
RZ_API void rz_core_analysis_hint_print(RzAnalysis *a, ut64 addr, RzCmdStateOutput *state)
RZ_API void rz_core_recover_vars(RzCore *core, RzAnalysisFunction *fcn, bool argonly)
static char * getFunctionName(RzCore *core, ut64 addr)
static char * get_title(ut64 addr)
static bool archIsThumbable(RzCore *core)
RZ_API bool rz_core_analysis_esil_trace_stop(RzCore *core)
Stop ESIL trace session.
RZ_API int rz_core_analysis_fcn_clean(RzCore *core, ut64 addr)
RZ_API int rz_core_print_bb_custom(RzCore *core, RzAnalysisFunction *fcn)
RZ_API void rz_core_analysis_sigdb_print(RZ_NONNULL RzCore *core, RZ_NONNULL RzTable *table)
Adds all the signatures to a RzTable structure.
RZ_API RzList * rz_core_analysis_graph_to(RzCore *core, ut64 addr, int n)
static void analPathFollow(RzCoreAnalPaths *p, ut64 addr, PJ *pj)
RZ_API int rz_core_analysis_all(RzCore *core)
static bool add_mmio_extended_flag_cb(void *user, const ut64 addr, const void *v)
static int esilbreak_mem_write(RzAnalysisEsil *esil, ut64 addr, const ut8 *buf, int len)
static int rz_analysis_analyze_fcn_refs(RzCore *core, RzAnalysisFunction *fcn, int depth)
static bool reanalyze_fcns_cb(void *u, const ut64 k, const void *v)
static char * palColorFor(const char *k)
RZ_API void rz_core_analysis_stats_free(RzCoreAnalysisStats *s)
static void cccb(void *u)
RZ_IPI void rz_core_analysis_bbs_asciiart(RzCore *core, RzAnalysisFunction *fcn)
RZ_IPI char * rz_core_analysis_var_display(RzCore *core, RzAnalysisVar *var, bool add_name)
static int find_sym_flag(const void *a1, const void *a2)
bool print_arch_hint_cb(ut64 addr, RZ_NULLABLE const char *arch, void *user)
static void set_fcn_name_from_flag(RzAnalysisFunction *fcn, RzFlagItem *f, const char *fcnpfx)
RZ_API bool rz_core_analysis_continue_until_call(RZ_NONNULL RzCore *core)
Continue until call.
RZ_API ut64 rz_core_analysis_address(RzCore *core, ut64 addr)
RZ_API void rz_core_analysis_type_init(RzCore *core)
static bool stringAt(RzCore *core, ut64 addr)
RZ_IPI int bb_cmpaddr(const void *_a, const void *_b)
RZ_API void rz_core_analysis_undefine(RzCore *core, ut64 off)
RZ_API bool rz_core_analysis_function_add(RzCore *core, const char *name, ut64 addr, bool analyze_recursively)
static void add_string_ref(RzCore *core, ut64 xref_from, ut64 xref_to)
RZ_API int rz_core_analysis_search(RzCore *core, ut64 from, ut64 to, ut64 ref, int mode)
RZ_API void rz_core_analysis_cc_init(RzCore *core)
RZ_IPI bool rz_core_analysis_function_delete_var(RzCore *core, RzAnalysisFunction *fcn, RzAnalysisVarKind kind, const char *id)
static bool rz_analysis_try_get_fcn(RzCore *core, RzAnalysisXRef *xref, int fcndepth, int refdepth)
RZ_API bool rz_analysis_add_device_peripheral_map(RzBinObject *o, RzAnalysis *analysis)
Maps the device peripherals as sections.
static int RzAnalysisRef_cmp(const RzAnalysisXRef *xref1, const RzAnalysisXRef *xref2)
RZ_IPI bool rz_core_analysis_function_set_signature(RzCore *core, RzAnalysisFunction *fcn, const char *newsig)
RZ_API void rz_core_analysis_coderefs(RzCore *core, ut64 addr)
RZ_API RZ_OWN RzCoreAnalysisStats * rz_core_analysis_get_stats(RZ_NONNULL RzCore *core, ut64 from, ut64 to, ut64 step)
static bool isValidSymbol(RzBinSymbol *symbol)
RZ_API void rz_core_analysis_callgraph(RzCore *core, ut64 addr, int fmt)
RZ_API void rz_core_analysis_flag_every_function(RzCore *core)
static ut64 esilbreak_last_read
RZ_API void rz_core_analysis_datarefs(RzCore *core, ut64 addr)
static int casecmp(const void *_a, const void *_b)
bool print_bits_hint_cb(ut64 addr, int bits, void *user)
RZ_API void rz_core_analysis_hint_list_print(RzAnalysis *a, RzCmdStateOutput *state)
static char * getFunctionNamePrefix(RzCore *core, ut64 off, const char *name)
static bool add_arch_platform_flag_comment_cb(void *user, const ut64 addr, const void *v)
RZ_API RzAnalysisOp * rz_core_analysis_op(RzCore *core, ut64 addr, int mask)
static bool get_next_i(IterCtx *ctx, size_t *next_i)
static bool analysis_block_on_exit(RzAnalysisBlock *bb, BlockRecurseCtx *ctx)
static bool is_valid_xref(RzCore *core, ut64 xref_to, RzAnalysisXRefType type, int cfg_debug)
Validates a xref. Mainly checks if it points out of the memory map.
static bool isSkippable(RzBinSymbol *s)
static void function_rename(RzFlag *flags, RzAnalysisFunction *fcn)
RZ_API void rz_core_analysis_autoname_all_fcns(RzCore *core)
static void bb_info_print(RzCore *core, RzAnalysisFunction *fcn, RzAnalysisBlock *bb, ut64 addr, RzOutputMode mode, PJ *pj, RzTable *t)
RZ_API bool rz_platform_index_add_flags_comments(RzCore *core)
Adds the information from the Platform Profiles as flags and comments.
RZ_API bool rz_core_analysis_continue_until_syscall(RZ_NONNULL RzCore *core)
Continue until syscall.
static void relocation_function_process_noreturn(RzCore *core, RzAnalysisBlock *b, SetU *todo, ut64 opsize, ut64 reladdr, ut64 addr)
static int __core_analysis_fcn(RzCore *core, ut64 at, ut64 from, int reftype, int depth)
static char * core_analysis_graph_label(RzCore *core, RzAnalysisBlock *bb, int opts)
RZ_API st64 rz_core_analysis_code_count(RZ_NONNULL RzCore *core)
Compute analysis code count.
RZ_IPI void rz_core_analysis_value_pointers(RzCore *core, RzOutputMode mode)
RZ_API bool rz_core_analysis_everything(RzCore *core, bool experimental, char *dh_orig)
static bool analysis_block_cb(RzAnalysisBlock *bb, BlockRecurseCtx *ctx)
static int core_analysis_graph_nodes(RzCore *core, RzAnalysisFunction *fcn, int opts, PJ *pj)
RZ_API RzList * rz_core_analysis_cycles(RzCore *core, int ccl)
RZ_API ut64 rz_core_analysis_stats_get_block_from(RZ_NONNULL const RzCoreAnalysisStats *s, size_t i)
RZ_API int rz_core_get_stacksz(RzCore *core, ut64 from, ut64 to)
static void _CbInRangeAav(RzCore *core, ut64 from, ut64 to, int vsize, void *user)
static void autoname_imp_trampoline(RzCore *core, RzAnalysisFunction *fcn)
RZ_API RZ_BORROW const char * rz_core_analysis_name_type_to_str(RzCoreAnalysisNameType typ)
Convert typ to string (const char*)
RZ_API int rz_core_analysis_search_xrefs(RZ_NONNULL RzCore *core, ut64 from, ut64 to)
Searches for xrefs in the range of the paramters 'from' and 'to'.
RZ_IPI char * rz_core_analysis_function_signature(RzCore *core, RzOutputMode mode, char *fcn_name)
RZ_API bool rz_core_analysis_esil_trace_start(RzCore *core)
Start ESIL trace session.
static int esilbreak_reg_write(RzAnalysisEsil *esil, const char *name, ut64 *val)
static bool blacklisted_word(const char *name)
static const char * reg_name_for_access(RzAnalysisOp *op, RzAnalysisVarAccessType type)
RZ_API void rz_core_analysis_esil(RzCore *core, ut64 addr, ut64 size, RZ_NULLABLE RzAnalysisFunction *fcn)
static bool core_search_for_xrefs_in_boundaries(RzCore *core, ut64 from, ut64 to)
RZ_IPI bool rz_core_analysis_types_propagation(RzCore *core)
RZ_IPI void rz_core_analysis_bbs_info_print(RzCore *core, RzAnalysisFunction *fcn, RzCmdStateOutput *state)
RZ_API RZ_OWN RzList * rz_core_analysis_sigdb_list(RZ_NONNULL RzCore *core, bool with_details)
Returns all the signatures found in the default path.
RZ_API void rz_core_analysis_propagate_noreturn(RzCore *core, ut64 addr)
static ut64 delta_for_access(RzAnalysisOp *op, RzAnalysisVarAccessType type)
static bool analyze_noreturn_function(RzCore *core, RzAnalysisFunction *f)
static void print_hint_tree(RBTree tree, RzCmdStateOutput *state)
static void print_hint_h_format(HintNode *node)
RZ_API void rz_core_analysis_propagate_noreturn_relocs(RzCore *core, ut64 addr)
RZ_API void rz_core_analysis_paths(RzCore *core, ut64 from, ut64 to, bool followCalls, int followDepth, bool is_json)
RZ_IPI void rz_core_analysis_function_signature_editor(RzCore *core, ut64 addr)
static int esilbreak_mem_read(RzAnalysisEsil *esil, ut64 addr, ut8 *buf, int len)
static char * is_string_at(RzCore *core, ut64 addr, int *olen)
static ut64 __opaddr(RzAnalysisBlock *b, ut64 addr)
RZ_API bool rz_core_analysis_function_rename(RzCore *core, ut64 addr, const char *_name)
RZ_API bool rz_core_analysis_graph(RzCore *core, ut64 addr, int opts)
static void getpcfromstack(RzCore *core, RzAnalysisEsil *esil)
static void analPaths(RzCoreAnalPaths *p, PJ *pj)
static void analysis_sigdb_add(RzSigDb *sigs, const char *path, bool with_details)
RZ_API st64 rz_core_analysis_coverage_count(RZ_NONNULL RzCore *core)
Compute analysis coverage count.
static bool analysis_path_exists(RzCore *core, ut64 from, ut64 to, RzList *bbs, int depth, HtUP *state, HtUP *avoid)
RZ_API st64 rz_core_analysis_calls_count(RZ_NONNULL RzCore *core)
Compute analysis function xrefs count.
RZ_API ut64 rz_core_analysis_stats_get_block_to(RZ_NONNULL const RzCoreAnalysisStats *s, size_t i)
RZ_IPI void rz_core_analysis_function_until(RzCore *core, ut64 addr_end)
int hint_node_cmp(const void *incoming, const RBNode *in_tree, void *user)
static RzList * recurse(RzCore *core, RzAnalysisBlock *from, RzAnalysisBlock *dest)
static bool process_reference_noreturn_cb(void *u, const ut64 k, const void *v)
RZ_API int rz_core_analysis_fcn(RzCore *core, ut64 at, ut64 from, int reftype, int depth)
static void rz_analysis_set_stringrefs(RzCore *core, RzAnalysisFunction *fcn)
RZ_API void rz_core_analysis_resolve_jumps(RZ_NONNULL RzCore *core)
Resolves any unresolved jump.
RZ_API void rz_analysis_bytes_free(RZ_NULLABLE void *ptr)
RZ_API bool rz_core_analysis_rename(RZ_NONNULL RzCore *core, RZ_NONNULL const char *name, ut64 addr)
Rename whatever var/flag/function is used at addr to name.
RZ_IPI bool rz_analysis_var_global_list_show(RzAnalysis *analysis, RzCmdStateOutput *state, RZ_NULLABLE const char *name)
RZ_API int rz_core_analysis_esil_fcn(RzCore *core, ut64 at, ut64 from, int reftype, int depth)
static void core_analysis_color_curr_node(RzCore *core, RzAnalysisBlock *bbi)
static int core_analysis_graph_construct_edges(RzCore *core, RzAnalysisFunction *fcn, int opts, PJ *pj, Sdb *DB)
static int is_string(const ut8 *buf, int size, int *len)
#define HINTCMD_ADDR(hint, fmt, x)
RZ_IPI int fcn_cmpaddr(const void *_a, const void *_b)
void hint_node_free(RBNode *node, void *user)
RZ_API int rz_core_print_bb_gml(RzCore *core, RzAnalysisFunction *fcn)
RZ_API int rz_core_search_value_in_range(RzCore *core, RzInterval search_itv, ut64 vmin, ut64 vmax, int vsize, inRangeCb cb, void *cb_user)
static int bb_cmp(const void *a, const void *b)
static void hint_node_print(HintNode *node, RzOutputMode mode, PJ *pj)
static int core_analysis_followptr(RzCore *core, int type, ut64 at, ut64 ptr, ut64 ref, int code, int depth)
static int check_rom_exists(const void *value, const void *data)
static void handle_var_stack_access(RzAnalysisEsil *esil, ut64 addr, RzAnalysisVarAccessType type, int len)
RZ_API RzGraph * rz_core_analysis_importxrefs(RzCore *core)
static bool block_flags_stat(RzFlagItem *fi, void *user)
RZ_API RZ_OWN RzCoreAnalysisName * rz_core_analysis_name(RZ_NONNULL RzCore *core, ut64 addr)
Get information on whatever var/flag/function is used at addr.
static void sdb_concat_by_path(Sdb *s, const char *path)
RZ_API int rz_core_analysis_data(RzCore *core, ut64 addr, int count, int depth, int wordsize)
RZ_API RZ_OWN char * rz_core_analysis_function_autoname(RZ_NONNULL RzCore *core, RZ_NONNULL RzAnalysisFunction *fcn)
Suggest a name for the function.
static bool esil_analysis_stop
bool print_addr_hint_cb(ut64 addr, const RzVector *records, void *user)
static bool is_entry_flag(RzFlagItem *f)
static RzList * analysis_graph_to(RzCore *core, ut64 addr, int depth, HtUP *avoid)
static RzList * recurse_bb(RzCore *core, ut64 addr, RzAnalysisBlock *dest)
RZ_API bool rz_core_analysis_sigdb_apply(RZ_NONNULL RzCore *core, RZ_NULLABLE int *n_applied, RZ_NULLABLE const char *filter)
tries to apply the signatures in the flirt.sigdb.path
static RzAnalysisBlock * find_block_at_xref_addr(RzCore *core, ut64 addr)
static bool add_mmio_flag_cb(void *user, const ut64 addr, const void *v)
static ut64 esilbreak_last_data
static void set_new_xref(RzCore *core, ut64 xref_from, ut64 xref_to, RzAnalysisXRefType type, bool decode_str)
Sets a new xref according to the given to and from addresses.
static bool is_skippable_addr(RzCore *core, ut64 addr)
static bool opiscall(RzCore *core, RzAnalysisOp *aop, ut64 addr, const ut8 *buf, int len, int arch)
static int find_bb(ut64 *addr, RzAnalysisBlock *bb)
static void loganalysis(ut64 from, ut64 to, int depth)
static void add_single_addr_xrefs(RzCore *core, ut64 addr, RzGraph *graph)
RZ_API bool rz_core_analysis_bb_seek(RzCore *core, ut64 addr)
RZ_API void rz_core_analysis_name_free(RZ_NULLABLE RzCoreAnalysisName *p)
static bool isValidAddress(RzCore *core, ut64 addr)
static bool myvalid(RzIO *io, ut64 addr)
RZ_IPI void rz_core_analysis_fcn_returns(RzCore *core, RzAnalysisFunction *fcn)
static int core_analysis_graph_construct_nodes(RzCore *core, RzAnalysisFunction *fcn, int opts, PJ *pj, Sdb *DB)
RZ_API bool rz_core_analysis_refs(RZ_NONNULL RzCore *core, size_t nbytes)
Analyze xrefs and prints the result.
RZ_API bool rz_core_analysis_hint_set_offset(RZ_NONNULL RzCore *core, RZ_NONNULL const char *struct_member)
Set analysis hint for the first immediate of the instruction at current offset to struct_member.
RZ_IPI bool rz_core_analysis_var_rename(RzCore *core, const char *name, const char *newname)
RZ_API void rz_platform_profile_add_flag_every_io(RzPlatformProfile *profile, RzFlag *flags)
Adds the IO and extended IO registers from the CPU profiles as flags.
static bool process_refs_cb(void *u, const ut64 k, const void *v)
static bool printAnalPaths(RzCoreAnalPaths *p, PJ *pj)
static const char * RzCoreAnalysisNameTypeStrs[]
static ut64 * next_append(ut64 *next, int *nexti, ut64 v)
static void relocation_noreturn_process(RzCore *core, RzList *noretl, SetU *todo, RzAnalysisBlock *b, RzBinReloc *rel, ut64 opsize, ut64 addr)
RZ_API RZ_OWN RzList * rz_core_get_func_args(RzCore *core, const char *fcn_name)
RZ_API char * resolve_fcn_name(RzAnalysis *analysis, const char *func_name)
RZ_API bool rz_analysis_cc_set(RzAnalysis *analysis, const char *expr)
RZ_API const char * rz_analysis_cc_arg(RzAnalysis *analysis, const char *convention, int n)
RZ_API const char * rz_analysis_cc_self(RzAnalysis *analysis, const char *convention)
RZ_API const char * rz_analysis_cc_default(RzAnalysis *analysis)
RZ_API int rz_analysis_cc_max_arg(RzAnalysis *analysis, const char *cc)
RZ_API const char * rz_analysis_cc_error(RzAnalysis *analysis, const char *convention)
RZ_API const char * rz_analysis_cc_ret(RzAnalysis *analysis, const char *convention)
RZ_API bool rz_core_is_debug(RzCore *core)
Check whether the core is in debug mode (equivalent to cfg.debug)
RZ_IPI void rz_core_analysis_esil_references_all_functions(RzCore *core)
RZ_API void rz_core_analysis_esil_init_mem(RZ_NONNULL RzCore *core, RZ_NULLABLE const char *name, ut64 addr, ut32 size)
RZ_IPI void rz_core_analysis_esil_init(RzCore *core)
RZ_API void rz_core_analysis_esil_reinit(RZ_NONNULL RzCore *core)
Reinitialize ESIL.
RZ_API void rz_core_analysis_esil_init_mem_del(RZ_NONNULL RzCore *core, RZ_NULLABLE const char *name, ut64 addr, ut32 size)
Remove ESIL VM stack.
RZ_API void rz_core_seek_arch_bits(RzCore *core, ut64 addr)
RZ_API void rz_analysis_class_recover_all(RzAnalysis *analysis)
RZ_API char * rz_core_cmd_strf(RzCore *core, const char *fmt,...)
RZ_API char * rz_core_cmd_str(RzCore *core, const char *cmd)
Executes a rizin command and returns the stdout as a string.
RZ_API void rz_core_analysis_calls(RZ_NONNULL RzCore *core, bool imports_only)
RZ_API int rz_core_esil_step(RzCore *core, ut64 until_addr, const char *until_expr, ut64 *prev_addr, bool stepOver)
RZ_API void rz_cmd_state_output_set_columnsf(RzCmdStateOutput *state, const char *fmt,...)
Specify the columns of the command output.
RZ_API void rz_cmd_state_output_array_start(RzCmdStateOutput *state)
Mark the start of an array of elements in the output.
RZ_API void rz_cmd_state_output_array_end(RzCmdStateOutput *state)
Mark the end of an array of elements in the output.
RZ_API void rz_core_debug_clear_register_flags(RzCore *core)
RZ_API RZ_OWN RzList * rz_core_get_boundaries_prot(RzCore *core, int perm, const char *mode, const char *prefix)
RZ_API int rz_core_search_preludes(RzCore *core, bool log)
RZ_API ut64 rz_config_get_i(RzConfig *cfg, RZ_NONNULL const char *name)
RZ_API bool rz_config_get_b(RzConfig *cfg, RZ_NONNULL const char *name)
RZ_API RzConfigNode * rz_config_set(RzConfig *cfg, RZ_NONNULL const char *name, const char *value)
RZ_API RzConfigNode * rz_config_set_i(RzConfig *cfg, RZ_NONNULL const char *name, const ut64 i)
RZ_API RZ_BORROW const char * rz_config_get(RzConfig *cfg, RZ_NONNULL const char *name)
RZ_API RzConfigNode * rz_config_set_b(RzConfig *cfg, RZ_NONNULL const char *name, bool value)
RZ_API int rz_cons_get_size(int *rows)
RZ_API RzCons * rz_cons_singleton(void)
RZ_API void rz_cons_clear_line(int std_err)
RZ_API void rz_cons_newline(void)
RZ_API void rz_cons_break_pop(void)
RZ_API void rz_cons_break_push(RzConsBreak cb, void *user)
RZ_API int rz_cons_printf(const char *format,...)
RZ_API bool rz_cons_is_breaked(void)
RZ_API void rz_cons_println(const char *str)
RZ_API bool rz_core_analysis_recover_golang_functions(RzCore *core)
reads pclntab table in go binaries and recovers functions. Follows the code https://github....
RZ_API void rz_core_analysis_resolve_golang_strings(RzCore *core)
Attempts to recover all golang string.
RZ_IPI void rz_core_asm_bb_middle(RZ_NONNULL RzCore *core, ut64 at, RZ_INOUT RZ_NONNULL int *oplen, RZ_NONNULL int *ret)
Update oplen by "asm.bb.middle" and "asm.flags.middle".
RZ_IPI bool rz_disasm_check_end(int nb_opcodes, int i_opcodes, int nb_bytes, int i_bytes)
Is i_opcodes < nb_opcodes and i_bytes < nb_bytes ?
RZ_API void rz_core_reg_update_flags(RzCore *core)
Update or create flags for all registers where it makes sense.
RZ_API ut8 rz_core_flirt_arch_from_name(RZ_NONNULL const char *arch)
Returns the FLIRT arch id from a given arch name Returns RZ_FLIRT_SIG_ARCH_ANY if name is not found.
RZ_API void rz_analysis_cycle_frame_free(RzAnalysisCycleFrame *cf)
RZ_API RzAnalysisCycleFrame * rz_analysis_cycle_frame_new(void)
static static fork const void static count static fd const char const char static newpath const char static path const char path
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 nbytes
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void count
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void static offset struct stat static buf void long static basep static whence static length const void static len static semflg const void static shmflg const struct timespec struct timespec static rem const char static group const void start
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags cmd
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void static offset struct stat static buf void long static basep static whence static length const void static len key
RZ_API RzAnalysisData * rz_analysis_data(RzAnalysis *analysis, ut64 addr, const ut8 *buf, int size, int wordsize)
RZ_API void rz_analysis_data_free(RzAnalysisData *d)
RZ_API char * rz_analysis_data_to_string(RzAnalysisData *d, RzConsPrintablePalette *pal)
RZ_DEPRECATE RZ_API bool rz_bin_addr2line(RzBin *bin, ut64 addr, char *file, int len, int *line)
RZ_API RZ_OWN RzDiff * rz_diff_lines_new(RZ_BORROW const char *a, RZ_BORROW const char *b, RZ_NULLABLE RzDiffIgnoreLine ignore)
Returns the structure needed to diff lines.
RZ_API void rz_diff_free(RZ_NULLABLE RzDiff *diff)
frees the diff structure
RZ_API int rz_core_print_disasm_json(RzCore *core, ut64 addr, ut8 *buf, int nb_bytes, int nb_opcodes, PJ *pj)
RZ_API int rz_core_print_disasm(RZ_NONNULL RzCore *core, ut64 addr, RZ_NONNULL ut8 *buf, int len, int nlines, RZ_NULLABLE RzCmdStateOutput *state, RZ_NULLABLE RzCoreDisasmOptions *options)
Disassemble len bytes and nlines opcodes restricted by len and nlines at the same time.
RZ_API RzDebugMap * rz_debug_map_get(RzDebug *dbg, ut64 addr)
RZ_API void rz_analysis_dwarf_integrate_functions(RzAnalysis *analysis, RzFlag *flags, Sdb *dwarf_sdb)
Use parsed DWARF function info from Sdb in the function analysis XXX right now we only save parsed na...
static states step(struct re_guts *, sopno, sopno, states, int, states)
size_t map(int syms, int left, int len)
RZ_API void rz_analysis_esil_stack_free(RzAnalysisEsil *esil)
RZ_API bool rz_analysis_esil_set_pc(RzAnalysisEsil *esil, ut64 addr)
RZ_API bool rz_analysis_esil_parse(RzAnalysisEsil *esil, const char *str)
RZ_API RzAnalysisEsilTrace * rz_analysis_esil_trace_new(RzAnalysisEsil *esil)
RZ_API void rz_analysis_esil_trace_free(RzAnalysisEsilTrace *trace)
RZ_API void rz_analysis_fcn_invalidate_read_ahead_cache(void)
RZ_API int rz_analysis_function_resize(RzAnalysisFunction *fcn, int newsize)
RZ_API int rz_analysis_fcn_del(RzAnalysis *a, ut64 addr)
RZ_DEPRECATE RZ_API RzAnalysisFunction * rz_analysis_get_fcn_in(RzAnalysis *analysis, ut64 addr, int type)
RZ_API RzAnalysisFunction * rz_analysis_get_function_byname(RzAnalysis *a, const char *name)
RZ_DEPRECATE RZ_API RzAnalysisFunction * rz_analysis_get_fcn_in_bounds(RzAnalysis *analysis, ut64 addr, int type)
RZ_API bool rz_analysis_function_set_type_str(RzAnalysis *a, RZ_NONNULL RzAnalysisFunction *f, RZ_NONNULL const char *sig)
Parses the function type and sets it for the given function.
RZ_API const char * rz_analysis_fcntype_tostring(int type)
RZ_API int rz_analysis_fcn(RzAnalysis *analysis, RzAnalysisFunction *fcn, ut64 addr, ut64 len, int reftype)
RZ_API bool rz_analysis_check_fcn(RzAnalysis *analysis, ut8 *buf, ut16 bufsz, ut64 addr, ut64 low, ut64 high)
RZ_API void rz_analysis_function_check_bp_use(RzAnalysisFunction *fcn)
RZ_API int rz_analysis_fcn_del_locs(RzAnalysis *analysis, ut64 addr)
RZ_API RZ_OWN char * rz_analysis_function_get_signature(RZ_NONNULL RzAnalysisFunction *function)
RZ_API int rz_flag_rename(RzFlag *f, RzFlagItem *item, const char *name)
RZ_API RzFlagItem * rz_flag_get_i(RzFlag *f, ut64 off)
RZ_API int rz_flag_count(RzFlag *f, const char *glob)
RZ_API void rz_flag_foreach_range(RZ_NONNULL RzFlag *f, ut64 from, ut64 to, RzFlagItemCb cb, void *user)
RZ_API void rz_flag_unset_all_in_space(RzFlag *f, const char *space_name)
Unset all flag items in the space with the given name.
RZ_API RzFlagItem * rz_flag_set_next(RzFlag *f, const char *name, ut64 off, ut32 size)
RZ_API const RzList * rz_flag_get_list(RzFlag *f, ut64 off)
RZ_API RzFlagItem * rz_flag_get_at(RzFlag *f, ut64 off, bool closest)
RZ_API RzFlagItem * rz_flag_get(RzFlag *f, const char *name)
RZ_API RzFlagItem * rz_flag_set(RzFlag *f, const char *name, ut64 off, ut32 size)
RZ_API bool rz_flag_unset_name(RzFlag *f, const char *name)
RZ_API RzFlagItem * rz_flag_get_by_spaces(RzFlag *f, ut64 off,...)
RZ_API char * sdb_fmt(const char *fmt,...)
RZ_API bool rz_type_atomic_str_eq(const RzTypeDB *typedb, RZ_NONNULL const RzType *typ1, RZ_NONNULL const char *name)
Checks if two atomic types (RzType and RzBaseType) are equivalent.
RZ_API bool rz_type_is_strictly_atomic(const RzTypeDB *typedb, RZ_NONNULL const RzType *type)
Checks if the RzType is strictly atomic.
RZ_API RZ_NULLABLE const RzVector * rz_analysis_addr_hints_at(RzAnalysis *analysis, ut64 addr)
RZ_API RzAnalysisHint * rz_analysis_hint_get(RzAnalysis *a, ut64 addr)
RZ_API void rz_analysis_addr_hints_foreach(RzAnalysis *analysis, RzAnalysisAddrHintRecordsCb cb, void *user)
RZ_API void rz_analysis_arch_hints_foreach(RzAnalysis *analysis, RzAnalysisArchHintCb cb, void *user)
RZ_API void rz_analysis_hint_set_bits(RzAnalysis *a, ut64 addr, int bits)
RZ_API void rz_analysis_hint_free(RzAnalysisHint *h)
RZ_API int rz_analysis_hint_bits_at(RzAnalysis *analysis, ut64 addr, RZ_NULLABLE ut64 *hint_addr)
RZ_API RZ_NULLABLE RZ_BORROW const char * rz_analysis_hint_arch_at(RzAnalysis *analysis, ut64 addr, RZ_NULLABLE ut64 *hint_addr)
RZ_API void rz_analysis_bits_hints_foreach(RzAnalysis *analysis, RzAnalysisBitsHintCb cb, void *user)
RZ_API void rz_analysis_hint_set_offset(RzAnalysis *a, ut64 addr, const char *typeoff)
RZ_API void rz_config_hold_restore(RzConfigHold *h)
Restore whatever config options were previously saved in h.
RZ_API RzConfigHold * rz_config_hold_new(RzConfig *cfg)
Create an opaque object to save/restore some configuration options.
RZ_API bool rz_config_hold_i(RzConfigHold *h,...)
Save the current values of a list of config options that have integer values.
RZ_API void rz_config_hold_free(RzConfigHold *h)
Free a RzConfigHold object h.
RZ_API void Ht_() free(HtName_(Ht) *ht)
RZ_API const KEY_TYPE bool * found
return memset(p, 0, total)
memcpy(mem, inblock.get(), min(CONTAINING_RECORD(inblock.get(), MEMBLOCK, data) ->size, size))
RZ_API RzAnalysisOp * rz_core_op_analysis(RzCore *core, ut64 addr, RzAnalysisOpMask mask)
RZ_API RZ_OWN char * rz_core_editor(const RzCore *core, RZ_NULLABLE const char *file, RZ_NULLABLE const char *str)
RZ_API RzTable * rz_core_table(RzCore *core)
RZ_API RzBinReloc * rz_core_getreloc(RzCore *core, ut64 addr, int size)
RZ_API void rz_core_notify_begin(RZ_NONNULL RzCore *core, RZ_NONNULL const char *format,...)
Prints a message definining the beginning of a task.
RZ_API RzFlagItem * rz_core_flag_get_by_spaces(RzFlag *f, ut64 off)
RZ_API void rz_core_notify_done(RZ_NONNULL RzCore *core, RZ_NONNULL const char *format,...)
Prints a message definining the end of a task which succeeded.
static void list(RzEgg *egg)
RZ_API RZ_BORROW RzListIter * rz_list_find(RZ_NONNULL const RzList *list, const void *p, RZ_NONNULL RzListComparator cmp)
Returns RzListIter element which matches via the RzListComparator.
RZ_API RZ_BORROW RzListIter * rz_list_contains(RZ_NONNULL const RzList *list, RZ_NONNULL const void *ptr)
Returns the RzListIter of the given pointer, if found.
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.
RZ_API RZ_BORROW RzListIter * rz_list_prepend(RZ_NONNULL RzList *list, void *data)
Appends at the beginning of the list a new element.
RZ_API RZ_OWN RzList * rz_list_newf(RzListFree f)
Returns a new initialized RzList pointer and sets the free method.
RZ_API void rz_list_delete(RZ_NONNULL RzList *list, RZ_NONNULL RzListIter *iter)
Removes an entry in the list by using the RzListIter pointer.
RZ_API RZ_OWN RzList * rz_list_clone(RZ_NONNULL const RzList *list)
Shallow copies of the list (but doesn't free its elements)
RZ_API RZ_OWN void * rz_list_pop(RZ_NONNULL RzList *list)
Removes and returns the last element of the list.
RZ_API RZ_OWN RzList * rz_list_new(void)
Returns a new initialized RzList pointer (free method is not initialized)
RZ_API void rz_list_sort(RZ_NONNULL RzList *list, RZ_NONNULL RzListComparator cmp)
Sorts via merge sort or via insertion sort a list.
RZ_API RZ_BORROW void * rz_list_first(RZ_NONNULL const RzList *list)
Returns the first element of the list.
RZ_API RZ_BORROW void * rz_list_last(RZ_NONNULL const RzList *list)
Returns the last element of the list.
RZ_API RZ_BORROW void * rz_list_get_n(RZ_NONNULL const RzList *list, ut32 n)
Returns the N-th element of the list.
RZ_API RZ_BORROW RzListIter * rz_list_push(RZ_NONNULL RzList *list, void *item)
Alias for rz_list_append.
RZ_API ut32 rz_list_length(RZ_NONNULL const RzList *list)
Returns the length of the list.
RZ_API RZ_BORROW RzListIter * rz_list_append(RZ_NONNULL RzList *list, void *data)
Appends at the end of the list a new element.
RZ_API void rz_list_free(RZ_NONNULL RzList *list)
Empties the list and frees the list pointer.
RZ_API void rz_list_purge(RZ_NONNULL RzList *list)
Empties the list without freeing the list pointer.
void * realloc(void *ptr, size_t size)
void * malloc(size_t size)
void * calloc(size_t number, size_t size)
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")
#define ls_foreach(list, it, pos)
RZ_API Sdb * sdb_ns(Sdb *s, const char *name, int create)
RZ_API int sdb_num_set(Sdb *s, const char *key, ut64 v, ut32 cas)
RZ_API void rz_analysis_op_free(void *op)
RZ_API bool rz_analysis_op_fini(RzAnalysisOp *op)
RZ_API const char * rz_analysis_optype_to_string(int type)
RZ_API RzAnalysisOp * rz_analysis_op_new(void)
RZ_API int rz_analysis_op(RzAnalysis *analysis, RzAnalysisOp *op, ut64 addr, const ut8 *data, int len, RzAnalysisOpMask mask)
insn_type_descr_t types[]
RZ_API RzColor rz_cons_pal_get(const char *key)
RZ_API bool rz_parse_filter(RzParse *p, ut64 addr, RzFlag *f, RzAnalysisHint *hint, char *data, char *str, int len, bool big_endian)
filter the opcode in data into str by following the flags and hints information
RZ_API char * rz_parse_pseudocode(RzParse *p, const char *assembly)
Converts the assembly line into pseudocode.
RZ_API bool rz_parse_subvar(RzParse *p, RZ_NULLABLE RzAnalysisFunction *f, RZ_NONNULL RzAnalysisOp *op, RZ_NONNULL RZ_IN char *data, RZ_BORROW RZ_NONNULL RZ_OUT char *str, int len)
RZ_API char * rz_reg_profile_to_cc(RzReg *reg)
RZ_API ut64 rz_reg_getv(RzReg *reg, const char *name)
RZ_API RzRegItem * rz_reg_get(RzReg *reg, const char *name, int type)
RZ_API const char * rz_reg_get_name(RzReg *reg, int role)
RZ_API RzRegItem * rz_reg_index_get(RzReg *reg, int idx)
RZ_API ut64 rz_reg_setv(RzReg *reg, const char *name, ut64 val)
RZ_API RzRegSet * rz_reg_regset_get(RzReg *r, int type)
static void repeat(struct parse *, sopno, int, int)
RZ_API char * rz_cons_rgb_tostring(ut8 r, ut8 g, ut8 b)
#define RZ_ANALYSIS_ADDR_TYPE_STACK
#define RZ_ANALYSIS_ADDR_TYPE_SEQUENCE
#define RZ_ANALYSIS_ADDR_TYPE_ASCII
#define RZ_ANALYSIS_ARCHINFO_ALIGN
@ RZ_ANALYSIS_DIFF_TYPE_MATCH
@ RZ_ANALYSIS_DIFF_TYPE_UNMATCH
@ RZ_ANALYSIS_FCN_TYPE_SYM
@ RZ_ANALYSIS_FCN_TYPE_LOC
@ RZ_ANALYSIS_FCN_TYPE_NULL
@ RZ_ANALYSIS_FCN_TYPE_FCN
#define RZ_ANALYSIS_ADDR_TYPE_EXEC
@ RZ_ANALYSIS_STACK_RESET
@ RZ_ANALYSIS_XREF_TYPE_CODE
@ RZ_ANALYSIS_XREF_TYPE_NULL
@ RZ_ANALYSIS_XREF_TYPE_STRING
@ RZ_ANALYSIS_XREF_TYPE_CALL
@ RZ_ANALYSIS_XREF_TYPE_DATA
@ RZ_ANALYSIS_ADDR_HINT_TYPE_SYNTAX
@ RZ_ANALYSIS_ADDR_HINT_TYPE_PTR
@ RZ_ANALYSIS_ADDR_HINT_TYPE_SIZE
@ RZ_ANALYSIS_ADDR_HINT_TYPE_STACKFRAME
@ RZ_ANALYSIS_ADDR_HINT_TYPE_HIGH
@ RZ_ANALYSIS_ADDR_HINT_TYPE_ESIL
@ RZ_ANALYSIS_ADDR_HINT_TYPE_NEW_BITS
@ RZ_ANALYSIS_ADDR_HINT_TYPE_TYPE_OFFSET
@ RZ_ANALYSIS_ADDR_HINT_TYPE_JUMP
@ RZ_ANALYSIS_ADDR_HINT_TYPE_OPTYPE
@ RZ_ANALYSIS_ADDR_HINT_TYPE_RET
@ RZ_ANALYSIS_ADDR_HINT_TYPE_IMMBASE
@ RZ_ANALYSIS_ADDR_HINT_TYPE_NWORD
@ RZ_ANALYSIS_ADDR_HINT_TYPE_FAIL
@ RZ_ANALYSIS_ADDR_HINT_TYPE_OPCODE
@ RZ_ANALYSIS_ADDR_HINT_TYPE_VAL
#define RZ_ANALYSIS_ADDR_TYPE_HEAP
#define RZ_ANALYSIS_ADDR_TYPE_FLAG
#define RZ_ANALYSIS_ADDR_TYPE_LIBRARY
@ RZ_ANALYSIS_DATA_TYPE_STRING
@ RZ_ANALYSIS_DATA_TYPE_POINTER
#define RZ_ANALYSIS_ADDR_TYPE_REG
#define RZ_ANALYSIS_ADDR_TYPE_WRITE
@ RZ_ANALYSIS_VAR_ACCESS_TYPE_READ
@ RZ_ANALYSIS_VAR_ACCESS_TYPE_WRITE
@ RZ_ANALYSIS_VAR_ACCESS_TYPE_PTR
@ RZ_ANALYSIS_OP_MASK_DISASM
@ RZ_ANALYSIS_OP_MASK_ALL
@ RZ_ANALYSIS_OP_MASK_BASIC
@ RZ_ANALYSIS_OP_MASK_VAL
@ RZ_ANALYSIS_OP_MASK_OPEX
@ RZ_ANALYSIS_OP_MASK_ESIL
@ RZ_ANALYSIS_OP_MASK_HINT
#define RZ_ANALYSIS_OP_TYPE_MASK
#define RZ_ANALYSIS_ADDR_TYPE_FUNC
#define RZ_ANALYSIS_ARCHINFO_MIN_OP_SIZE
@ RZ_ANALYSIS_VAR_KIND_REG
@ RZ_ANALYSIS_VAR_KIND_SPV
@ RZ_ANALYSIS_VAR_KIND_BPV
#define RZ_ANALYSIS_ADDR_TYPE_READ
@ RZ_ANALYSIS_OP_TYPE_CMP
@ RZ_ANALYSIS_OP_TYPE_ICALL
@ RZ_ANALYSIS_OP_TYPE_LOAD
@ RZ_ANALYSIS_OP_TYPE_CRYPTO
@ RZ_ANALYSIS_OP_TYPE_UNK
@ RZ_ANALYSIS_OP_TYPE_JMP
@ RZ_ANALYSIS_OP_TYPE_REP
@ RZ_ANALYSIS_OP_TYPE_SYNC
@ RZ_ANALYSIS_OP_TYPE_UJMP
@ RZ_ANALYSIS_OP_TYPE_IJMP
@ RZ_ANALYSIS_OP_TYPE_UCCALL
@ RZ_ANALYSIS_OP_TYPE_MJMP
@ RZ_ANALYSIS_OP_TYPE_SWI
@ RZ_ANALYSIS_OP_TYPE_NULL
@ RZ_ANALYSIS_OP_TYPE_CMOV
@ RZ_ANALYSIS_OP_TYPE_LEAVE
@ RZ_ANALYSIS_OP_TYPE_TRAP
@ RZ_ANALYSIS_OP_TYPE_CCALL
@ RZ_ANALYSIS_OP_TYPE_CALL
@ RZ_ANALYSIS_OP_TYPE_ADD
@ RZ_ANALYSIS_OP_TYPE_CPL
@ RZ_ANALYSIS_OP_TYPE_CRET
@ RZ_ANALYSIS_OP_TYPE_PUSH
@ RZ_ANALYSIS_OP_TYPE_IRJMP
@ RZ_ANALYSIS_OP_TYPE_POP
@ RZ_ANALYSIS_OP_TYPE_RJMP
@ RZ_ANALYSIS_OP_TYPE_CJMP
@ RZ_ANALYSIS_OP_TYPE_CSWI
@ RZ_ANALYSIS_OP_TYPE_UCJMP
@ RZ_ANALYSIS_OP_TYPE_MOV
@ RZ_ANALYSIS_OP_TYPE_ILL
@ RZ_ANALYSIS_OP_TYPE_UCALL
@ RZ_ANALYSIS_OP_TYPE_RET
@ RZ_ANALYSIS_OP_TYPE_NOP
@ RZ_ANALYSIS_OP_TYPE_ACMP
@ RZ_ANALYSIS_OP_TYPE_LEA
@ RZ_ANALYSIS_OP_TYPE_RCALL
@ RZ_ANALYSIS_OP_TYPE_IRCALL
#define RZ_ANALYSIS_ADDR_TYPE_PROGRAM
#define rz_warn_if_reached()
#define rz_warn_if_fail(expr)
#define rz_return_if_fail(expr)
#define rz_return_val_if_fail(expr, val)
RZ_API char * rz_base64_encode_dyn(const ut8 *bin, size_t sz)
#define RZ_BIN_TYPE_HIOS_STR
#define RZ_BIN_TYPE_METH_STR
#define RZ_BIN_TYPE_LOOS_STR
@ RZ_BIN_SPECIAL_SYMBOL_MAIN
#define RZ_BIN_TYPE_STATIC_STR
#define RZ_BIN_TYPE_FUNC_STR
#define RZ_FLAGS_FS_SYSCALLS
#define RZ_GRAPH_FORMAT_JSON
#define RZ_FLAGS_FS_REGISTERS
#define RZ_CORE_ANALYSIS_JSON_FORMAT_DISASM
#define RZ_CORE_ANALYSIS_STAR
#define RZ_GRAPH_FORMAT_DOT
#define RZ_GRAPH_FORMAT_GML
#define RZ_GRAPH_FORMAT_NO
#define RZ_CORE_ANALYSIS_GRAPHBODY
#define RZ_FLAGS_FS_STRINGS
#define RZ_CORE_ANALYSIS_KEYVALUE
#define RZ_CORE_ANALYSIS_GRAPHLINES
#define RZ_FLAGS_FS_MMIO_REGISTERS_EXTENDED
#define RZ_FLAGS_FS_PLATFORM_PORTS
#define RZ_FLAGS_FS_SYMBOLS
#define RZ_FLAGS_FS_MMIO_REGISTERS
#define RZ_GRAPH_FORMAT_GMLFCN
#define RZ_CORE_ANALYSIS_JSON
#define RZ_CORE_ANALYSIS_GRAPHDIFF
#define RZ_FLAGS_FS_FUNCTIONS
static ut64 rz_read_ble64(const void *src, bool big_endian)
static ut8 rz_read_ble8(const void *src)
static ut32 rz_read_ble32(const void *src, bool big_endian)
static ut16 rz_read_ble16(const void *src, bool big_endian)
RZ_API bool rz_file_is_directory(const char *str)
RZ_API bool rz_file_exists(const char *str)
RZ_API RZ_OWN char * rz_file_path_join(RZ_NONNULL const char *s1, RZ_NULLABLE const char *s2)
Concatenate two paths to create a new one with s1+s2 with the correct path separator.
RZ_API bool RZ_API char * rz_file_slurp_line(const char *file, int line, int context)
RZ_API bool rz_sign_sigdb_merge(RZ_NONNULL RzSigDb *db, RZ_NONNULL RzSigDb *db2)
Merge the signatures from db2 into db.
RZ_API RZ_OWN RzSigDb * rz_sign_sigdb_new(void)
Create a new empty RzSigDb instance.
RZ_API void rz_sign_sigdb_free(RzSigDb *db)
RZ_API bool rz_sign_flirt_apply(RZ_NONNULL RzAnalysis *analysis, RZ_NONNULL const char *flirt_file, ut8 expected_arch)
Parses the FLIRT file and applies the signatures.
RZ_API RZ_OWN RzList * rz_sign_sigdb_list(RZ_NONNULL const RzSigDb *db)
Return the signature database as a list of entries.
RZ_API RZ_OWN RzSigDb * rz_sign_sigdb_load_database(RZ_NONNULL const char *sigdb_path, bool with_details)
Returns a database of signatures loaded from the signature database path.
RZ_API RzGraph * rz_graph_new(void)
RZ_API void rz_graph_add_edge(RzGraph *g, RzGraphNode *from, RzGraphNode *to)
RZ_API RzGraphNode * rz_graph_add_node_info(RzGraph *graph, const char *title, const char *body, ut64 offset)
RZ_API char * rz_hex_bin2strdup(const ut8 *in, int len)
RZ_API ut64 rz_io_fd_size(RzIO *io, int fd)
RZ_API bool rz_io_read_at(RzIO *io, ut64 addr, ut8 *buf, int len)
RZ_API ut64 rz_io_map_next_address(RzIO *io, ut64 addr)
RZ_API ut64 rz_io_size(RzIO *io)
RZ_API bool rz_io_read_i(RzIO *io, ut64 addr, ut64 *val, int size, bool endian)
RZ_API RzIOMap * rz_io_map_get(RzIO *io, ut64 addr)
RZ_API RzIODesc * rz_io_desc_get(RzIO *io, int fd)
RZ_API bool rz_io_read_at_mapped(RzIO *io, ut64 addr, ut8 *buf, int len)
RZ_API RZ_BORROW RzPVector * rz_io_maps(RzIO *io)
Returns the pointer to vector containing maps list.
RZ_API bool rz_io_is_valid_offset(RzIO *io, ut64 offset, int hasperm)
RZ_API bool rz_io_use_fd(RzIO *io, int fd)
static ut64 rz_itv_begin(RzInterval itv)
struct rz_interval_t RzInterval
static ut64 rz_itv_end(RzInterval itv)
void(* RzListFree)(void *ptr)
int(* RzListComparator)(const void *value, const void *list_data)
#define RZ_LOG_INFO(fmtstr,...)
#define RZ_LOG_WARN(fmtstr,...)
#define RZ_LOG_DEBUG(fmtstr,...)
#define RZ_LOG_ERROR(fmtstr,...)
RZ_API ut64 rz_mem_get_num(const ut8 *b, int size)
RZ_API bool rz_name_filter(char *name, int len, bool strict)
RZ_API ut64 rz_num_get(RzNum *num, const char *str)
static ut64 rz_num_2_pow_64_div(ut64 divisor)
RZ_API ut64 rz_num_math(RzNum *num, const char *str)
RZ_API RZ_OWN char * rz_path_home_prefix(RZ_NULLABLE const char *path)
Return path prefixed by the home prefix.
RZ_API RZ_OWN char * rz_path_system(RZ_NULLABLE const char *path)
Return the full system path of the given subpath path.
RZ_API PJ * pj_ka(PJ *j, const char *k)
RZ_API PJ * pj_kb(PJ *j, const char *k, bool v)
RZ_API PJ * pj_ki(PJ *j, const char *k, int d)
RZ_API PJ * pj_k(PJ *j, const char *k)
RZ_API PJ * pj_end(PJ *j)
RZ_API const char * pj_string(PJ *pj)
RZ_API void pj_free(PJ *j)
RZ_API PJ * pj_knull(PJ *j, const char *k)
RZ_API PJ * pj_s(PJ *j, const char *k)
RZ_API PJ * pj_ks(PJ *j, const char *k, const char *v)
RZ_API PJ * pj_n(PJ *j, ut64 n)
RZ_API PJ * pj_kn(PJ *j, const char *k, ut64 n)
RZ_API void rz_rbtree_free(RZ_NULLABLE RBNode *root, RBNodeFree freefn, void *user)
#define rz_rbtree_foreach(root, it, data, struc, rb)
RZ_API bool rz_rbtree_insert(RBNode **root, void *data, RBNode *node, RBComparator cmp, void *user)
Returns true if the node was inserted successfully.
RZ_API char * rz_str_escape_dot(const char *buf)
#define RZ_STR_ISNOTEMPTY(x)
RZ_API const char * rz_str_lchr(const char *str, char chr)
RZ_API char * rz_str_newf(const char *fmt,...) RZ_PRINTF_CHECK(1
RZ_API char * rz_str_new(const char *str)
RZ_API RZ_BORROW char * rz_str_trim_tail(RZ_NONNULL char *str)
Removes whitespace characters (space, tab, newline etc.) from the end of a string and replaces them w...
RZ_API const char * rz_str_bool(int b)
static const char * rz_str_get_null(const char *str)
#define RZ_STR_ISEMPTY(x)
RZ_API char * rz_str_prepend(char *ptr, const char *string)
RZ_API char * rz_str_escape_utf8_for_json(const char *s, int len)
RZ_API const char * rz_str_trim_head_ro(const char *str)
RZ_API char * rz_str_replace(char *str, const char *key, const char *val, int g)
RZ_API void rz_str_trim(RZ_NONNULL RZ_INOUT char *str)
Removes whitespace characters (space, tab, newline etc.) from the beginning and end of a string.
RZ_API bool rz_str_startswith(RZ_NONNULL const char *str, RZ_NONNULL const char *needle)
Checks if a string starts with a specifc sequence of characters (case sensitive)
RZ_API int rz_str_replace_char(char *s, int a, int b)
#define rz_strf(buf,...)
Convenience macro for local temporary strings.
RZ_API const char * rz_str_constpool_get(RzStrConstPool *pool, const char *str)
RZ_API RZ_OWN char * rz_strbuf_drain(RzStrBuf *sb)
#define RZ_STRBUF_SAFEGET(sb)
RZ_API char * rz_strbuf_get(RzStrBuf *sb)
RZ_API bool rz_strbuf_append(RzStrBuf *sb, const char *s)
RZ_API RzStrBuf * rz_strbuf_new(const char *s)
RZ_API bool rz_strbuf_appendf(RzStrBuf *sb, const char *fmt,...) RZ_PRINTF_CHECK(2
RZ_API void rz_table_visual_list(RzTable *table, RzList *list, ut64 seek, ut64 len, int width, bool va)
RZ_API void rz_table_add_rowf(RzTable *t, const char *fmt,...)
RZ_API void rz_table_free(RzTable *t)
RZ_API void rz_table_set_columnsf(RzTable *t, const char *fmt,...)
Specify the types and names of the referenced table.
RZ_API char * rz_table_tostring(RzTable *t)
@ RZ_TYPE_KIND_IDENTIFIER
RzOutputMode
Enum to describe the way data are printed.
@ RZ_OUTPUT_MODE_STANDARD
#define container_of(ptr, type, member)
static void ** rz_pvector_reserve(RzPVector *vec, size_t capacity)
RZ_API void * rz_pvector_pop(RzPVector *vec)
RZ_API void rz_pvector_init(RzPVector *vec, RzPVectorFree free)
RZ_API void rz_pvector_fini(RzPVector *vec)
static size_t rz_pvector_len(const RzPVector *vec)
RZ_API RzPVector * rz_pvector_new(RzPVectorFree free)
#define rz_vector_foreach(vec, it)
static void ** rz_pvector_push(RzPVector *vec, void *x)
RZ_API void rz_vector_fini(RzVector *vec)
RZ_API void rz_pvector_free(RzPVector *vec)
RZ_API void * rz_vector_insert_range(RzVector *vec, size_t index, void *first, size_t count)
static size_t rz_vector_len(const RzVector *vec)
RZ_API void rz_vector_init(RzVector *vec, size_t elem_size, RzVectorFree free, void *free_user)
static void * rz_pvector_at(const RzPVector *vec, size_t index)
#define rz_pvector_foreach(vec, it)
RZ_API Sdb * sdb_new(const char *path, const char *name, int lock)
RZ_API bool sdb_isempty(Sdb *s)
RZ_API int sdb_set(Sdb *s, const char *key, const char *val, ut32 cas)
RZ_API void sdb_close(Sdb *s)
RZ_API bool sdb_merge(Sdb *d, Sdb *s)
RZ_API bool sdb_free(Sdb *s)
RZ_API void sdb_reset(Sdb *s)
RZ_API bool rz_core_seek_and_save(RzCore *core, ut64 addr, bool rb)
Save currently marked state in seek history and seek to addr .
RZ_API bool rz_core_seek_undo(RzCore *core)
RZ_API bool rz_core_seek(RzCore *core, ut64 addr, bool rb)
Seek to addr.
RZ_API SetU * set_u_new(void)
RZ_API void set_u_free(SetU *s)
RZ_API void set_u_add(SetU *s, ut64 u)
static struct sockaddr static addrlen static backlog const void static flags void struct sockaddr from
static struct sockaddr static addrlen static backlog const void static flags void struct sockaddr socklen_t static fromlen const void const struct sockaddr to
static struct sockaddr static addrlen static backlog const void static flags void flags
static struct sockaddr static addrlen static backlog const void msg
const RzVector * addr_hints
RzCoreAnalysisStatsItem * blocks
RzAnalysisSwitchOp * switch_op
int(* on_fcn_rename)(struct rz_analysis_t *, void *user, RzAnalysisFunction *fcn, const char *oldname)
struct rz_analysis_cycle_frame_t * prev
RzAnalysisEsilTrace * trace
struct rz_analysis_t * analysis
RzPlatformTarget * arch_target
struct rz_analysis_plugin_t * cur
struct rz_analysis_esil_t * esil
RzPlatformTargetIndex * platform_target
RzType * type
type of the variable
ut64 addr
address of the global variable
char * name
name of the variable
XX curplugin == o->plugin.
struct rz_bin_plugin_t * plugin
ut64 vaddr
the vaddr where the value should be patched into
RZ_DEPRECATE RzBinFile * cur
never use this in new code! Get a file from the binfiles list or track it yourself.
Represent the output state of a command handler.
RzConsPrintablePalette pal
RzCoreTaskScheduler tasks
struct rz_io_desc_t * desc
struct rz_list_iter_t * n
const char *(* get_reg_at)(RzAnalysisFunction *fcn, st64 delta, ut64 addr)
st64(* get_ptr_at)(RzAnalysisFunction *fcn, st64 delta, ut64 addr)
char * name[RZ_REG_NAME_LAST]
char * arch_name
RzAsmPlugin name.
char * bin_name
RzBinPlugin name (elf64 and pe64 are named as elf and pe)
char * details
signature name / description (only for .sig files)
ut32 n_modules
signature number of modules
const char * base_name
basename of file
const char * short_path
Short path without sigdb path.
char * file_path
full path to the signature file
ut32 arch_bits
Architecture bits.
static struct Type metas[]
RZ_API void rz_syscall_item_free(RzSyscallItem *si)
RZ_API RzSyscallItem * rz_syscall_get(RzSyscall *s, int num, int swi)
RZ_API void rz_core_task_yield(RzCoreTaskScheduler *scheduler)
RZ_API RzDebugTracepoint * rz_debug_trace_get(RzDebug *dbg, ut64 addr)
RZ_API int rz_type_func_args_count(RzTypeDB *typedb, RZ_NONNULL const char *name)
Searches for the RzCallable type in types database and returns arguments' count.
RZ_API RZ_BORROW RzType * rz_type_func_ret(RzTypeDB *typedb, RZ_NONNULL const char *name)
Searches for the RzCallable type in types database and returns return type.
RZ_API RZ_OWN RzList * rz_type_db_get_by_offset(const RzTypeDB *typedb, ut64 offset)
Returns the list of all structured types that have members matching the offset.
RZ_API void rz_type_db_init(RzTypeDB *typedb, const char *types_dir, const char *arch, int bits, const char *os)
Initializes the types database for specified arch, bits, OS.
RZ_API RZ_OWN char * rz_type_as_string(const RzTypeDB *typedb, RZ_NONNULL const RzType *type)
Returns the type C representation.
RZ_API RZ_OWN char * rz_diff_unified_text(RZ_NONNULL RzDiff *diff, RZ_NULLABLE const char *from, RZ_NULLABLE const char *to, bool show_time, bool color)
Produces a diff output with A and B inputs presented immediately adjacent to each other.
void error(const char *msg)
RZ_API RZ_OWN char * rz_analysis_function_autoname_var(RzAnalysisFunction *fcn, char kind, const char *pfx, int ptr)
RZ_API void rz_analysis_extract_rarg(RzAnalysis *analysis, RzAnalysisOp *op, RzAnalysisFunction *fcn, int *reg_set, int *count)
RZ_API void rz_analysis_fcn_vars_cache_fini(RzAnalysisFcnVarsCache *cache)
RZ_API RZ_BORROW RzAnalysisVar * rz_analysis_function_get_var(RzAnalysisFunction *fcn, char kind, int delta)
RZ_API int rz_analysis_var_count(RzAnalysis *a, RzAnalysisFunction *fcn, int kind, int type)
RZ_API void rz_analysis_extract_vars(RzAnalysis *analysis, RzAnalysisFunction *fcn, RzAnalysisOp *op)
RZ_API void rz_analysis_var_set_access(RzAnalysisVar *var, const char *reg, ut64 access_addr, int access_type, st64 stackptr)
RZ_API RzList * rz_analysis_var_list(RzAnalysis *a, RzAnalysisFunction *fcn, int kind)
RZ_API void rz_analysis_function_delete_vars_by_kind(RzAnalysisFunction *fcn, RzAnalysisVarKind kind)
RZ_API RZ_BORROW RzAnalysisVar * rz_analysis_function_set_var(RzAnalysisFunction *fcn, int delta, char kind, RZ_BORROW RZ_NULLABLE const RzType *type, int size, bool isarg, RZ_NONNULL const char *name)
RZ_DEPRECATE RZ_API RzList * rz_analysis_var_all_list(RzAnalysis *analysis, RzAnalysisFunction *fcn)
RZ_API st64 rz_analysis_function_get_var_stackptr_at(RzAnalysisFunction *fcn, st64 delta, ut64 addr)
RZ_API char * rz_analysis_fcn_format_sig(RZ_NONNULL RzAnalysis *analysis, RZ_NONNULL RzAnalysisFunction *fcn, RZ_NULLABLE char *fcn_name, RZ_NULLABLE RzAnalysisFcnVarsCache *reuse_cache, RZ_NULLABLE const char *fcn_name_pre, RZ_NULLABLE const char *fcn_name_post)
RZ_API void rz_analysis_fcn_vars_add_types(RzAnalysis *analysis, RZ_NONNULL RzAnalysisFunction *fcn)
Updates the types database for function arguments.
RZ_API bool rz_analysis_var_rename(RzAnalysisVar *var, const char *new_name, bool verbose)
RZ_API RZ_BORROW RzAnalysisVar * rz_analysis_function_get_var_byname(RzAnalysisFunction *fcn, const char *name)
RZ_API void rz_analysis_var_delete(RzAnalysisVar *var)
RZ_API const char * rz_analysis_function_get_var_reg_at(RzAnalysisFunction *fcn, st64 delta, ut64 addr)
RZ_API void rz_analysis_fcn_vars_cache_init(RzAnalysis *analysis, RzAnalysisFcnVarsCache *cache, RzAnalysisFunction *fcn)
RZ_DEPRECATE RZ_API RzAnalysisVar * rz_analysis_get_used_function_var(RzAnalysis *analysis, ut64 addr)
RZ_API RZ_OWN RzList * rz_analysis_var_global_get_all(RzAnalysis *analysis)
Get all of the added global variables.
RZ_API RZ_BORROW RzAnalysisVarGlobal * rz_analysis_var_global_get_byname(RzAnalysis *analysis, RZ_NONNULL const char *name)
Get the instance of global variable by its name.
RZ_API RzListInfo * rz_listinfo_new(const char *name, RzInterval pitv, RzInterval vitv, int perm, const char *extra)
RZ_API void rz_listinfo_free(RzListInfo *info)
if(dbg->bits==RZ_SYS_BITS_64)
ut64(WINAPI *w32_GetEnabledXStateFeatures)()
static char * regname(int reg)
RZ_API RZ_OWN RzList * rz_analysis_xrefs_list(RzAnalysis *analysis)
Get list of all xrefs.
RZ_API RzList * rz_analysis_xrefs_get_to(RzAnalysis *analysis, ut64 addr)
RZ_API bool rz_analysis_xrefs_set(RzAnalysis *analysis, ut64 from, ut64 to, RzAnalysisXRefType type)
RZ_API RzList * rz_analysis_function_get_xrefs_from(RzAnalysisFunction *fcn)
static struct stack stack[MAX_INCLUDE]