Rizin
unix-like reverse engineering framework and cli tools
cio.c
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: 2009-2019 pancake <pancake@nopcode.org>
2 // SPDX-License-Identifier: LGPL-3.0-only
3 
4 #include "rz_core.h"
5 #include "core_private.h"
6 
7 RZ_API int rz_core_setup_debugger(RzCore *r, const char *debugbackend, bool attach) {
8  int pid, *p = NULL;
9  RzIODesc *fd = r->file ? rz_io_desc_get(r->io, r->file->fd) : NULL;
10 
11  p = fd ? fd->data : NULL;
12  rz_config_set_i(r->config, "cfg.debug", 1);
13  if (!p) {
14  eprintf("Invalid debug io\n");
15  return false;
16  }
17 
18  rz_config_set(r->config, "io.ff", "true");
19  rz_config_set(r->config, "dbg.backend", debugbackend);
21  rz_debug_select(r->dbg, pid, r->dbg->tid);
22  r->dbg->main_pid = pid;
23  if (attach) {
25  }
26  // this makes to attach twice showing warnings in the output
27  // we get "resource busy" so it seems isn't an issue
29  /* honor dbg.bep */
30  {
31  const char *bep = rz_config_get(r->config, "dbg.bep");
32  if (bep) {
33  ut64 address = 0;
34  if (!strcmp(bep, "loader")) {
35  /* do nothing here */
36  } else if (!strcmp(bep, "entry")) {
37  address = rz_num_math(r->num, "entry0");
38  rz_core_debug_continue_until(r, address, address);
39  } else {
40  address = rz_num_math(r->num, bep);
41  rz_core_debug_continue_until(r, address, address);
42  }
43  }
44  }
45  rz_core_seek_to_register(r, "PC", false);
46 
47  return true;
48 }
49 
50 RZ_API bool rz_core_dump(RzCore *core, const char *file, ut64 addr, ut64 size, int append) {
51  ut64 i;
52  ut8 *buf;
53  int bs = core->blocksize;
54  FILE *fd;
55  if (append) {
56  fd = rz_sys_fopen(file, "ab");
57  } else {
59  fd = rz_sys_fopen(file, "wb");
60  }
61  if (!fd) {
62  eprintf("Cannot open '%s' for writing\n", file);
63  return false;
64  }
65  /* some io backends seems to be buggy in those cases */
66  if (bs > 4096) {
67  bs = 4096;
68  }
69  buf = malloc(bs);
70  if (!buf) {
71  eprintf("Cannot alloc %d byte(s)\n", bs);
72  fclose(fd);
73  return false;
74  }
76  for (i = 0; i < size; i += bs) {
77  if (rz_cons_is_breaked()) {
78  break;
79  }
80  if ((i + bs) > size) {
81  bs = size - i;
82  }
83  rz_io_read_at(core->io, addr + i, buf, bs);
84  if (fwrite(buf, bs, 1, fd) < 1) {
85  eprintf("write error\n");
86  break;
87  }
88  }
90  fclose(fd);
91  free(buf);
92  return true;
93 }
94 
95 // Get address-specific bits and arch at a certain address.
96 // If there are no specific infos (i.e. asm.bits and asm.arch should apply), the bits and arch will be 0 or NULL respectively!
98  int bitsval = 0;
99  const char *archval = NULL;
100  RzBinObject *o = rz_bin_cur_object(core->bin);
101  RzBinSection *s = o ? rz_bin_get_section_at(o, addr, core->io->va) : NULL;
102  if (s) {
103  if (!core->fixedarch) {
104  archval = s->arch;
105  }
106  if (!core->fixedbits && s->bits) {
107  // only enforce if there's one bits set
108  switch (s->bits) {
109  case RZ_SYS_BITS_16:
110  case RZ_SYS_BITS_32:
111  case RZ_SYS_BITS_64:
112  bitsval = s->bits * 8;
113  break;
114  }
115  }
116  }
117  // if we found bits related with analysis hints pick it up
118  if (bits && !bitsval && !core->fixedbits) {
119  bitsval = rz_analysis_hint_bits_at(core->analysis, addr, NULL);
120  }
121  if (arch && !archval && !core->fixedarch) {
122  archval = rz_analysis_hint_arch_at(core->analysis, addr, NULL);
123  }
124  if (bits && bitsval) {
125  *bits = bitsval;
126  }
127  if (arch && archval) {
128  *arch = archval;
129  }
130 }
131 
133  int bits = 0;
134  const char *arch = NULL;
135  rz_core_arch_bits_at(core, addr, &bits, &arch);
136  if (bits) {
137  rz_config_set_i(core->config, "asm.bits", bits);
138  }
139  if (arch) {
140  rz_config_set(core->config, "asm.arch", arch);
141  }
142 }
143 
144 // TODO: kill this wrapper
145 RZ_API bool rz_core_write_at(RzCore *core, ut64 addr, const ut8 *buf, int size) {
146  rz_return_val_if_fail(core && buf && addr != UT64_MAX, false);
147  if (size < 1) {
148  return false;
149  }
150  bool ret = rz_io_write_at(core->io, addr, buf, size);
151  if (addr >= core->offset && addr <= core->offset + core->blocksize - 1) {
152  rz_core_block_read(core);
153  }
154  if (rz_config_get_i(core->config, "cfg.wseek")) {
155  rz_core_seek_delta(core, size, true);
156  }
157  return ret;
158 }
159 
173  rz_return_val_if_fail(core, false);
174 
175  int io_va = rz_config_get_i(core->config, "io.va");
176  if (io_va) {
177  RzIOMap *map = rz_io_map_get(core->io, core->offset);
178  if (map) {
179  addr = addr - map->itv.addr + map->delta;
180  }
181  }
182  bool ret = rz_io_extend_at(core->io, addr, size);
183  rz_core_block_read(core);
184  return ret;
185 }
186 
197 RZ_API bool rz_core_shift_block(RzCore *core, ut64 addr, ut64 b_size, st64 dist) {
198  // bstart - block start, fstart file start
199  ut64 fend = 0, fstart = 0, bstart = 0, file_sz = 0;
200  ut8 *shift_buf = NULL;
201  int res = false;
202 
203  if (!core->io || !core->file) {
204  return false;
205  }
206 
207  if (b_size == 0 || b_size == (ut64)-1) {
208  rz_io_use_fd(core->io, core->file->fd);
209  file_sz = rz_io_size(core->io);
210  if (file_sz == UT64_MAX) {
211  file_sz = 0;
212  }
213  bstart = 0;
214  fend = file_sz;
215  fstart = file_sz - fend;
216  b_size = fend > bstart ? fend - bstart : 0;
217  }
218 
219  if ((st64)b_size < 1) {
220  return false;
221  }
222  shift_buf = calloc(b_size, 1);
223  if (!shift_buf) {
224  eprintf("Cannot allocated %d byte(s)\n", (int)b_size);
225  return false;
226  }
227 
228  if (addr + dist < fstart) {
229  res = false;
230  } else if ((addr) + dist > fend) {
231  res = false;
232  } else {
233  rz_io_use_fd(core->io, core->file->fd);
234  rz_io_read_at(core->io, addr, shift_buf, b_size);
235  rz_io_write_at(core->io, addr + dist, shift_buf, b_size);
236  res = true;
237  }
238  rz_core_seek(core, addr, true);
239  free(shift_buf);
240  return res;
241 }
242 
244  if (core && core->block) {
245  return rz_io_read_at(core->io, core->offset, core->block, core->blocksize);
246  }
247  return -1;
248 }
249 
251  if (!core) {
252  eprintf("rz_core_is_valid_offset: core is NULL\n");
254  return -1;
255  }
256  return rz_io_is_valid_offset(core->io, offset, 0);
257 }
258 
268 RZ_API int rz_core_write_hexpair(RzCore *core, ut64 addr, const char *pairs) {
269  rz_return_val_if_fail(core && pairs, 0);
270  ut8 *buf = malloc(strlen(pairs) + 1);
271  if (!buf) {
272  return 0;
273  }
274  int len = rz_hex_str2bin(pairs, buf);
275  if (len < 0) {
276  RZ_LOG_ERROR("Could not convert hexpair '%s' to bin data\n", pairs);
277  goto err;
278  }
279  if (!rz_core_write_at(core, addr, buf, len)) {
280  RZ_LOG_ERROR("Could not write hexpair '%s' at %" PFMT64x "\n", pairs, addr);
281  goto err;
282  }
283 err:
284  free(buf);
285  return len;
286 }
287 
299 RZ_API bool rz_core_write_block(RzCore *core, ut64 addr, ut8 *data, size_t len) {
300  rz_return_val_if_fail(core && data, 0);
301 
302  ut8 *buf = RZ_NEWS(ut8, core->blocksize);
303  if (!buf) {
304  return false;
305  }
306 
307  bool res = false;
308  rz_mem_copyloop(buf, data, core->blocksize, len);
309  if (!rz_core_write_at(core, addr, buf, core->blocksize)) {
310  RZ_LOG_ERROR("Could not write cyclic data (%d bytes) at %" PFMT64x "\n", core->blocksize, addr);
311  goto err;
312  }
313  res = true;
314 err:
315  free(buf);
316  return res;
317 }
318 
328  rz_return_val_if_fail(core && instructions, -1);
329 
330  int ret = -1;
331 
332  rz_asm_set_pc(core->rasm, core->offset);
333  RzAsmCode *acode = rz_asm_massemble(core->rasm, instructions);
334  if (!acode) {
335  return -1;
336  }
337  if (acode->len <= 0) {
338  ret = 0;
339  goto err;
340  }
341 
342  if (!rz_core_write_at(core, core->offset, acode->bytes, acode->len)) {
343  RZ_LOG_ERROR("Cannot write %d bytes at 0x%" PFMT64x "address\n", acode->len, core->offset);
344  core->num->value = 1;
345  goto err;
346  }
347  ret = acode->len;
348 err:
349  rz_asm_code_free(acode);
350  return ret;
351 }
352 
366  rz_return_val_if_fail(core && instructions, -1);
367 
368  int ret = -1;
369 
370  rz_asm_set_pc(core->rasm, core->offset);
371  RzAsmCode *acode = rz_asm_massemble(core->rasm, instructions);
372  if (!acode) {
373  return -1;
374  }
375  if (acode->len <= 0) {
376  ret = 0;
377  goto err;
378  }
379 
380  RzAnalysisOp op = { 0 };
381  if (rz_analysis_op(core->analysis, &op, core->offset, core->block, core->blocksize, RZ_ANALYSIS_OP_MASK_BASIC) < 1) {
382  RZ_LOG_ERROR("Invalid instruction at %" PFMT64x "\n", core->offset);
383  goto err;
384  }
385  if (op.size < acode->len) {
386  RZ_LOG_ERROR("Instructions do not fit at %" PFMT64x "\n", core->offset);
387  goto err;
388  }
389  rz_core_hack(core, "nop");
390 
391  if (!rz_core_write_at(core, core->offset, acode->bytes, acode->len)) {
392  RZ_LOG_ERROR("Cannot write %d bytes at 0x%" PFMT64x "address\n", acode->len, core->offset);
393  core->num->value = 1;
394  goto err;
395  }
396  ret = acode->len;
397 err:
398  rz_asm_code_free(acode);
399  return ret;
400 }
401 
409  char str[4];
410  PJ *pj = state->d.pj;
411  str[0] = 'r';
412  str[1] = plugin->write ? 'w' : '_';
413  str[2] = plugin->isdbg ? 'd' : '_';
414  str[3] = 0;
415  switch (state->mode) {
416  case RZ_OUTPUT_MODE_JSON:
417  pj_o(pj);
418  pj_ks(pj, "permissions", str);
419  pj_ks(pj, "name", plugin->name);
420  pj_ks(pj, "description", plugin->desc);
421  pj_ks(pj, "license", plugin->license);
422 
423  if (plugin->uris) {
424  char *uri;
425  char *uris = strdup(plugin->uris);
426  RzList *plist = rz_str_split_list(uris, ",", 0);
427  RzListIter *piter;
428  pj_k(pj, "uris");
429  pj_a(pj);
430  rz_list_foreach (plist, piter, uri) {
431  pj_s(pj, uri);
432  }
433  pj_end(pj);
434  rz_list_free(plist);
435  free(uris);
436  }
437  if (plugin->version) {
438  pj_ks(pj, "version", plugin->version);
439  }
440  if (plugin->author) {
441  pj_ks(pj, "author", plugin->author);
442  }
443  pj_end(pj);
444  break;
446  rz_table_set_columnsf(state->d.t, "sssss", "perm", "license", "name", "uri", "description");
447  rz_table_add_rowf(state->d.t, "sssss", str, plugin->license, plugin->name, plugin->uris, plugin->desc);
448  break;
450  rz_cons_printf("%s\n", plugin->name);
451  break;
453  rz_cons_printf("%s %-8s %s (%s)",
454  str, plugin->name,
455  plugin->desc, plugin->license);
456  if (plugin->uris) {
457  rz_cons_printf(" %s", plugin->uris);
458  }
459  if (plugin->version) {
460  rz_cons_printf(" v%s", plugin->version);
461  }
462  if (plugin->author) {
463  rz_cons_printf(" %s", plugin->author);
464  }
465  rz_cons_printf("\n");
466  break;
467  default: {
470  }
471  }
472  return RZ_CMD_STATUS_OK;
473 }
474 
482  RzIOPlugin *plugin;
483  RzListIter *iter;
484  if (!io) {
485  return RZ_CMD_STATUS_ERROR;
486  }
488  rz_cmd_state_output_set_columnsf(state, "sssss", "perm", "license", "name", "uri", "description");
489  rz_list_foreach (io->plugins, iter, plugin) {
491  }
493  return RZ_CMD_STATUS_OK;
494 }
495 
507  rz_return_val_if_fail(sz == 0 || sz == 1 || sz == 2 || sz == 4 || sz == 8, false);
508  ut8 buf[sizeof(ut64)];
509  bool be = rz_config_get_i(core->config, "cfg.bigendian");
510 
511  core->num->value = 0;
512  if (sz == 0) {
513  sz = value & UT64_32U ? 8 : 4;
514  }
515 
516  switch (sz) {
517  case 1:
519  break;
520  case 2:
521  rz_write_ble16(buf, (ut16)(value & UT16_MAX), be);
522  break;
523  case 4:
524  rz_write_ble32(buf, (ut32)(value & UT32_MAX), be);
525  break;
526  case 8:
527  rz_write_ble64(buf, value, be);
528  break;
529  default:
530  return false;
531  }
532 
533  if (!rz_core_write_at(core, addr, buf, sz)) {
534  RZ_LOG_ERROR("Could not write %d bytes at %" PFMT64x "\n", sz, addr);
535  core->num->value = 1;
536  return false;
537  }
538  return true;
539 }
540 
552  rz_return_val_if_fail(sz == 1 || sz == 2 || sz == 4 || sz == 8, false);
553 
554  ut8 buf[sizeof(ut64)];
555  bool be = rz_config_get_i(core->config, "cfg.bigendian");
556 
557  if (!rz_io_read_at_mapped(core->io, addr, buf, sz)) {
558  return false;
559  }
560 
561  switch (sz) {
562  case 1: {
563  ut8 cur = rz_read_ble8(buf);
564  cur += value;
565  rz_write_ble8(buf, cur);
566  break;
567  }
568  case 2: {
569  ut16 cur = rz_read_ble16(buf, be);
570  cur += value;
571  rz_write_ble16(buf, cur, be);
572  break;
573  }
574  case 4: {
575  ut32 cur = rz_read_ble32(buf, be);
576  cur += value;
577  rz_write_ble32(buf, cur, be);
578  break;
579  }
580  case 8: {
581  ut64 cur = rz_read_ble64(buf, be);
582  cur += value;
583  rz_write_ble64(buf, cur, be);
584  break;
585  }
586  default:
588  break;
589  }
590 
591  if (!rz_core_write_at(core, addr, buf, sz)) {
592  RZ_LOG_ERROR("Could not write %d bytes at %" PFMT64x "\n", sz, addr);
593  return false;
594  }
595  return true;
596 }
597 
606  rz_return_val_if_fail(core && s, false);
607 
608  char *str = strdup(s);
609  if (!str) {
610  return false;
611  }
612 
613  int len = rz_str_unescape(str);
614  if (!rz_core_write_at(core, addr, (const ut8 *)str, len)) {
615  RZ_LOG_ERROR("Could not write '%s' at %" PFMT64x "\n", s, addr);
616  free(str);
617  return false;
618  }
619  free(str);
620  return true;
621 }
622 
631  rz_return_val_if_fail(core && s, false);
632 
633  bool res = false;
634  char *str = strdup(s);
635  if (!str) {
636  return false;
637  }
638 
639  int len = rz_str_unescape(str);
640  if (len < 1) {
641  goto str_err;
642  }
643 
644  len++; // Consider for the terminator char
645  char *tmp = RZ_NEWS(char, len * 2);
646  if (!tmp) {
647  goto str_err;
648  }
649 
650  for (int i = 0; i < len; i++) {
651  tmp[i * 2] = str[i];
652  tmp[i * 2 + 1] = 0;
653  }
654 
655  if (!rz_core_write_at(core, addr, (const ut8 *)tmp, len * 2)) {
656  RZ_LOG_ERROR("Could not write wide string '%s' at %" PFMT64x "\n", s, addr);
657  free(str);
658  return false;
659  }
660  res = true;
661 str_err:
662  free(str);
663  return res;
664 }
674  rz_return_val_if_fail(core && s, false);
675 
676  char *str = strdup(s);
677  if (!str) {
678  return false;
679  }
680 
681  int len = rz_str_unescape(str);
682  ut8 ulen = (ut8)len;
683  if (!rz_core_write_at(core, addr, &ulen, sizeof(ulen)) ||
684  !rz_core_write_at(core, addr + 1, (const ut8 *)str, len)) {
685  RZ_LOG_ERROR("Could not write length+'%s' at %" PFMT64x "\n", s, addr);
686  free(str);
687  return false;
688  }
689  free(str);
690  return true;
691 }
692 
701  rz_return_val_if_fail(core && s, false);
702 
703  bool res = false;
704  size_t str_len = strlen(s) + 1;
705  ut8 *bin_buf = malloc(str_len);
706  if (!bin_buf) {
707  return false;
708  }
709 
710  const int bin_len = rz_hex_str2bin(s, bin_buf);
711  if (bin_len <= 0) {
712  free(bin_buf);
713  return false;
714  }
715 
716  ut8 *buf = calloc(str_len + 1, 4);
717  if (!buf) {
718  free(bin_buf);
719  return false;
720  }
721 
722  int len = rz_base64_encode((char *)buf, bin_buf, bin_len);
723  free(bin_buf);
724  if (len == 0) {
725  goto err;
726  }
727 
728  if (!rz_core_write_at(core, addr, buf, len)) {
729  RZ_LOG_ERROR("Could not write base64 encoded string '%s' at %" PFMT64x "\n", s, addr);
730  goto err;
731  }
732  res = true;
733 err:
734  free(buf);
735  return res;
736 }
737 
746  rz_return_val_if_fail(core && s, false);
747 
748  bool res = false;
749  size_t str_len = strlen(s) + 1;
750  ut8 *buf = malloc(str_len);
751  int len = rz_base64_decode(buf, s, -1);
752  if (len < 0) {
753  goto err;
754  }
755 
756  if (!rz_core_write_at(core, addr, buf, len)) {
757  RZ_LOG_ERROR("Could not write base64 decoded string '%s' at %" PFMT64x "\n", s, addr);
758  goto err;
759  }
760  res = true;
761 err:
762  free(buf);
763  return res;
764 }
765 
774  rz_return_val_if_fail(core, false);
775 
776  bool res = false;
777  ut8 *buf = malloc(len);
778  if (!buf) {
779  return false;
780  }
781 
782  rz_num_irand();
783  for (int i = 0; i < len; i++) {
784  buf[i] = rz_num_rand(256);
785  }
786 
787  if (!rz_core_write_at(core, addr, buf, len)) {
788  RZ_LOG_ERROR("Could not write random data of length %zd at %" PFMT64x "\n", len, addr);
789  goto err;
790  }
791  res = true;
792 err:
793  free(buf);
794  return res;
795 }
796 
799 
800  size_t i, j = 0;
801  void **iter;
802  RzIOCache *c;
803 
804  rz_pvector_foreach (&core->io->cache, iter) {
805  c = *iter;
806  const ut64 dataSize = rz_itv_size(c->itv);
807  switch (state->mode) {
809  rz_cons_printf("idx=%" PFMTSZu " addr=0x%08" PFMT64x " size=%" PFMT64u " ", j, rz_itv_begin(c->itv), dataSize);
810  for (i = 0; i < dataSize; i++) {
811  rz_cons_printf("%02x", c->odata[i]);
812  }
813  rz_cons_printf(" -> ");
814  for (i = 0; i < dataSize; i++) {
815  rz_cons_printf("%02x", c->data[i]);
816  }
817  rz_cons_printf(" %s\n", c->written ? "(written)" : "(not written)");
818  break;
819  case RZ_OUTPUT_MODE_JSON:
820  pj_o(state->d.pj);
821  pj_kn(state->d.pj, "idx", j);
822  pj_kn(state->d.pj, "addr", rz_itv_begin(c->itv));
823  pj_kn(state->d.pj, "size", dataSize);
824  char *hex = rz_hex_bin2strdup(c->odata, dataSize);
825  pj_ks(state->d.pj, "before", hex);
826  free(hex);
827  hex = rz_hex_bin2strdup(c->data, dataSize);
828  pj_ks(state->d.pj, "after", hex);
829  free(hex);
830  pj_kb(state->d.pj, "written", c->written);
831  pj_end(state->d.pj);
832  break;
834  rz_cons_printf("wx ");
835  for (i = 0; i < dataSize; i++) {
836  rz_cons_printf("%02x", (ut8)(c->data[i] & 0xff));
837  }
838  rz_cons_printf(" @ 0x%08" PFMT64x, rz_itv_begin(c->itv));
839  rz_cons_printf(" # replaces: ");
840  for (i = 0; i < dataSize; i++) {
841  rz_cons_printf("%02x", (ut8)(c->odata[i] & 0xff));
842  }
843  rz_cons_printf("\n");
844  break;
845  default:
847  break;
848  }
849  j++;
850  }
851  return RZ_CMD_STATUS_OK;
852 }
853 
857 
858  RzList *caches = rz_io_desc_cache_list(desc);
859  RzListIter *iter;
860  RzIOCache *c;
861 
862  if (state->mode == RZ_OUTPUT_MODE_RIZIN) {
863  rz_cons_printf("e io.va = false\n");
864  }
865  rz_list_foreach (caches, iter, c) {
866  const int cacheSize = rz_itv_size(c->itv);
867  int i;
868 
869  switch (state->mode) {
871  rz_cons_printf("0x%08" PFMT64x ": %02x",
872  rz_itv_begin(c->itv), c->odata[0]);
873  for (i = 1; i < cacheSize; i++) {
874  rz_cons_printf("%02x", c->odata[i]);
875  }
876  rz_cons_printf(" -> %02x", c->data[0]);
877  for (i = 1; i < cacheSize; i++) {
878  rz_cons_printf("%02x", c->data[i]);
879  }
880  rz_cons_printf("\n");
881  break;
883  rz_cons_printf("wx %02x", c->data[0]);
884  for (i = 1; i < cacheSize; i++) {
885  rz_cons_printf("%02x", c->data[i]);
886  }
887  rz_cons_printf(" @ 0x%08" PFMT64x " \n", rz_itv_begin(c->itv));
888  break;
889  default:
891  break;
892  }
893  }
894  rz_list_free(caches);
895  return RZ_CMD_STATUS_OK;
896 }
897 
906  rz_return_val_if_fail(core && s, false);
907 
908  char *str = strdup(s);
909  if (!str) {
910  return false;
911  }
912 
913  int len = rz_str_unescape(str);
914  if (!rz_core_write_at(core, addr, (const ut8 *)str, len + 1)) {
915  RZ_LOG_ERROR("Could not write '%s' at %" PFMT64x "\n", s, addr);
916  free(str);
917  return false;
918  }
919  free(str);
920  return true;
921 }
922 
936  rz_return_val_if_fail(!hex || hexlen >= 0, NULL);
938 
939  switch (op) {
945  case RZ_CORE_WRITE_OP_OR:
949  rz_return_val_if_fail(hex && hexlen >= 0, NULL);
950  break;
951  default:
952  break;
953  }
954 
955  ut8 *buf = RZ_NEWS(ut8, core->blocksize);
956  if (!buf) {
957  return NULL;
958  }
959 
960  int len = rz_io_nread_at(core->io, addr, buf, core->blocksize);
961  if (len < 0) {
962  free(buf);
963  return NULL;
964  }
965 
966  for (int i = 0, j = 0; i < len; i++, j = (j + 1) % (hexlen ? hexlen : 1)) {
967  ut16 tmp16;
968  ut32 tmp32;
969  ut64 tmp64;
970  switch (op) {
972  if (i + 1 < len) {
973  tmp16 = rz_read_le16(buf + i);
974  rz_write_be16(buf + i, tmp16);
975  i++;
976  }
977  break;
979  if (i + 3 < len) {
980  tmp32 = rz_read_le32(buf + i);
981  rz_write_be32(buf + i, tmp32);
982  i += 3;
983  }
984  break;
986  if (i + 7 < len) {
987  tmp64 = rz_read_le64(buf + i);
988  rz_write_be64(buf + i, tmp64);
989  i += 7;
990  }
991  break;
993  buf[i] += hex[j];
994  break;
996  buf[i] -= hex[j];
997  break;
999  buf[i] = hex[j] ? buf[i] / hex[j] : 0;
1000  break;
1001  case RZ_CORE_WRITE_OP_MUL:
1002  buf[i] *= hex[j];
1003  break;
1004  case RZ_CORE_WRITE_OP_AND:
1005  buf[i] &= hex[j];
1006  break;
1007  case RZ_CORE_WRITE_OP_OR:
1008  buf[i] |= hex[j];
1009  break;
1010  case RZ_CORE_WRITE_OP_XOR:
1011  buf[i] ^= hex[j];
1012  break;
1014  buf[i] <<= hex[j];
1015  break;
1017  buf[i] >>= hex[j];
1018  break;
1019  default:
1021  break;
1022  }
1023  }
1024  *buflen = len;
1025  return buf;
1026 }
1027 
1039  int buflen;
1040  ut8 *buf = rz_core_transform_op(core, addr, op, hex, hexlen, &buflen);
1041  if (!buf) {
1042  return false;
1043  }
1044 
1045  if (!rz_core_write_at(core, addr, buf, buflen)) {
1046  RZ_LOG_ERROR("Could not write block operation at %" PFMT64x "\n", addr);
1047  free(buf);
1048  return false;
1049  }
1050 
1051  return true;
1052 }
1053 
1069 RZ_API bool rz_core_write_seq_at(RzCore *core, ut64 addr, ut64 from, ut64 to, ut64 step, int value_size) {
1070  rz_return_val_if_fail(core, false);
1071  rz_return_val_if_fail(value_size == 1 || value_size == 2 || value_size == 4 || value_size == 8, false);
1072  ut64 max_val = (1ULL << (8 * value_size));
1073  rz_return_val_if_fail(from < max_val, false);
1074  rz_return_val_if_fail(to < max_val, false);
1075 
1076  ut8 *buf = RZ_NEWS0(ut8, core->blocksize);
1077  if (!buf) {
1078  return false;
1079  }
1080 
1081  ut64 diff = to <= from ? max_val : to - from + 1;
1082  ut64 p = from;
1083  for (size_t i = 0; i < core->blocksize; i += value_size, p = (from + ((p + step - from) % diff)) % max_val) {
1084  rz_write_ble(buf + i, p, rz_config_get_b(core->config, "cfg.bigendian"), value_size * 8);
1085  }
1086 
1087  if (!rz_core_write_at(core, addr, buf, core->blocksize)) {
1088  RZ_LOG_ERROR("Could not write sequence [%" PFMT64d ", %" PFMT64d "] step=%" PFMT64d ",value_size=%d at %" PFMT64x "\n", from, to, step, value_size, addr);
1089  free(buf);
1090  return false;
1091  }
1092 
1093  free(buf);
1094  return true;
1095 }
1096 
1107  rz_return_val_if_fail(core, false);
1108  rz_return_val_if_fail(len >= 0, false);
1109 
1110  bool res = false;
1111  ut8 *data = RZ_NEWS(ut8, len);
1112  if (!data) {
1113  return false;
1114  }
1115 
1116  int n = rz_io_nread_at(core->io, from, data, len);
1117  if (n < 0) {
1118  RZ_LOG_ERROR("Cannot read data from %" PFMT64x ".\n", from);
1119  goto err;
1120  }
1121  if (!rz_core_write_at(core, addr, data, n)) {
1122  RZ_LOG_ERROR("Cannot write %d bytes to %" PFMT64x ".\n", n, addr);
1123  goto err;
1124  }
1125  res = true;
1126 err:
1127  free(data);
1128  return res;
1129 }
size_t len
Definition: 6502dis.c:15
RZ_API void * rz_asm_code_free(RzAsmCode *acode)
Definition: acode.c:11
lzma_index ** i
Definition: index.h:629
static bool err
Definition: armass.c:435
RZ_API int rz_asm_set_pc(RzAsm *a, ut64 pc)
Definition: asm.c:533
RZ_API RzAsmCode * rz_asm_massemble(RzAsm *a, const char *assembly)
Definition: asm.c:814
static const AvrInstruction instructions[]
Definition: assembler.c:880
RZ_API RzBinObject * rz_bin_cur_object(RzBin *bin)
Definition: bin.c:900
RZ_API RZ_BORROW RzBinSection * rz_bin_get_section_at(RzBinObject *o, ut64 off, int va)
Find the binary section at offset off.
Definition: bin.c:611
const char * desc
Definition: bin_vsf.c:19
int bits(struct state *s, int need)
Definition: blast.c:72
RZ_API bool rz_core_debug_continue_until(RzCore *core, ut64 addr, ut64 to)
Definition: cdebug.c:98
RZ_IPI void rz_core_debug_attach(RzCore *core, int pid)
Definition: cdebug.c:284
RZ_API int rz_core_setup_debugger(RzCore *r, const char *debugbackend, bool attach)
Definition: cio.c:7
RZ_API bool rz_core_write_block_op_at(RzCore *core, ut64 addr, RzCoreWriteOp op, ut8 *hex, int hexlen)
Write a full block of data according to the operation op and the hexvalue hex.
Definition: cio.c:1038
RZ_API bool rz_core_write_string_at(RzCore *core, ut64 addr, RZ_NONNULL const char *s)
Write a given string s at the specified addr.
Definition: cio.c:605
RZ_API bool rz_core_extend_at(RzCore *core, ut64 addr, ut64 size)
Extend the file at current offset by inserting size 0 bytes at addr.
Definition: cio.c:172
RZ_API bool rz_core_write_string_wide_at(RzCore *core, ut64 addr, const char *s)
Write a given string s as a wide string at the specified addr.
Definition: cio.c:630
RZ_API int rz_core_write_hexpair(RzCore *core, ut64 addr, const char *pairs)
Definition: cio.c:268
RZ_API bool rz_core_write_at(RzCore *core, ut64 addr, const ut8 *buf, int size)
Definition: cio.c:145
RZ_API bool rz_core_shift_block(RzCore *core, ut64 addr, ut64 b_size, st64 dist)
Shift a block of data from addr of size b_size left or right based on dist.
Definition: cio.c:197
RZ_API RzCmdStatus rz_core_io_pcache_print(RzCore *core, RzIODesc *desc, RzCmdStateOutput *state)
Definition: cio.c:854
RZ_API RzCmdStatus rz_core_io_cache_print(RzCore *core, RzCmdStateOutput *state)
Definition: cio.c:797
RZ_API void rz_core_arch_bits_at(RzCore *core, ut64 addr, RZ_OUT RZ_NULLABLE int *bits, RZ_OUT RZ_BORROW RZ_NULLABLE const char **arch)
Definition: cio.c:97
RZ_API RzCmdStatus rz_core_io_plugin_print(RzIOPlugin *plugin, RzCmdStateOutput *state)
Print an IO plugin according to state.
Definition: cio.c:408
RZ_API void rz_core_seek_arch_bits(RzCore *core, ut64 addr)
Definition: cio.c:132
RZ_API bool rz_core_write_block(RzCore *core, ut64 addr, ut8 *data, size_t len)
Definition: cio.c:299
RZ_API bool rz_core_write_string_zero_at(RzCore *core, ut64 addr, const char *s)
Write a given string s, followed by the zero terminator, at the specified addr.
Definition: cio.c:905
RZ_API int rz_core_write_assembly(RzCore *core, ut64 addr, RZ_NONNULL const char *instructions)
Assembles instructions and writes the resulting data at the given offset.
Definition: cio.c:327
RZ_API int rz_core_block_read(RzCore *core)
Definition: cio.c:243
RZ_API bool rz_core_write_base64d_at(RzCore *core, ut64 addr, RZ_NONNULL const char *s)
Write a given base64 string s at the specified addr, decoded.
Definition: cio.c:745
RZ_API bool rz_core_write_value_inc_at(RzCore *core, ut64 addr, st64 value, int sz)
Write at addr the current value + value passed as argument.
Definition: cio.c:551
RZ_API bool rz_core_write_length_string_at(RzCore *core, ut64 addr, const char *s)
Write at the specified addr the length of the string in one byte, followed by the given string s.
Definition: cio.c:673
RZ_API bool rz_core_dump(RzCore *core, const char *file, ut64 addr, ut64 size, int append)
Definition: cio.c:50
RZ_API int rz_core_is_valid_offset(RzCore *core, ut64 offset)
Definition: cio.c:250
RZ_API bool rz_core_write_seq_at(RzCore *core, ut64 addr, ut64 from, ut64 to, ut64 step, int value_size)
Write a full block of data with a sequence.
Definition: cio.c:1069
RZ_API bool rz_core_write_base64_at(RzCore *core, ut64 addr, RZ_NONNULL const char *s)
Write a given string s at the specified addr encoded as base64.
Definition: cio.c:700
RZ_API bool rz_core_write_random_at(RzCore *core, ut64 addr, size_t len)
Write len random bytes at address addr.
Definition: cio.c:773
RZ_API int rz_core_write_assembly_fill(RzCore *core, ut64 addr, RZ_NONNULL const char *instructions)
Assemble instructions and write the resulting data inside the current instruction.
Definition: cio.c:365
RZ_API RzCmdStatus rz_core_io_plugins_print(RzIO *io, RzCmdStateOutput *state)
Print the registered IO plugins according to state.
Definition: cio.c:481
RZ_API bool rz_core_write_duplicate_at(RzCore *core, ut64 addr, ut64 from, int len)
Copy len bytes from from to addr.
Definition: cio.c:1106
RZ_API bool rz_core_write_value_at(RzCore *core, ut64 addr, ut64 value, int sz)
Write a given value at the specified address, using sz bytes.
Definition: cio.c:506
RZ_API RZ_OWN ut8 * rz_core_transform_op(RzCore *core, ut64 addr, RzCoreWriteOp op, ut8 *hex, int hexlen, int *buflen)
Transform a block of data at addr according to the operation op and the hexvalue hex.
Definition: cio.c:934
RZ_API void rz_cmd_state_output_set_columnsf(RzCmdStateOutput *state, const char *fmt,...)
Specify the columns of the command output.
Definition: cmd_api.c:2589
RZ_API void rz_cmd_state_output_array_start(RzCmdStateOutput *state)
Mark the start of an array of elements in the output.
Definition: cmd_api.c:2558
static int value
Definition: cmd_api.c:93
RZ_API void rz_cmd_state_output_array_end(RzCmdStateOutput *state)
Mark the end of an array of elements in the output.
Definition: cmd_api.c:2572
#define append(x, y)
Definition: cmd_print.c:1740
RZ_IPI bool rz_core_seek_to_register(RzCore *core, const char *regname, bool is_silent)
Definition: cmd_seek.c:22
RZ_API ut64 rz_config_get_i(RzConfig *cfg, RZ_NONNULL const char *name)
Definition: config.c:119
RZ_API bool rz_config_get_b(RzConfig *cfg, RZ_NONNULL const char *name)
Definition: config.c:142
RZ_API RzConfigNode * rz_config_set(RzConfig *cfg, RZ_NONNULL const char *name, const char *value)
Definition: config.c:267
RZ_API RzConfigNode * rz_config_set_i(RzConfig *cfg, RZ_NONNULL const char *name, const ut64 i)
Definition: config.c:419
RZ_API RZ_BORROW const char * rz_config_get(RzConfig *cfg, RZ_NONNULL const char *name)
Definition: config.c:75
RZ_API void rz_cons_break_pop(void)
Definition: cons.c:361
RZ_API void rz_cons_break_push(RzConsBreak cb, void *user)
Definition: cons.c:357
RZ_API int rz_cons_printf(const char *format,...)
Definition: cons.c:1202
RZ_API bool rz_cons_is_breaked(void)
Definition: cons.c:373
#define RZ_API
RZ_API void rz_core_reg_update_flags(RzCore *core)
Update or create flags for all registers where it makes sense.
Definition: creg.c:106
#define NULL
Definition: cris-opc.c:27
#define r
Definition: crypto_rc6.c:12
cs_arch arch
Definition: cstool.c:13
#define ut8
Definition: dcpu16.h:8
uint16_t ut16
uint32_t ut32
static states step(struct re_guts *, sopno, sopno, states, int, states)
Definition: engine.c:888
size_t map(int syms, int left, int len)
Definition: enough.c:237
RZ_API bool rz_core_hack(RzCore *core, const char *op)
Write/Modify instructions at current offset based on op.
Definition: hack.c:280
RZ_API int rz_analysis_hint_bits_at(RzAnalysis *analysis, ut64 addr, RZ_NULLABLE ut64 *hint_addr)
Definition: hint.c:397
RZ_API RZ_NULLABLE RZ_BORROW const char * rz_analysis_hint_arch_at(RzAnalysis *analysis, ut64 addr, RZ_NULLABLE ut64 *hint_addr)
Definition: hint.c:382
RZ_API void Ht_() free(HtName_(Ht) *ht)
Definition: ht_inc.c:130
voidpf void uLong size
Definition: ioapi.h:138
voidpf uLong offset
Definition: ioapi.h:144
voidpf void * buf
Definition: ioapi.h:138
uint8_t ut8
Definition: lh5801.h:11
void * p
Definition: libc.cpp:67
RZ_API bool rz_debug_select(RzDebug *dbg, int pid, int tid)
Definition: debug.c:595
RZ_API void rz_list_free(RZ_NONNULL RzList *list)
Empties the list and frees the list pointer.
Definition: list.c:137
void * malloc(size_t size)
Definition: malloc.c:123
void * calloc(size_t number, size_t size)
Definition: malloc.c:102
static static fork const void static count static fd const char const char static newpath char char char static envp time_t static t const char static mode static whence const char static dir time_t static t unsigned static seconds const char struct utimbuf static buf static inc pid
Definition: sflib.h:64
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
string FILE
Definition: benchmark.py:21
RZ_API int rz_analysis_op(RzAnalysis *analysis, RzAnalysisOp *op, ut64 addr, const ut8 *data, int len, RzAnalysisOpMask mask)
Definition: op.c:96
static const char hex[16]
Definition: print.c:21
#define eprintf(x, y...)
Definition: rlcc.c:7
static RzSocket * s
Definition: rtr.c:28
@ RZ_ANALYSIS_OP_MASK_BASIC
Definition: rz_analysis.h:440
#define rz_warn_if_reached()
Definition: rz_assert.h:29
#define rz_return_val_if_fail(expr, val)
Definition: rz_assert.h:108
RZ_API size_t rz_base64_encode(char *bout, const ut8 *bin, size_t sz)
Definition: ubase64.c:81
RZ_API int rz_base64_decode(ut8 *bout, const char *bin, int len)
Definition: ubase64.c:48
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_NONEXISTINGCMD
command does not exist
Definition: rz_cmd.h:28
@ RZ_CMD_STATUS_ERROR
command handler had issues while running (e.g. allocation error, etc.)
Definition: rz_cmd.h:26
RzCoreWriteOp
Definition: rz_core.h:105
@ RZ_CORE_WRITE_OP_BYTESWAP8
Swap the endianess of 8-bytes values.
Definition: rz_core.h:108
@ RZ_CORE_WRITE_OP_SHIFT_LEFT
Write the shift left of existing byte by argument value.
Definition: rz_core.h:116
@ RZ_CORE_WRITE_OP_AND
Write the bitwise-and of existing byte and argument value.
Definition: rz_core.h:113
@ RZ_CORE_WRITE_OP_SHIFT_RIGHT
Write the shift right of existing byte and argument value.
Definition: rz_core.h:117
@ RZ_CORE_WRITE_OP_BYTESWAP2
Swap the endianess of 2-bytes values.
Definition: rz_core.h:106
@ RZ_CORE_WRITE_OP_OR
Write the bitwise-or of existing byte and argument value.
Definition: rz_core.h:114
@ RZ_CORE_WRITE_OP_ADD
Write the addition of existing byte and argument value.
Definition: rz_core.h:109
@ RZ_CORE_WRITE_OP_MUL
Write the multiplication of existing byte and argument value.
Definition: rz_core.h:112
@ RZ_CORE_WRITE_OP_DIV
Write the division of existing byte and argument value.
Definition: rz_core.h:111
@ RZ_CORE_WRITE_OP_BYTESWAP4
Swap the endianess of 4-bytes values.
Definition: rz_core.h:107
@ RZ_CORE_WRITE_OP_XOR
Write the bitwise-xor of existing byte and argument value.
Definition: rz_core.h:115
@ RZ_CORE_WRITE_OP_SUB
Write the subtraction of existing byte and argument value.
Definition: rz_core.h:110
static ut64 rz_read_ble64(const void *src, bool big_endian)
Definition: rz_endian.h:501
static ut8 rz_read_ble8(const void *src)
Definition: rz_endian.h:12
static void rz_write_be16(void *dest, ut16 val)
Definition: rz_endian.h:60
static void rz_write_ble8(void *dest, ut8 val)
Definition: rz_endian.h:23
static ut16 rz_read_le16(const void *src)
Definition: rz_endian.h:206
static void rz_write_be64(void *dest, ut64 val)
Definition: rz_endian.h:119
static void rz_write_ble(void *dst, ut64 val, bool big_endian, int size)
Definition: rz_endian.h:548
static ut32 rz_read_le32(const void *src)
Definition: rz_endian.h:239
static ut32 rz_read_ble32(const void *src, bool big_endian)
Definition: rz_endian.h:497
static ut16 rz_read_ble16(const void *src, bool big_endian)
Definition: rz_endian.h:493
static void rz_write_ble32(void *dest, ut32 val, bool big_endian)
Definition: rz_endian.h:540
static void rz_write_ble64(void *dest, ut64 val, bool big_endian)
Definition: rz_endian.h:544
static void rz_write_ble16(void *dest, ut16 val, bool big_endian)
Definition: rz_endian.h:532
static ut64 rz_read_le64(const void *src)
Definition: rz_endian.h:266
static void rz_write_be32(void *dest, ut32 val)
Definition: rz_endian.h:98
RZ_API int rz_hex_str2bin(const char *in, ut8 *out)
Convert an input string in into the binary form in out.
Definition: hex.c:444
RZ_API char * rz_hex_bin2strdup(const ut8 *in, int len)
Definition: hex.c:415
RZ_API bool rz_io_read_at(RzIO *io, ut64 addr, ut8 *buf, int len)
Definition: io.c:300
RZ_API bool rz_io_extend_at(RzIO *io, ut64 addr, ut64 size)
Extend the RzIODesc at addr by inserting size 0 bytes.
Definition: io.c:453
RZ_API ut64 rz_io_size(RzIO *io)
Definition: io.c:399
RZ_API RzIOMap * rz_io_map_get(RzIO *io, ut64 addr)
Definition: io_map.c:176
RZ_API RzList * rz_io_desc_cache_list(RzIODesc *desc)
Definition: p_cache.c:249
RZ_API RzIODesc * rz_io_desc_get(RzIO *io, int fd)
Definition: io_desc.c:73
RZ_API int rz_io_desc_get_pid(RzIODesc *desc)
Definition: io_desc.c:310
RZ_API bool rz_io_read_at_mapped(RzIO *io, ut64 addr, ut8 *buf, int len)
Definition: io.c:318
RZ_API bool rz_io_is_valid_offset(RzIO *io, ut64 offset, int hasperm)
Definition: ioutils.c:20
RZ_API bool rz_io_write_at(RzIO *io, ut64 addr, const ut8 *buf, int len)
Definition: io.c:358
RZ_API bool rz_io_use_fd(RzIO *io, int fd)
Definition: io_fd.c:118
RZ_API int rz_io_nread_at(RzIO *io, ut64 addr, ut8 *buf, int len)
Definition: io.c:338
static ut64 rz_itv_begin(RzInterval itv)
Definition: rz_itv.h:34
static ut64 rz_itv_size(RzInterval itv)
Definition: rz_itv.h:38
#define RZ_LOG_ERROR(fmtstr,...)
Definition: rz_log.h:58
RZ_API void rz_mem_copyloop(ut8 *dest, const ut8 *orig, int dsize, int osize)
Definition: mem.c:41
RZ_API ut64 rz_num_math(RzNum *num, const char *str)
Definition: unum.c:456
RZ_API int rz_num_rand(int max)
Definition: unum.c:47
RZ_API void rz_num_irand(void)
Definition: unum.c:43
RZ_API PJ * pj_kb(PJ *j, const char *k, bool v)
Definition: pj.c:177
RZ_API PJ * pj_k(PJ *j, const char *k)
Definition: pj.c:104
RZ_API PJ * pj_end(PJ *j)
Definition: pj.c:87
RZ_API PJ * pj_o(PJ *j)
Definition: pj.c:75
RZ_API PJ * pj_s(PJ *j, const char *k)
Definition: pj.c:197
RZ_API PJ * pj_ks(PJ *j, const char *k, const char *v)
Definition: pj.c:170
RZ_API PJ * pj_kn(PJ *j, const char *k, ut64 n)
Definition: pj.c:121
RZ_API PJ * pj_a(PJ *j)
Definition: pj.c:81
RZ_API RzList * rz_str_split_list(char *str, const char *c, int n)
Split the string str according to the substring c and returns a RzList with the result.
Definition: str.c:3429
RZ_API int rz_str_unescape(char *buf)
Definition: str.c:1300
RZ_API char RZ_API void rz_sys_backtrace(void)
Print the backtrace at the point this function is called from.
Definition: sys.c:265
RZ_API int rz_sys_truncate(const char *file, int sz)
Definition: sys.c:1692
RZ_API FILE * rz_sys_fopen(const char *path, const char *mode)
Definition: sys.c:1815
@ RZ_SYS_BITS_32
Definition: rz_sys.h:20
@ RZ_SYS_BITS_64
Definition: rz_sys.h:21
@ RZ_SYS_BITS_16
Definition: rz_sys.h:19
RZ_API void rz_table_add_rowf(RzTable *t, const char *fmt,...)
Definition: table.c:316
RZ_API void rz_table_set_columnsf(RzTable *t, const char *fmt,...)
Specify the types and names of the referenced table.
Definition: table.c:234
#define RZ_NEWS(x, y)
Definition: rz_types.h:283
#define PFMT64d
Definition: rz_types.h:394
#define PFMTSZu
Definition: rz_types.h:399
#define RZ_NULLABLE
Definition: rz_types.h:65
#define RZ_OWN
Definition: rz_types.h:62
#define RZ_OUT
Definition: rz_types.h:51
#define RZ_NONNULL
Definition: rz_types.h:64
#define RZ_NEWS0(x, y)
Definition: rz_types.h:282
#define PFMT64u
Definition: rz_types.h:395
@ RZ_OUTPUT_MODE_TABLE
Definition: rz_types.h:46
@ 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
#define RZ_BORROW
Definition: rz_types.h:63
#define st64
Definition: rz_types_base.h:10
#define UT32_MAX
Definition: rz_types_base.h:99
#define UT64_32U
Definition: rz_types_base.h:90
#define UT64_MAX
Definition: rz_types_base.h:86
#define UT8_MAX
#define UT16_MAX
#define rz_pvector_foreach(vec, it)
Definition: rz_vector.h:334
RZ_API bool rz_core_seek_delta(RzCore *core, st64 delta, bool save)
Seek relative to current offset and optionally save the current offset in seek history.
Definition: seek.c:152
RZ_API bool rz_core_seek(RzCore *core, ut64 addr, bool rb)
Seek to addr.
Definition: seek.c:116
static struct sockaddr static addrlen static backlog const void static flags void struct sockaddr from
Definition: sfsocketcall.h:123
static struct sockaddr static addrlen static backlog const void static flags void struct sockaddr socklen_t static fromlen const void const struct sockaddr to
Definition: sfsocketcall.h:125
#define c(i)
Definition: sha256.c:43
Definition: gzappend.c:170
Definition: rz_pj.h:12
ut8 * bytes
Definition: rz_asm.h:80
Represent the output state of a command handler.
Definition: rz_cmd.h:91
RzBin * bin
Definition: rz_core.h:298
ut64 offset
Definition: rz_core.h:301
RzAsm * rasm
Definition: rz_core.h:323
RzAnalysis * analysis
Definition: rz_core.h:322
RzIO * io
Definition: rz_core.h:313
RzNum * num
Definition: rz_core.h:316
bool fixedbits
Definition: rz_core.h:375
ut8 * block
Definition: rz_core.h:305
bool fixedarch
Definition: rz_core.h:376
RzCoreFile * file
Definition: rz_core.h:314
ut32 blocksize
Definition: rz_core.h:303
RzConfig * config
Definition: rz_core.h:300
const char * name
Definition: rz_io.h:115
const char * version
Definition: rz_io.h:117
const char * uris
Definition: rz_io.h:121
int(* write)(RzIO *io, RzIODesc *fd, const ut8 *buf, int count)
Definition: rz_io.h:131
const char * license
Definition: rz_io.h:119
bool isdbg
Definition: rz_io.h:124
const char * author
Definition: rz_io.h:118
const char * desc
Definition: rz_io.h:116
Definition: rz_io.h:59
int va
Definition: rz_io.h:63
RzPVector cache
Definition: rz_io.h:76
RzList * plugins
Definition: rz_io.h:80
ut64 value
Definition: rz_num.h:63
Definition: dis.h:43
ut64 buflen
Definition: core.c:76
Definition: dis.c:32
ut64(WINAPI *w32_GetEnabledXStateFeatures)()
static const z80_opcode fd[]
Definition: z80_tab.h:997
static int addr
Definition: z80asm.c:58