Rizin
unix-like reverse engineering framework and cli tools
cmd_open.c
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: 2009-2021 pancake <pancake@nopcode.org>
2 // SPDX-License-Identifier: LGPL-3.0-only
3 
4 #include <rz_bin.h>
5 #include <rz_debug.h>
6 #include <rz_core.h>
7 #include <rz_io.h>
8 #include "../core_private.h"
9 
12  int fdsz;
13 };
14 
15 static bool core_bin_reload(RzCore *r, const char *file, ut64 baseaddr) {
17  if (!cf) {
18  return false;
19  }
20  RzBinFile *obf = rz_bin_file_find_by_fd(r->bin, cf->fd);
21  if (!obf) {
22  return false;
23  }
24  RzBinFile *nbf = rz_bin_reload(r->bin, obf, baseaddr);
25  if (!nbf) {
26  return false;
27  }
29  return true;
30 }
31 
32 static bool reopen_in_malloc_cb(void *user, void *data, ut32 id) {
33  RzIO *io = (RzIO *)user;
34  RzIODesc *desc = (RzIODesc *)data;
35 
37  return true;
38  }
39 
40  if (strstr(desc->uri, "://")) {
41  return true;
42  }
43 
45 
46  char *uri = rz_str_newf("malloc://%" PFMT64u, size);
47  if (!uri) {
48  return false;
49  }
50 
51  ut8 *buf = malloc(size);
52  // if malloc fails, we can just abort the loop by returning false
53  if (!buf) {
54  free(uri);
55  return false;
56  }
57 
58  RzIODesc *ndesc = rz_io_open_nomap(io, uri, RZ_PERM_RW, 0);
59  free(uri);
60  if (!ndesc) {
61  free(buf);
62  return false;
63  }
64 
65  rz_io_desc_read_at(desc, 0LL, buf, (int)size); // that cast o_O
66  rz_io_desc_write_at(ndesc, 0LL, buf, (int)size);
67  free(buf);
68  rz_io_desc_exchange(io, desc->fd, ndesc->fd);
69 
71  return true;
72 }
73 
75  if (core && core->io && core->io->files) {
77  }
78 }
79 
80 static bool init_desc_list_visual_cb(void *user, void *data, ut32 id) {
81  struct open_list_ascii_data_t *u = (struct open_list_ascii_data_t *)user;
82  RzIODesc *desc = (RzIODesc *)data;
84  if (sz > u->fdsz) {
85  u->fdsz = sz;
86  }
87  return true;
88 }
89 
90 static bool desc_list_visual_cb(void *user, void *data, ut32 id) {
91  struct open_list_ascii_data_t *u = (struct open_list_ascii_data_t *)user;
92  RzPrint *p = u->p;
93  RzIODesc *desc = (RzIODesc *)data;
95  rz_cons_printf("%2d %c %s 0x%08" PFMT64x " ", desc->fd,
96  (desc->io && (desc->io->desc == desc)) ? '*' : '-', rz_str_rwx_i(desc->perm), sz);
97  int flags = p->flags;
98  p->flags &= ~RZ_PRINT_FLAGS_HEADER;
99  rz_print_progressbar(p, sz * 100 / u->fdsz, rz_cons_get_size(NULL) - 40);
100  p->flags = flags;
101  rz_cons_printf(" %s\n", desc->uri);
102  return true;
103 }
104 
105 static bool desc_list_quiet_cb(void *user, void *data, ut32 id) {
106  RzPrint *p = (RzPrint *)user;
107  RzIODesc *desc = (RzIODesc *)data;
108  p->cb_printf("%d\n", desc->fd);
109  return true;
110 }
111 
112 static bool desc_list_cb(void *user, void *data, ut32 id) {
113  RzPrint *p = (RzPrint *)user;
114  RzIODesc *desc = (RzIODesc *)data;
115  p->cb_printf("%2d %c %s 0x%08" PFMT64x " %s\n", desc->fd,
116  (desc->io && (desc->io->desc == desc)) ? '*' : '-',
117  rz_str_rwx_i(desc->perm), rz_io_desc_size(desc), desc->uri);
118  return true;
119 }
120 
121 static bool desc_list_json_cb(void *user, void *data, ut32 id) {
122  PJ *pj = (PJ *)user;
123  RzIODesc *desc = (RzIODesc *)data;
124  // TODO: from is always 0? See librz/core/file.c:945
125  ut64 from = 0LL;
126  pj_o(pj);
127  pj_kb(pj, "raised", desc->io && (desc->io->desc == desc));
128  pj_kN(pj, "fd", desc->fd);
129  pj_ks(pj, "uri", desc->uri);
130  pj_kn(pj, "from", from);
131  pj_kb(pj, "writable", desc->perm & RZ_PERM_W);
132  pj_kN(pj, "size", rz_io_desc_size(desc));
133  pj_end(pj);
134  return true;
135 }
136 
137 static bool desc_list_table_cb(void *user, void *data, ut32 id) {
138  RzTable *t = (RzTable *)user;
139  RzIODesc *desc = (RzIODesc *)data;
140  rz_table_add_rowf(t, "dbsXs", desc->fd, desc->io && (desc->io->desc == desc),
141  rz_str_rwx_i(desc->perm), rz_io_desc_size(desc), desc->uri);
142  return true;
143 }
144 
145 RZ_IPI RzCmdStatus rz_open_close_handler(RzCore *core, int argc, const char **argv) {
146  if (!rz_num_is_valid_input(NULL, argv[1])) {
147  RZ_LOG_ERROR("Invalid fd: %s\n", argv[1]);
148  return RZ_CMD_STATUS_ERROR;
149  }
150  int fd = (int)rz_num_math(NULL, argv[1]);
151  if (!rz_core_file_close_fd(core, fd)) {
152  RZ_LOG_ERROR("Unable to find file descriptor %d\n", fd);
153  return RZ_CMD_STATUS_ERROR;
154  }
155  return RZ_CMD_STATUS_OK;
156 }
157 
158 RZ_IPI RzCmdStatus rz_open_close_all_handler(RzCore *core, int argc, const char **argv) {
159  rz_core_file_close_fd(core, -1);
160  rz_io_close_all(core->io);
162 
163  // TODO: Move to a-- ?
165  // TODO: Move to f-- ?
166  rz_flag_unset_all(core->flags);
167  RZ_LOG_INFO("Close all files\n");
168  return RZ_CMD_STATUS_OK;
169 }
170 RZ_IPI RzCmdStatus rz_open_list_ascii_handler(RzCore *core, int argc, const char **argv) {
171  struct open_list_ascii_data_t data = { 0 };
172  data.p = core->print;
173  data.fdsz = 0;
176  return RZ_CMD_STATUS_OK;
177 }
178 
179 RZ_IPI RzCmdStatus rz_open_arch_bits_handler(RzCore *core, int argc, const char **argv) {
180  const char *filename = argc > 3 ? argv[3] : NULL;
181  ut16 bits = rz_num_math(core->num, argv[2]);
182  const char *arch = argv[1];
183 
184  int res = rz_core_bin_set_arch_bits(core, filename, arch, bits);
185  return res ? RZ_CMD_STATUS_OK : RZ_CMD_STATUS_ERROR;
186 }
187 
188 RZ_IPI RzCmdStatus rz_open_use_handler(RzCore *core, int argc, const char **argv) {
189  RzListIter *iter = NULL;
190  RzCoreFile *f;
191 
192  int fdnum = rz_num_math(NULL, argv[1]);
193  rz_list_foreach (core->files, iter, f) {
194  if (f->fd == fdnum) {
195  core->file = f;
196  rz_io_use_fd(core->io, fdnum);
197  RzBinFile *bf = rz_bin_file_find_by_fd(core->bin, fdnum);
198  if (!bf) {
199  RZ_LOG_ERROR("Could not find binfile with fd %d\n", fdnum);
200  return RZ_CMD_STATUS_ERROR;
201  }
202  rz_core_bin_raise(core, bf->id);
203  rz_core_block_read(core);
204  RZ_LOG_INFO("Switched to fd %d (%s)\n", fdnum, bf->file);
205  return RZ_CMD_STATUS_OK;
206  }
207  }
208  RZ_LOG_ERROR("Could not find any opened file with fd %d\n", fdnum);
209  return RZ_CMD_STATUS_ERROR;
210 }
211 
212 static RzCmdStatus prioritize_file(RzCore *core, int fd) {
213  if (fd <= 0) {
214  RZ_LOG_ERROR("Wrong file descriptor %d\n", fd);
215  return RZ_CMD_STATUS_ERROR;
216  }
217  int curfd = rz_io_fd_get_current(core->io);
218  if (fd == curfd) {
219  return RZ_CMD_STATUS_OK;
220  }
221 
222  if (!rz_io_use_fd(core->io, fd)) {
223  RZ_LOG_ERROR("Could not use IO fd %d\n", fd);
224  return RZ_CMD_STATUS_ERROR;
225  }
226  rz_core_block_read(core);
227  RzBinFile *bf = rz_bin_file_find_by_fd(core->bin, fd);
228  if (bf && !rz_core_bin_raise(core, bf->id)) {
229  RZ_LOG_ERROR("Could not use bin id %d\n", bf->id);
230  return RZ_CMD_STATUS_ERROR;
231  }
232  return RZ_CMD_STATUS_OK;
233 }
234 
235 RZ_IPI RzCmdStatus rz_open_prioritize_handler(RzCore *core, int argc, const char **argv) {
236  int fd = atoi(argv[1]);
237  return prioritize_file(core, fd);
238 }
239 
241  int fd = rz_io_fd_get_next(core->io, rz_io_fd_get_current(core->io));
242  return prioritize_file(core, fd);
243 }
244 
246  int fd = rz_io_fd_get_prev(core->io, rz_io_fd_get_current(core->io));
247  return prioritize_file(core, fd);
248 }
249 
251  int fd = rz_io_fd_get_next(core->io, rz_io_fd_get_current(core->io));
252  if (fd == -1) {
253  fd = rz_io_fd_get_lowest(core->io);
254  }
256 }
257 
258 RZ_IPI RzCmdStatus rz_open_maps_remove_handler(RzCore *core, int argc, const char **argv) {
259  if (!rz_num_is_valid_input(NULL, argv[1])) {
260  RZ_LOG_ERROR("Invalid map id '%s'\n", argv[1]);
261  return RZ_CMD_STATUS_ERROR;
262  }
263  ut32 map_id = rz_num_math(NULL, argv[1]);
264  if (!rz_io_map_del(core->io, map_id)) {
265  RZ_LOG_ERROR("Could not delete IO map %d\n", map_id);
266  return RZ_CMD_STATUS_ERROR;
267  }
268  return RZ_CMD_STATUS_OK;
269 }
270 
272  rz_io_map_reset(core->io);
273  return RZ_CMD_STATUS_OK;
274 }
275 
278  if (!list) {
279  return RZ_CMD_STATUS_ERROR;
280  }
281  void **it;
282  RzPVector *maps = rz_io_maps(core->io);
284  RzIOMap *map = *it;
285  char temp[32];
286  rz_strf(temp, "%d", map->fd);
287  RzListInfo *info = rz_listinfo_new(map->name, map->itv, map->itv, map->perm, temp);
288  if (!info) {
289  break;
290  }
292  }
293  RzTable *table = rz_core_table(core);
294  rz_table_visual_list(table, list, core->offset, core->blocksize,
295  rz_cons_get_size(NULL), rz_config_get_i(core->config, "scr.color"));
296  char *tablestr = rz_table_tostring(table);
297  rz_cons_printf("%s", tablestr);
298  rz_table_free(table);
300  free(tablestr);
301  return RZ_CMD_STATUS_OK;
302 }
303 
304 RZ_IPI RzCmdStatus rz_open_maps_all_fd_handler(RzCore *core, int argc, const char **argv) {
305  ut32 fd = argc > 1 ? rz_num_math(NULL, argv[1]) : rz_io_fd_get_current(core->io);
306  RzIODesc *desc = rz_io_desc_get(core->io, fd);
307  if (!desc) {
308  RZ_LOG_ERROR("Could not find any file descriptor with fd %d\n", fd);
309  return RZ_CMD_STATUS_ERROR;
310  }
311  RzIOMap *map = rz_io_map_add(core->io, fd, desc->perm, 0, 0, UT64_MAX);
312  if (!map) {
313  RZ_LOG_ERROR("Could not create a IO map for file descriptor %d\n", fd);
314  return RZ_CMD_STATUS_ERROR;
315  }
316  rz_io_map_set_name(map, desc->name);
317  return RZ_CMD_STATUS_OK;
318 }
319 
321  if (!rz_num_is_valid_input(NULL, argv[1])) {
322  RZ_LOG_ERROR("Invalid map id '%s'\n", argv[1]);
323  return RZ_CMD_STATUS_ERROR;
324  }
325  if (!rz_num_is_valid_input(core->num, argv[2])) {
326  RZ_LOG_ERROR("Invalid address '%s'\n", argv[2]);
327  return RZ_CMD_STATUS_ERROR;
328  }
329  ut32 map_id = (ut32)rz_num_math(NULL, argv[1]);
330  ut64 addr = rz_num_math(core->num, argv[2]);
331  if (!rz_io_map_remap(core->io, map_id, addr)) {
332  RZ_LOG_ERROR("Could not relocate map with id %d to %" PFMT64x "\n", map_id, addr);
333  return RZ_CMD_STATUS_ERROR;
334  }
335  return RZ_CMD_STATUS_OK;
336 }
337 
339  if (!rz_num_is_valid_input(core->num, argv[1])) {
340  RZ_LOG_ERROR("Invalid address '%s'\n", argv[1]);
341  return RZ_CMD_STATUS_ERROR;
342  }
343  RzIOMap *map = rz_io_map_get(core->io, core->offset);
344  if (!map) {
345  RZ_LOG_ERROR("Could not find any IO map at current offset\n");
346  return RZ_CMD_STATUS_ERROR;
347  }
348  ut64 addr = rz_num_math(core->num, argv[1]);
349  if (!rz_io_map_remap(core->io, map->id, addr)) {
350  RZ_LOG_ERROR("Could not relocate map with id %d to %" PFMT64x "\n", map->id, addr);
351  return RZ_CMD_STATUS_ERROR;
352  }
353  return RZ_CMD_STATUS_OK;
354 }
355 
356 RZ_IPI RzCmdStatus rz_open_maps_resize_handler(RzCore *core, int argc, const char **argv) {
357  if (!rz_num_is_valid_input(NULL, argv[1])) {
358  RZ_LOG_ERROR("Invalid map id '%s'\n", argv[1]);
359  return RZ_CMD_STATUS_ERROR;
360  }
361  if (!rz_num_is_valid_input(core->num, argv[2])) {
362  RZ_LOG_ERROR("Invalid size '%s'\n", argv[2]);
363  return RZ_CMD_STATUS_ERROR;
364  }
365  ut32 map_id = (ut32)rz_num_math(NULL, argv[1]);
366  ut64 size = rz_num_math(core->num, argv[2]);
367  if (!rz_io_map_resize(core->io, map_id, size)) {
368  RZ_LOG_ERROR("Could not resize map with id %d to %" PFMT64x "\n", map_id, size);
369  return RZ_CMD_STATUS_ERROR;
370  }
371  return RZ_CMD_STATUS_OK;
372 }
373 
375  ut32 id = (ut32)rz_num_math(core->num, argv[1]);
376  if (!rz_io_map_exists_for_id(core->io, id)) {
377  RZ_LOG_ERROR("Cannot find any map with mapid %d\n", id);
378  return RZ_CMD_STATUS_ERROR;
379  }
380  rz_io_map_priorize(core->io, id);
381  rz_core_block_read(core);
382  return RZ_CMD_STATUS_OK;
383 }
384 
386  ut32 id = (ut32)rz_num_math(core->num, argv[1]);
387  if (!rz_bin_file_set_cur_by_id(core->bin, id)) {
388  RZ_LOG_ERROR("Cannot prioritize bin with fd %d\n", id);
389  return RZ_CMD_STATUS_ERROR;
390  }
391  RzListIter *it;
392  RzCoreFile *file = NULL;
393  rz_list_foreach (core->files, it, file) {
394  void **binfile;
395  rz_pvector_foreach (&file->binfiles, binfile) {
396  RzBinFile *bf = *binfile;
397  if (bf->id == id) {
398  void **map;
399  rz_pvector_foreach (&file->maps, map) {
400  RzIOMap *m = *map;
401  rz_io_map_priorize(core->io, m->id);
402  }
403  }
404  }
405  }
406  return RZ_CMD_STATUS_OK;
407 }
408 
410  ut32 id = (ut32)rz_num_math(core->num, argv[1]);
411  if (!rz_io_map_exists_for_id(core->io, id)) {
412  RZ_LOG_ERROR("Cannot find any map with mapid %d\n", id);
413  return RZ_CMD_STATUS_ERROR;
414  }
415  rz_io_map_depriorize(core->io, id);
416  rz_core_block_read(core);
417  return RZ_CMD_STATUS_OK;
418 }
419 
421  int fd = (int)rz_num_math(core->num, argv[1]);
422  if (!rz_io_map_priorize_for_fd(core->io, fd)) {
423  RZ_LOG_ERROR("Cannot prioritize any map for fd %d\n", fd);
424  return RZ_CMD_STATUS_ERROR;
425  }
426  return RZ_CMD_STATUS_OK;
427 }
428 
429 RZ_IPI RzCmdStatus rz_open_maps_name_handler(RzCore *core, int argc, const char **argv) {
430  RzIOMap *map = rz_io_map_get(core->io, core->offset);
431  if (!map) {
432  RZ_LOG_ERROR("Cannot find any map at address %" PFMT64x "d\n", core->offset);
433  return RZ_CMD_STATUS_ERROR;
434  }
436  return RZ_CMD_STATUS_OK;
437 }
438 
440  RzIOMap *map = rz_io_map_get(core->io, core->offset);
441  if (!map) {
442  RZ_LOG_ERROR("Cannot find any map at address %" PFMT64x "\n", core->offset);
443  return RZ_CMD_STATUS_ERROR;
444  }
446  return RZ_CMD_STATUS_OK;
447 }
448 
450  ut32 id = rz_num_math(core->num, argv[1]);
451  RzIOMap *map = rz_io_map_resolve(core->io, id);
452  if (!map) {
453  RZ_LOG_ERROR("Cannot find any map with id %d\n", id);
454  return RZ_CMD_STATUS_ERROR;
455  }
457  return RZ_CMD_STATUS_OK;
458 }
459 
461  ut32 id = rz_num_math(core->num, argv[1]);
462  RzIOMap *map = rz_io_map_resolve(core->io, id);
463  if (!map) {
464  RZ_LOG_ERROR("Cannot find any map with id %d\n", id);
465  return RZ_CMD_STATUS_ERROR;
466  }
468  return RZ_CMD_STATUS_OK;
469 }
470 
471 RZ_IPI RzCmdStatus rz_open_maps_map_fd_handler(RzCore *core, int argc, const char **argv) {
472  ut32 fd = argc > 1 ? rz_num_math(NULL, argv[1]) : rz_io_fd_get_current(core->io);
473  RzIODesc *desc = rz_io_desc_get(core->io, fd);
474  if (!desc) {
475  RZ_LOG_ERROR("Cannot find any descriptor with fd %d\n", fd);
476  return RZ_CMD_STATUS_ERROR;
477  }
479  RzIOMap *map = rz_io_map_add(core->io, fd, desc->perm, 0, 0, size);
480  if (!map) {
481  RZ_LOG_ERROR("Cannot create new map for fd %d\n", fd);
482  return RZ_CMD_STATUS_ERROR;
483  }
484  rz_io_map_set_name(map, desc->name);
485  return RZ_CMD_STATUS_OK;
486 }
487 
488 RZ_IPI RzCmdStatus rz_open_maps_flags_handler(RzCore *core, int argc, const char **argv) {
489  int perm = rz_str_rwx(argv[1]);
490  RzIOMap *map = NULL;
491  if (argc > 2) {
492  ut32 id = rz_num_math(NULL, argv[2]);
493  map = rz_io_map_resolve(core->io, id);
494  if (!map) {
495  RZ_LOG_ERROR("Cannot find any map with id %d\n", id);
496  return RZ_CMD_STATUS_ERROR;
497  }
498  } else {
499  map = rz_io_map_get(core->io, core->offset);
500  if (!map) {
501  RZ_LOG_ERROR("Cannot find any map at the current address %" PFMT64x "\n", core->offset);
502  return RZ_CMD_STATUS_ERROR;
503  }
504  }
505 
506  map->perm = perm;
507  return RZ_CMD_STATUS_OK;
508 }
509 
511  const char *arg = argv[1];
512  enum mode {
513  ADD,
514  DEL,
515  SET,
516  } mode = SET;
517  if (arg[0] == '+') {
518  mode = ADD;
519  arg++;
520  } else if (arg[0] == '-') {
521  mode = DEL;
522  arg++;
523  }
524  int perm = rz_str_rwx(arg);
525  RzPVector *maps = rz_io_maps(core->io);
526  void **it;
527  rz_pvector_foreach (maps, it) {
528  RzIOMap *map = *it;
529  switch (mode) {
530  case ADD:
531  map->perm |= perm;
532  break;
533  case DEL:
534  map->perm &= ~perm;
535  break;
536  case SET:
537  map->perm = perm;
538  break;
539  }
540  }
541  return RZ_CMD_STATUS_OK;
542 }
543 
544 RZ_IPI RzCmdStatus rz_open_maps_map_handler(RzCore *core, int argc, const char **argv) {
545  int fd = (int)rz_num_math(NULL, argv[1]);
546  if (fd < 3) {
547  RZ_LOG_ERROR("Wrong fd, it must be greather than 3\n");
548  return RZ_CMD_STATUS_ERROR;
549  }
550 
551  ut64 vaddr = rz_num_math(core->num, argv[2]);
552  ut64 size = argc > 3 ? rz_num_math(core->num, argv[3]) : rz_io_fd_size(core->io, fd);
553  ut64 paddr = argc > 4 ? rz_num_math(core->num, argv[4]) : 0;
554  int rwx = argc > 5 ? rz_str_rwx(argv[5]) : 0;
555  const char *name = argc > 6 ? argv[6] : "";
556 
557  if (argc <= 5) {
558  RzIODesc *desc = rz_io_desc_get(core->io, fd);
559  if (!desc) {
560  RZ_LOG_ERROR("Could not determine any opened file with fd %d\n", fd);
561  return RZ_CMD_STATUS_ERROR;
562  }
563 
564  rwx = desc->perm;
565  }
566  RzIOMap *map = rz_io_map_add(core->io, fd, rwx, paddr, vaddr, size);
567  if (!map) {
568  RZ_LOG_ERROR("Could not create new map for fd %d at vaddr %" PFMT64x "\n", fd, vaddr);
569  return RZ_CMD_STATUS_ERROR;
570  }
572  return RZ_CMD_STATUS_OK;
573 }
574 
575 static void open_maps_show(RzCore *core, RzCmdStateOutput *state, RzIOMap *map, bool seek_inside) {
576  switch (state->mode) {
578  rz_cons_printf("%d %d\n", map->fd, map->id);
579  break;
582  break;
583  case RZ_OUTPUT_MODE_JSON:
584  pj_o(state->d.pj);
585  pj_ki(state->d.pj, "map", map->id);
586  pj_ki(state->d.pj, "fd", map->fd);
587  pj_kn(state->d.pj, "delta", map->delta);
588  pj_kn(state->d.pj, "from", rz_io_map_get_from(map));
589  pj_kn(state->d.pj, "to", rz_itv_end(map->itv));
590  pj_ks(state->d.pj, "perm", rz_str_rwx_i(map->perm));
591  pj_ks(state->d.pj, "name", rz_str_get(map->name));
592  pj_end(state->d.pj);
593  break;
595  rz_table_add_rowf(state->d.t, "ddxxxxxss",
596  map->id, map->fd, map->delta, map->delta + rz_itv_size(map->itv), rz_itv_size(map->itv),
598  break;
599  default:
600  rz_cons_printf("%2d fd: %i +0x%08" PFMT64x " 0x%08" PFMT64x " %c 0x%08" PFMT64x " %s %s\n",
601  map->id, map->fd,
602  map->delta, rz_io_map_get_from(map), seek_inside ? '*' : '-', rz_io_map_get_to(map),
603  rz_str_rwx_i(map->perm), rz_str_get(map->name));
604  break;
605  }
606 }
607 
608 static void open_maps_list(RzCore *core, RzCmdStateOutput *state, int fd) {
609  RzPVector *maps = rz_io_maps(core->io);
610  void **it;
611 
613  rz_cmd_state_output_set_columnsf(state, "ddxxxxxss", "id", "fd", "pa", "pa_end", "size", "va", "va_end", "perm", "name");
614  if (state->mode == RZ_OUTPUT_MODE_TABLE) {
615  state->d.t->showFancy = true;
616  }
617  RzIOMap *at_seek = NULL;
618  if (state->mode == RZ_OUTPUT_MODE_STANDARD) {
619  at_seek = rz_io_map_get(core->io, core->offset);
620  }
621  rz_pvector_foreach (maps, it) {
622  RzIOMap *map = *it;
623  if (fd >= 0 && map->fd != fd) {
624  continue;
625  }
626  open_maps_show(core, state, map, map == at_seek);
627  }
629 }
630 
632  int fd = argc > 1 ? rz_num_math(NULL, argv[1]) : -1;
633  open_maps_list(core, state, fd);
634  return RZ_CMD_STATUS_OK;
635 }
636 
638  RzIOMap *map = rz_io_map_get(core->io, core->offset);
639  if (!map) {
640  RZ_LOG_ERROR("Cannot find any map at the current address %" PFMT64x "\n", core->offset);
641  return RZ_CMD_STATUS_ERROR;
642  }
643  rz_cmd_state_output_set_columnsf(state, "ddxxxxxss", "id", "fd", "pa", "pa_end", "va", "va_end", "perm", "name");
644  if (state->mode == RZ_OUTPUT_MODE_TABLE) {
645  state->d.t->showFancy = true;
646  }
647  open_maps_show(core, state, map, false);
648  return RZ_CMD_STATUS_OK;
649 }
650 
652  ut32 id = (ut32)rz_num_math(NULL, argv[1]);
653  if (!rz_core_bin_raise(core, id)) {
654  RZ_LOG_ERROR("Could not select binary file with id %d\n", id);
655  return RZ_CMD_STATUS_ERROR;
656  }
657  return RZ_CMD_STATUS_OK;
658 }
659 
661  ut32 fd = rz_num_math(NULL, argv[1]);
662  RzBinFile *bf = rz_bin_file_find_by_fd(core->bin, fd);
663  if (!bf) {
664  RZ_LOG_ERROR("Could not find any binary file for fd %d.\n", fd);
665  return RZ_CMD_STATUS_ERROR;
666  }
667  if (!rz_core_bin_raise(core, bf->id)) {
668  eprintf("Could not select the binary file for fd %d.\n", fd);
669  return RZ_CMD_STATUS_ERROR;
670  }
671  return RZ_CMD_STATUS_OK;
672 }
673 
674 RZ_IPI RzCmdStatus rz_open_binary_del_handler(RzCore *core, int argc, const char **argv) {
675  ut32 id = (ut32)rz_num_math(NULL, argv[1]);
676  RzBinFile *bf = rz_bin_file_find_by_id(core->bin, id);
677  if (!bf) {
678  RZ_LOG_ERROR("Could not find any binary file with id %d.\n", id);
679  return RZ_CMD_STATUS_ERROR;
680  }
681  if (!rz_core_binfiles_delete(core, bf)) {
682  RZ_LOG_ERROR("Could not delete binary file with id %d\n", id);
683  return RZ_CMD_STATUS_ERROR;
684  }
685  return RZ_CMD_STATUS_OK;
686 }
687 
690  return RZ_CMD_STATUS_OK;
691 }
692 
695  return RZ_CMD_STATUS_OK;
696 }
697 
698 RZ_IPI RzCmdStatus rz_open_binary_show_handler(RzCore *core, int argc, const char **argv) {
699  RzBinFile *bf = rz_bin_file_at(core->bin, core->offset);
700  if (bf) {
701  rz_cons_printf("%d\n", bf->id);
702  }
703  return RZ_CMD_STATUS_OK;
704 }
705 
707  RzBin *bin = core->bin;
708  if (!bin) {
709  return RZ_CMD_STATUS_ERROR;
710  }
712  if (!list) {
713  return RZ_CMD_STATUS_ERROR;
714  }
715  RzListIter *iter;
716  RzBinFile *bf = NULL;
717  rz_list_foreach (bin->binfiles, iter, bf) {
718  char temp[64];
719  RzInterval inter = (RzInterval){ bf->o->opts.baseaddr, bf->o->size };
720  RzListInfo *info = rz_listinfo_new(bf->file, inter, inter, -1, sdb_itoa(bf->fd, temp, 10));
721  if (!info) {
722  break;
723  }
725  }
726  RzTable *table = rz_core_table(core);
727  rz_table_visual_list(table, list, core->offset, core->blocksize,
728  rz_cons_get_size(NULL), rz_config_get_i(core->config, "scr.color"));
729  char *table_text = rz_table_tostring(table);
730  rz_cons_printf("\n%s\n", table_text);
731  rz_free(table_text);
732  rz_table_free(table);
734  return RZ_CMD_STATUS_OK;
735 }
736 
737 RZ_IPI RzCmdStatus rz_open_binary_add_handler(RzCore *core, int argc, const char **argv) {
738  ut64 loadaddr = rz_num_math(core->num, argv[1]);
739  int fd = rz_io_fd_get_current(core->io);
740  RzIODesc *desc = rz_io_desc_get(core->io, fd);
741  if (!desc) {
742  RZ_LOG_ERROR("Could not determine any opened file with fd %d\n", fd);
743  return RZ_CMD_STATUS_ERROR;
744  }
745  RzBinOptions opt;
746  opt.sz = 1024 * 1024 * 1;
747  rz_core_bin_options_init(core, &opt, desc->fd, core->offset, loadaddr);
748  RzBinFile *bf = rz_bin_open_io(core->bin, &opt);
749  rz_core_bin_apply_all_info(core, bf);
750  return RZ_CMD_STATUS_OK;
751 }
752 
753 RZ_IPI RzCmdStatus rz_open_binary_file_handler(RzCore *core, int argc, const char **argv) {
754  int saved_fd = rz_io_fd_get_current(core->io);
756  RzListIter *iter;
757 
758  RzIODesc *desc = NULL;
759  if (argc > 1) {
760  desc = rz_io_open(core->io, argv[1], RZ_PERM_R, 0);
761  if (!desc) {
762  RZ_LOG_ERROR("Could not open file %s\n", argv[1]);
764  return RZ_CMD_STATUS_ERROR;
765  }
766  rz_list_append(files, (void *)(size_t)desc->fd);
767  } else {
768  RzList *ofiles = rz_id_storage_list(core->io->files);
769  RzIODesc *desc;
770  rz_list_foreach (ofiles, iter, desc) {
771  rz_list_append(files, (void *)(size_t)desc->fd);
772  }
773  }
774 
775  void *_fd;
776  rz_list_foreach (files, iter, _fd) {
777  RzBinOptions opt;
778  int fd = (size_t)_fd;
779  rz_core_bin_options_init(core, &opt, fd, core->offset, 0);
780  RzBinFile *bf = rz_bin_open_io(core->bin, &opt);
781  rz_core_bin_apply_all_info(core, bf);
782  }
784 
786  rz_io_use_fd(core->io, saved_fd);
787  return RZ_CMD_STATUS_OK;
788 }
789 
791  rz_core_bin_rebase(core, rz_num_math(core->num, argv[1]));
793  return RZ_CMD_STATUS_OK;
794 }
795 
797  // XXX: this will reload the bin using the buffer.
798  // An assumption is made that assumes there is an underlying
799  // plugin that will be used to load the bin (e.g. malloc://)
800  // TODO: Might be nice to reload a bin at a specified offset?
801  core_bin_reload(core, NULL, rz_num_math(core->num, argv[1]));
802  rz_core_block_read(core);
803  return RZ_CMD_STATUS_OK;
804 }
805 
806 RZ_IPI RzCmdStatus rz_open_handler(RzCore *core, int argc, const char **argv) {
807  ut64 addr = argc > 2 ? rz_num_math(core->num, argv[2]) : 0;
808  int perms = argc > 3 ? rz_str_rwx(argv[3]) : RZ_PERM_R;
809  return bool2status(rz_core_file_open_load(core, argv[1], addr, perms, false));
810 }
811 
812 RZ_IPI RzCmdStatus rz_open_write_handler(RzCore *core, int argc, const char **argv) {
813  ut64 addr = argc > 2 ? rz_num_math(core->num, argv[2]) : 0;
814  int perms = argc > 3 ? rz_str_rwx(argv[3]) : RZ_PERM_RW;
815  return bool2status(rz_core_file_open_load(core, argv[1], addr, perms, true));
816 }
817 
820  rz_cmd_state_output_set_columnsf(state, "dbsXs", "fd", "raised", "perm", "size", "uri");
821  switch (state->mode) {
824  break;
825  case RZ_OUTPUT_MODE_JSON:
827  break;
830  break;
833  break;
834  default:
835  break;
836  }
838  return RZ_CMD_STATUS_OK;
839 }
840 
842  RzIOMap *map = rz_io_map_get(core->io, core->offset);
843  if (!map) {
844  RZ_LOG_ERROR("Could not find any map at current address %" PFMT64x ".\n", core->offset);
845  return RZ_CMD_STATUS_ERROR;
846  }
847  RzIODesc *desc = rz_io_desc_get(core->io, map->fd);
848  if (!desc) {
849  RZ_LOG_ERROR("Could not find file for map fd %d.\n", map->fd);
850  return RZ_CMD_STATUS_ERROR;
851  }
852 
853  rz_cmd_state_output_set_columnsf(state, "dbsXs", "fd", "raised", "perm", "size", "uri");
854  switch (state->mode) {
856  desc_list_cb(core->print, desc, 0);
857  break;
858  case RZ_OUTPUT_MODE_JSON:
859  desc_list_json_cb(state->d.pj, desc, 0);
860  break;
862  desc_list_table_cb(state->d.t, desc, 0);
863  break;
865  desc_list_quiet_cb(core->print, desc, 0);
866  break;
867  default:
868  break;
869  }
870  return RZ_CMD_STATUS_OK;
871 }
872 
873 RZ_IPI RzCmdStatus rz_open_exchange_handler(RzCore *core, int argc, const char **argv) {
874  int fd = (int)rz_num_math(NULL, argv[1]);
875  int fdx = (int)rz_num_math(NULL, argv[2]);
876  if ((fdx == -1) || (fd == -1) || (fdx == fd)) {
877  RZ_LOG_ERROR("Could not exchange file descriptor %d and %d.\n", fd, fdx);
878  return RZ_CMD_STATUS_ERROR;
879  }
880  rz_io_desc_exchange(core->io, fd, fdx);
881  rz_core_block_read(core);
882  return RZ_CMD_STATUS_OK;
883 }
884 
885 static RzCmdStatus open_core_file(RzCore *core, const char *filename) {
886  if (core->tasks.current_task != core->tasks.main_task) {
887  RZ_LOG_ERROR("This command can only be executed on the main task!\n");
888  return RZ_CMD_STATUS_ERROR;
889  }
891  rz_core_fini(core);
892  rz_core_init(core);
894  if (!rz_core_file_open(core, filename, RZ_PERM_R, 0)) {
895  RZ_LOG_ERROR("Cannot open file '%s'\n", filename);
896  return RZ_CMD_STATUS_ERROR;
897  }
898  ut64 baddr = rz_config_get_i(core->config, "bin.baddr");
899  return bool2status(rz_core_bin_load(core, NULL, baddr));
900 }
901 
902 RZ_IPI RzCmdStatus rz_open_core_file_handler(RzCore *core, int argc, const char **argv) {
903  return open_core_file(core, argv[1]);
904 }
905 
906 RZ_IPI RzCmdStatus rz_open_malloc_handler(RzCore *core, int argc, const char **argv) {
907  int len = (int)rz_num_math(core->num, argv[1]);
908  if (len < 0) {
909  RZ_LOG_ERROR("Invalid length %d.\n", len);
910  return RZ_CMD_STATUS_ERROR;
911  }
912 
914  ut8 *data = RZ_NEWS(ut8, len);
915  if (!data) {
916  return RZ_CMD_STATUS_ERROR;
917  }
918  if (!rz_io_read_at(core->io, core->offset, data, len)) {
919  RZ_LOG_ERROR("Cannot read %d bytes from current offset.\n", len);
920  goto err;
921  }
922 
923  char uri[100];
924  rz_strf(uri, "malloc://%d", len);
925  RzCoreFile *cfile = rz_core_file_open(core, uri, RZ_PERM_RWX, 0);
926  if (!cfile) {
927  RZ_LOG_ERROR("Cannot open '%s'.\n", uri);
928  goto err;
929  }
930 
931  if (!rz_core_bin_load(core, uri, 0)) {
932  RZ_LOG_ERROR("Cannot load binary info of '%s'.\n", uri);
933  goto err;
934  }
935 
936  RzIODesc *desc = rz_io_desc_get(core->io, cfile->fd);
938  rz_io_desc_write_at(desc, 0, data, len);
939  res = RZ_CMD_STATUS_OK;
940 
941 err:
942  free(data);
943  return res;
944 }
945 
946 static RzCmdStatus open_nobin_file(RzCore *core, const char *uri, ut64 addr, int perms) {
947  if (!strcmp(uri, "=")) {
948  uri = "malloc://512";
949  }
950 
951  RzIODesc *desc = rz_io_open_at(core->io, uri, perms, 0644, addr, NULL);
952  if (!desc || desc->fd == -1) {
953  RZ_LOG_ERROR("Cannot open '%s' at %" PFMT64x ".\n", uri, addr);
954  return RZ_CMD_STATUS_ERROR;
955  }
956 
957  core->num->value = desc->fd;
958  rz_core_block_read(core);
959  return RZ_CMD_STATUS_OK;
960 }
961 
962 RZ_IPI RzCmdStatus rz_open_nobin_handler(RzCore *core, int argc, const char **argv) {
963  ut64 addr = argc > 2 ? rz_num_math(core->num, argv[2]) : 0;
964  int perms = argc > 3 ? rz_str_rwx(argv[3]) : RZ_PERM_R;
965  return open_nobin_file(core, argv[1], addr, perms);
966 }
967 
968 RZ_IPI RzCmdStatus rz_open_nobin_write_handler(RzCore *core, int argc, const char **argv) {
969  ut64 addr = argc > 2 ? rz_num_math(core->num, argv[2]) : 0;
970  int perms = argc > 3 ? rz_str_rwx(argv[3]) : RZ_PERM_RW;
971  return open_nobin_file(core, argv[1], addr, perms);
972 }
973 
974 RZ_IPI RzCmdStatus rz_reopen_handler(RzCore *core, int argc, const char **argv) {
975  int fd;
976  if (argc > 1) {
977  fd = (int)rz_num_math(NULL, argv[1]);
978  if (fd < 0) {
979  RZ_LOG_ERROR("Invalid negative fd %d\n", fd);
980  return RZ_CMD_STATUS_ERROR;
981  }
982  } else {
983  if (!core->io || !core->io->desc) {
984  RZ_LOG_ERROR("Cannot find current file.\n");
985  return RZ_CMD_STATUS_ERROR;
986  }
987  fd = core->io->desc->fd;
988  }
989  rz_core_io_file_open(core, fd);
990  return RZ_CMD_STATUS_OK;
991 }
992 
993 RZ_IPI RzCmdStatus rz_reopen_write_handler(RzCore *core, int argc, const char **argv) {
994  int fd;
995  int perms = RZ_PERM_RW;
996  if (argc > 1) {
997  fd = (int)rz_num_math(NULL, argv[1]);
998  if (fd < 0) {
999  RZ_LOG_ERROR("Invalid negative fd %d\n", fd);
1000  return RZ_CMD_STATUS_ERROR;
1001  }
1002  } else {
1003  if (!core->io || !core->io->desc) {
1004  RZ_LOG_ERROR("Cannot find current file.\n");
1005  return RZ_CMD_STATUS_ERROR;
1006  }
1007  fd = core->io->desc->fd;
1008  perms |= core->io->desc->perm;
1009  }
1010  rz_core_io_file_reopen(core, fd, perms);
1011  return RZ_CMD_STATUS_OK;
1012 }
1013 
1014 RZ_IPI RzCmdStatus rz_reopen_binary_handler(RzCore *core, int argc, const char **argv) {
1015  return bool2status(rz_core_file_reopen(core, argv[1], 0, 2));
1016 }
1017 
1018 RZ_IPI RzCmdStatus rz_reopen_core_handler(RzCore *core, int argc, const char **argv) {
1019  if (!core->io || !core->io->desc) {
1020  RZ_LOG_ERROR("Could not find current file\n");
1021  return RZ_CMD_STATUS_ERROR;
1022  }
1023 
1024  return open_core_file(core, core->io->desc->uri);
1025 }
1026 
1027 RZ_IPI RzCmdStatus rz_reopen_debug_handler(RzCore *core, int argc, const char **argv) {
1028  // TODO: this is bad as we force ourselves to convert arguments to strings.
1029  // There should be an API to reopen a file in debug mode and directly
1030  // pass args to it.
1031  char **args = RZ_NEWS(char *, argc - 1);
1032  int i;
1033  for (i = 1; i < argc; i++) {
1035  args[i - 1] = rz_str_newf("\"%s\"", t);
1036  free(t);
1037  }
1038  char *args_str = rz_str_array_join((const char **)args, argc - 1, " ");
1039  for (i = 0; i < argc - 1; i++) {
1040  free(args[i]);
1041  }
1042  free(args);
1043  rz_core_file_reopen_debug(core, args_str);
1044  free(args_str);
1045  return RZ_CMD_STATUS_OK;
1046 }
1047 
1049  const char *uri = argv[1];
1050  ut64 addr = argc > 2 ? rz_num_math(core->num, argv[2]) : 0;
1052  return RZ_CMD_STATUS_OK;
1053 }
1054 
1056  char *file = rz_file_temp("rz-run");
1057  char *s = strdup(argv[1]);
1058  rz_config_set(core->config, "dbg.profile", file);
1059  rz_str_replace_char(s, ',', '\n');
1060  rz_file_dump(file, (const ut8 *)s, strlen(s), 0);
1061  rz_file_dump(file, (const ut8 *)"\n", 1, 1);
1062  free(s);
1063  free(file);
1064  rz_core_file_reopen_debug(core, "");
1065  return RZ_CMD_STATUS_OK;
1066 }
1067 
1068 RZ_IPI RzCmdStatus rz_reopen_malloc_handler(RzCore *core, int argc, const char **argv) {
1070  return RZ_CMD_STATUS_OK;
1071 }
1072 
1073 RZ_IPI RzCmdStatus rz_reopen_nobin_handler(RzCore *core, int argc, const char **argv) {
1074  return bool2status(rz_core_file_reopen(core, NULL, 0, 0));
1075 }
1076 
1078  return bool2status(rz_core_file_reopen(core, NULL, RZ_PERM_RW, 0));
1079 }
1080 
1081 static RzCmdStatus reopen_nobin_headers(RzCore *core, int add_perms) {
1082  RzIODesc *desc = rz_io_desc_get(core->io, core->file->fd);
1083  if (!desc) {
1084  RZ_LOG_ERROR("Could not find current file.\n");
1085  return RZ_CMD_STATUS_ERROR;
1086  }
1087  int perms = core->io->desc->perm | add_perms;
1088  char *fname = strdup(desc->name);
1089  if (!fname) {
1090  return RZ_CMD_STATUS_ERROR;
1091  }
1092  if (!rz_core_bin_load_structs(core, fname)) {
1093  RZ_LOG_WARN("Could not load file format information for '%s'.\n", fname);
1094  }
1095  bool res = rz_core_file_reopen(core, fname, perms, 0);
1096  free(fname);
1097  return bool2status(res);
1098 }
1099 
1101  return reopen_nobin_headers(core, 0);
1102 }
1103 
1105  return reopen_nobin_headers(core, RZ_PERM_RW);
1106 }
size_t len
Definition: 6502dis.c:15
RZ_API void rz_analysis_purge(RzAnalysis *analysis)
Definition: analysis.c:433
#define RZ_IPI
Definition: analysis_wasm.c:11
lzma_index ** i
Definition: index.h:629
static bool err
Definition: armass.c:435
RZ_API ut64 rz_bin_file_delete_all(RzBin *bin)
Definition: bfile.c:199
RZ_API RzBinFile * rz_bin_file_find_by_id(RzBin *bin, ut32 bf_id)
Definition: bfile.c:188
RZ_API RzBinFile * rz_bin_file_find_by_fd(RzBin *bin, ut32 bin_fd)
Definition: bfile.c:226
RZ_API bool rz_bin_file_set_cur_by_id(RzBin *bin, ut32 bin_id)
Definition: bfile.c:253
RZ_API RzBinFile * rz_bin_file_at(RzBin *bin, ut64 at)
Definition: bin.c:1160
RZ_API RzBinFile * rz_bin_open_io(RzBin *bin, RzBinOptions *opt)
Definition: bin.c:283
RZ_API RzBinFile * rz_bin_reload(RzBin *bin, RzBinFile *bf, ut64 baseaddr)
Definition: bin.c:216
RZ_API RzBinFile * rz_bin_cur(RzBin *bin)
Definition: bin.c:895
static ut64 baddr(RzBinFile *bf)
Definition: bin_any.c:58
static RzList * maps(RzBinFile *bf)
Definition: bin_bf.c:116
RzBinInfo * info(RzBinFile *bf)
Definition: bin_ne.c:86
const char * desc
Definition: bin_vsf.c:19
int bits(struct state *s, int need)
Definition: blast.c:72
RZ_API bool rz_core_binfiles_delete(RzCore *core, RzBinFile *bf)
Close an opened binary file.
Definition: cbin.c:4542
RZ_API bool rz_core_binfiles_print(RzCore *core, RzCmdStateOutput *state)
Print all the opened binary files according to state.
Definition: cbin.c:4603
RZ_API void rz_core_bin_options_init(RzCore *core, RZ_OUT RzBinOptions *opts, int fd, ut64 baseaddr, ut64 loadaddr)
Definition: cbin.c:87
RZ_API bool rz_core_bin_raise(RzCore *core, ut32 bfid)
Definition: cbin.c:4524
RZ_API bool rz_core_bin_load_structs(RZ_NONNULL RzCore *core, RZ_NONNULL const char *file)
Definition: cbin.c:236
RZ_API int rz_core_bin_set_arch_bits(RzCore *r, const char *name, const char *arch, ut16 bits)
Definition: cbin.c:4467
RZ_API bool rz_core_bin_apply_all_info(RzCore *r, RzBinFile *binfile)
Definition: cbin.c:311
RZ_API RzCoreFile * rz_core_file_cur(RzCore *r)
Definition: cfile.c:1591
RZ_API bool rz_core_file_reopen(RzCore *core, const char *args, int perm, int loadbin)
Definition: cfile.c:322
RZ_API void rz_core_file_reopen_debug(RzCore *core, const char *args)
Definition: cfile.c:269
RZ_API void rz_core_io_file_open(RZ_NONNULL RzCore *core, int fd)
Open file use read-only Permission.
Definition: cfile.c:1601
RZ_API void rz_core_file_reopen_remote_debug(RzCore *core, const char *uri, ut64 addr)
Definition: cfile.c:222
RZ_API int rz_core_bin_rebase(RzCore *core, ut64 baddr)
Definition: cfile.c:822
RZ_API void rz_core_io_file_reopen(RZ_NONNULL RzCore *core, int fd, int perms)
Reopen file.
Definition: cfile.c:1650
RZ_API RZ_BORROW RzCoreFile * rz_core_file_open(RZ_NONNULL RzCore *r, RZ_NONNULL const char *file, int flags, ut64 loadaddr)
Tries to open the file as is, otherwise tries as is a compilation of files.
Definition: cfile.c:1182
RZ_API bool rz_core_file_close_fd(RzCore *core, int fd)
Definition: cfile.c:1510
RZ_API bool rz_core_file_open_load(RZ_NONNULL RzCore *core, RZ_NONNULL const char *filepath, ut64 addr, int perms, bool write_mode)
Tries to open the file, load binary info and make RzIOMap.
Definition: cfile.c:189
RZ_API bool rz_core_bin_load(RZ_NONNULL RzCore *r, RZ_NULLABLE const char *filenameuri, ut64 baddr)
Definition: cfile.c:942
RZ_API int rz_core_block_read(RzCore *core)
Definition: cio.c:243
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
RZ_API char * rz_cmd_escape_arg(const char *arg, RzCmdEscape esc)
Definition: cmd_api.c:2516
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
RZ_IPI RzCmdStatus rz_open_binary_list_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
Definition: cmd_open.c:693
RZ_IPI RzCmdStatus rz_open_maps_prioritize_binid_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_open.c:385
RZ_IPI RzCmdStatus rz_open_prioritize_prev_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_open.c:245
RZ_IPI RzCmdStatus rz_open_maps_all_fd_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_open.c:304
RZ_IPI RzCmdStatus rz_open_maps_map_fd_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_open.c:471
RZ_IPI RzCmdStatus rz_open_maps_name_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_open.c:429
RZ_IPI RzCmdStatus rz_open_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_open.c:806
RZ_IPI RzCmdStatus rz_open_show_current_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
Definition: cmd_open.c:841
RZ_IPI RzCmdStatus rz_open_maps_name_del_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_open.c:439
RZ_IPI RzCmdStatus rz_reopen_debug_rzrun_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_open.c:1055
RZ_IPI RzCmdStatus rz_open_close_all_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_open.c:158
RZ_IPI RzCmdStatus rz_reopen_malloc_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_open.c:1068
RZ_IPI RzCmdStatus rz_open_binary_show_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_open.c:698
RZ_API void rz_core_file_reopen_in_malloc(RzCore *core)
Definition: cmd_open.c:74
RZ_IPI RzCmdStatus rz_reopen_binary_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_open.c:1014
RZ_IPI RzCmdStatus rz_reopen_nobin_write_headers_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_open.c:1104
RZ_IPI RzCmdStatus rz_open_core_file_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_open.c:902
RZ_IPI RzCmdStatus rz_open_exchange_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_open.c:873
RZ_IPI RzCmdStatus rz_open_prioritize_next_rotate_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_open.c:250
RZ_IPI RzCmdStatus rz_open_maps_flags_global_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_open.c:510
RZ_IPI RzCmdStatus rz_open_binary_select_id_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_open.c:651
static bool desc_list_table_cb(void *user, void *data, ut32 id)
Definition: cmd_open.c:137
RZ_IPI RzCmdStatus rz_reopen_nobin_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_open.c:1073
RZ_IPI RzCmdStatus rz_reopen_core_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_open.c:1018
static bool reopen_in_malloc_cb(void *user, void *data, ut32 id)
Definition: cmd_open.c:32
RZ_IPI RzCmdStatus rz_open_maps_name_id_del_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_open.c:460
static void open_maps_list(RzCore *core, RzCmdStateOutput *state, int fd)
Definition: cmd_open.c:608
RZ_IPI RzCmdStatus rz_open_prioritize_next_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_open.c:240
RZ_IPI RzCmdStatus rz_reopen_write_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_open.c:993
RZ_IPI RzCmdStatus rz_open_arch_bits_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_open.c:179
RZ_IPI RzCmdStatus rz_open_prioritize_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_open.c:235
static RzCmdStatus open_nobin_file(RzCore *core, const char *uri, ut64 addr, int perms)
Definition: cmd_open.c:946
RZ_IPI RzCmdStatus rz_open_maps_list_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
Definition: cmd_open.c:631
RZ_IPI RzCmdStatus rz_open_list_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
Definition: cmd_open.c:818
RZ_IPI RzCmdStatus rz_open_nobin_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_open.c:962
static bool desc_list_visual_cb(void *user, void *data, ut32 id)
Definition: cmd_open.c:90
static bool desc_list_json_cb(void *user, void *data, ut32 id)
Definition: cmd_open.c:121
RZ_IPI RzCmdStatus rz_reopen_debug_file_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_open.c:1048
RZ_IPI RzCmdStatus rz_open_binary_list_ascii_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_open.c:706
RZ_IPI RzCmdStatus rz_open_binary_add_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_open.c:737
RZ_IPI RzCmdStatus rz_open_maps_flags_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_open.c:488
RZ_IPI RzCmdStatus rz_open_maps_remove_all_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_open.c:271
RZ_IPI RzCmdStatus rz_open_close_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_open.c:145
RZ_IPI RzCmdStatus rz_open_binary_del_all_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_open.c:688
RZ_IPI RzCmdStatus rz_open_binary_del_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_open.c:674
RZ_IPI RzCmdStatus rz_open_malloc_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_open.c:906
RZ_IPI RzCmdStatus rz_open_maps_resize_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_open.c:356
RZ_IPI RzCmdStatus rz_open_maps_relocate_current_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_open.c:338
static bool desc_list_quiet_cb(void *user, void *data, ut32 id)
Definition: cmd_open.c:105
RZ_IPI RzCmdStatus rz_reopen_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_open.c:974
RZ_IPI RzCmdStatus rz_reopen_nobin_write_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_open.c:1077
RZ_IPI RzCmdStatus rz_open_nobin_write_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_open.c:968
static RzCmdStatus open_core_file(RzCore *core, const char *filename)
Definition: cmd_open.c:885
RZ_IPI RzCmdStatus rz_open_maps_prioritize_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_open.c:374
static bool init_desc_list_visual_cb(void *user, void *data, ut32 id)
Definition: cmd_open.c:80
RZ_IPI RzCmdStatus rz_open_maps_deprioritize_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_open.c:409
RZ_IPI RzCmdStatus rz_open_binary_select_fd_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_open.c:660
static RzCmdStatus prioritize_file(RzCore *core, int fd)
Definition: cmd_open.c:212
static bool core_bin_reload(RzCore *r, const char *file, ut64 baseaddr)
Definition: cmd_open.c:15
RZ_IPI RzCmdStatus rz_open_maps_remove_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_open.c:258
static bool desc_list_cb(void *user, void *data, ut32 id)
Definition: cmd_open.c:112
RZ_IPI RzCmdStatus rz_open_write_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_open.c:812
RZ_IPI RzCmdStatus rz_open_list_ascii_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_open.c:170
RZ_IPI RzCmdStatus rz_open_maps_map_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_open.c:544
RZ_IPI RzCmdStatus rz_open_maps_list_cur_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
Definition: cmd_open.c:637
static RzCmdStatus reopen_nobin_headers(RzCore *core, int add_perms)
Definition: cmd_open.c:1081
RZ_IPI RzCmdStatus rz_open_maps_relocate_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_open.c:320
RZ_IPI RzCmdStatus rz_reopen_nobin_headers_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_open.c:1100
RZ_IPI RzCmdStatus rz_open_binary_rebase_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_open.c:790
RZ_IPI RzCmdStatus rz_open_maps_name_id_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_open.c:449
static void open_maps_show(RzCore *core, RzCmdStateOutput *state, RzIOMap *map, bool seek_inside)
Definition: cmd_open.c:575
RZ_IPI RzCmdStatus rz_open_maps_list_ascii_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_open.c:276
RZ_IPI RzCmdStatus rz_open_maps_prioritize_fd_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_open.c:420
RZ_IPI RzCmdStatus rz_open_binary_reload_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_open.c:796
RZ_IPI RzCmdStatus rz_reopen_debug_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_open.c:1027
RZ_IPI RzCmdStatus rz_open_use_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_open.c:188
RZ_IPI RzCmdStatus rz_open_binary_file_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_open.c:753
RZ_API ut64 rz_config_get_i(RzConfig *cfg, RZ_NONNULL const char *name)
Definition: config.c:119
RZ_API RzConfigNode * rz_config_set(RzConfig *cfg, RZ_NONNULL const char *name, const char *value)
Definition: config.c:267
RZ_API int rz_cons_get_size(int *rows)
Definition: cons.c:1446
RZ_API int rz_cons_printf(const char *format,...)
Definition: cons.c:1202
#define RZ_API
static RzCmdStatus bool2status(bool val)
Definition: core_private.h:208
#define NULL
Definition: cris-opc.c:27
#define r
Definition: crypto_rc6.c:12
cs_arch arch
Definition: cstool.c:13
uint16_t ut16
uint32_t ut32
size_t map(int syms, int left, int len)
Definition: enough.c:237
checking print the parsed form of the magic use in n conjunction with m to debug a new magic file n before installing it n output MIME type special files
Definition: file_opts.h:46
RZ_API void rz_flag_unset_all(RzFlag *f)
Definition: flag.c:677
RZ_API void Ht_() free(HtName_(Ht) *ht)
Definition: ht_inc.c:130
voidpf void uLong size
Definition: ioapi.h:138
const char * filename
Definition: ioapi.h:137
const char int mode
Definition: ioapi.h:137
voidpf void * buf
Definition: ioapi.h:138
uint8_t ut8
Definition: lh5801.h:11
void * p
Definition: libc.cpp:67
RZ_API RzTable * rz_core_table(RzCore *core)
Definition: core.c:3449
RZ_API void rz_core_fini(RzCore *c)
Definition: core.c:2623
RZ_API bool rz_core_init(RzCore *core)
Definition: core.c:2381
static void list(RzEgg *egg)
Definition: rz-gg.c:52
RZ_API RZ_OWN RzList * rz_list_newf(RzListFree f)
Returns a new initialized RzList pointer and sets the free method.
Definition: list.c:248
RZ_API RZ_BORROW RzListIter * rz_list_append(RZ_NONNULL RzList *list, void *data)
Appends at the end of the list a new element.
Definition: list.c:288
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
static static fork const void static count static fd const char const char static newpath char char argv
Definition: sflib.h:40
return strdup("=SP r13\n" "=LR r14\n" "=PC r15\n" "=A0 r0\n" "=A1 r1\n" "=A2 r2\n" "=A3 r3\n" "=ZF zf\n" "=SF nf\n" "=OF vf\n" "=CF cf\n" "=SN or0\n" "gpr lr .32 56 0\n" "gpr pc .32 60 0\n" "gpr cpsr .32 64 0 ____tfiae_________________qvczn\n" "gpr or0 .32 68 0\n" "gpr tf .1 64.5 0 thumb\n" "gpr ef .1 64.9 0 endian\n" "gpr jf .1 64.24 0 java\n" "gpr qf .1 64.27 0 sticky_overflow\n" "gpr vf .1 64.28 0 overflow\n" "gpr cf .1 64.29 0 carry\n" "gpr zf .1 64.30 0 zero\n" "gpr nf .1 64.31 0 negative\n" "gpr itc .4 64.10 0 if_then_count\n" "gpr gef .4 64.16 0 great_or_equal\n" "gpr r0 .32 0 0\n" "gpr r1 .32 4 0\n" "gpr r2 .32 8 0\n" "gpr r3 .32 12 0\n" "gpr r4 .32 16 0\n" "gpr r5 .32 20 0\n" "gpr r6 .32 24 0\n" "gpr r7 .32 28 0\n" "gpr r8 .32 32 0\n" "gpr r9 .32 36 0\n" "gpr r10 .32 40 0\n" "gpr r11 .32 44 0\n" "gpr r12 .32 48 0\n" "gpr r13 .32 52 0\n" "gpr r14 .32 56 0\n" "gpr r15 .32 60 0\n" "gpr r16 .32 64 0\n" "gpr r17 .32 68 0\n")
int args
Definition: mipsasm.c:18
RZ_API void rz_print_progressbar(RzPrint *p, int pc, int _cols)
Definition: print.c:1259
#define eprintf(x, y...)
Definition: rlcc.c:7
#define ADD
Definition: rsp_idec.c:200
static RzSocket * s
Definition: rtr.c:28
#define rz_free(x)
Definition: rz_alloc.h:44
#define rz_warn_if_fail(expr)
Definition: rz_assert.h:35
@ RZ_CMD_ESCAPE_DOUBLE_QUOTED_ARG
The string should be escaped so that it can be wrapped in "....".
Definition: rz_cmd.h:82
enum rz_cmd_status_t RzCmdStatus
@ RZ_CMD_STATUS_OK
command handler exited in the right way
Definition: rz_cmd.h:24
@ RZ_CMD_STATUS_ERROR
command handler had issues while running (e.g. allocation error, etc.)
Definition: rz_cmd.h:26
@ DEL
Definition: rz_cons.h:1228
RZ_API char * rz_file_temp(const char *prefix)
Definition: file.c:1048
RZ_API bool rz_file_dump(const char *file, const ut8 *buf, int len, bool append)
Definition: file.c:838
RZ_API RzList * rz_id_storage_list(RzIDStorage *s)
Definition: idpool.c:283
RZ_API bool rz_id_storage_foreach(RzIDStorage *storage, RzIDStorageForeachCb cb, void *user)
Definition: idpool.c:254
RZ_API RzIODesc * rz_io_open(RzIO *io, const char *uri, int flags, int mode)
Definition: io.c:156
RZ_API RzIOMap * rz_io_map_resolve(RzIO *io, ut32 id)
Definition: io_map.c:128
RZ_API ut64 rz_io_fd_size(RzIO *io, int fd)
Definition: io_fd.c:42
RZ_API bool rz_io_read_at(RzIO *io, ut64 addr, ut8 *buf, int len)
Definition: io.c:300
RZ_API bool rz_io_map_exists_for_id(RzIO *io, ut32 id)
Definition: io_map.c:124
RZ_API bool rz_io_desc_is_blockdevice(RzIODesc *desc)
Definition: io_desc.c:261
RZ_API bool rz_io_map_del(RzIO *io, ut32 id)
Definition: io_map.c:192
RZ_API void rz_io_map_del_name(RzIOMap *map)
Definition: io_map.c:340
RZ_API bool rz_io_map_depriorize(RzIO *io, ut32 id)
Definition: io_map.c:248
RZ_API RzIODesc * rz_io_open_at(RzIO *io, const char *uri, int flags, int mode, ut64 at, RZ_NULLABLE RZ_OUT RzIOMap **map)
Open a file and directly map it at the given offset.
Definition: io.c:177
RZ_API ut64 rz_io_desc_size(RzIODesc *desc)
Definition: io_desc.c:224
RZ_API bool rz_io_desc_exchange(RzIO *io, int fd, int fdx)
Definition: io_desc.c:275
RZ_API bool rz_io_map_priorize(RzIO *io, ut32 id)
Definition: io_map.c:232
RZ_API int rz_io_desc_read_at(RzIODesc *desc, ut64 addr, ut8 *buf, int len)
Definition: io_desc.c:351
#define rz_io_map_get_from(map)
Definition: rz_io.h:19
RZ_API void rz_io_map_reset(RzIO *io)
Definition: io_map.c:186
RZ_API RzIOMap * rz_io_map_get(RzIO *io, ut64 addr)
Definition: io_map.c:176
RZ_API bool rz_io_map_priorize_for_fd(RzIO *io, int fd)
Definition: io_map.c:264
RZ_API bool rz_io_map_remap(RzIO *io, ut32 id, ut64 addr)
Definition: io_map.c:54
RZ_API RzIODesc * rz_io_desc_get(RzIO *io, int fd)
Definition: io_desc.c:73
RZ_API int rz_io_desc_write_at(RzIODesc *desc, ut64 addr, const ut8 *buf, int len)
Definition: io_desc.c:358
RZ_API bool rz_io_map_resize(RzIO *io, ut32 id, ut64 newsize)
Definition: io_map.c:403
RZ_API int rz_io_close_all(RzIO *io)
Definition: io.c:258
RZ_API RZ_BORROW RzPVector * rz_io_maps(RzIO *io)
Returns the pointer to vector containing maps list.
Definition: io_map.c:435
RZ_API int rz_io_fd_get_current(RzIO *io)
Definition: io_fd.c:135
RZ_API RzIODesc * rz_io_open_nomap(RzIO *io, const char *uri, int flags, int mode)
Definition: io.c:145
RZ_API bool rz_io_use_fd(RzIO *io, int fd)
Definition: io_fd.c:118
RZ_API bool rz_io_desc_is_dbg(RzIODesc *desc)
Definition: io_desc.c:303
RZ_API void rz_io_map_set_name(RzIOMap *map, const char *name)
Definition: io_map.c:332
#define rz_io_map_get_to(map)
Definition: rz_io.h:20
RZ_API int rz_io_fd_get_prev(RzIO *io, int fd)
Definition: io_fd.c:152
RZ_API RzIOMap * rz_io_map_add(RzIO *io, int fd, int flags, ut64 delta, ut64 addr, ut64 size)
Definition: io_map.c:151
RZ_API int rz_io_fd_get_lowest(RzIO *io)
Definition: io_fd.c:170
RZ_API int rz_io_fd_get_next(RzIO *io, int fd)
Definition: io_fd.c:143
RZ_API bool rz_io_desc_close(RzIODesc *desc)
Definition: io_desc.c:165
struct rz_interval_t RzInterval
static ut64 rz_itv_end(RzInterval itv)
Definition: rz_itv.h:42
static ut64 rz_itv_size(RzInterval itv)
Definition: rz_itv.h:38
void(* RzListFree)(void *ptr)
Definition: rz_list.h:11
#define RZ_LOG_INFO(fmtstr,...)
Definition: rz_log.h:54
#define RZ_LOG_WARN(fmtstr,...)
Definition: rz_log.h:56
#define RZ_LOG_ERROR(fmtstr,...)
Definition: rz_log.h:58
RZ_API ut64 rz_num_math(RzNum *num, const char *str)
Definition: unum.c:456
RZ_API int rz_num_is_valid_input(RzNum *num, const char *input_value)
Definition: unum.c:676
RZ_API PJ * pj_kb(PJ *j, const char *k, bool v)
Definition: pj.c:177
RZ_API PJ * pj_ki(PJ *j, const char *k, int d)
Definition: pj.c:149
RZ_API PJ * pj_end(PJ *j)
Definition: pj.c:87
RZ_API PJ * pj_o(PJ *j)
Definition: pj.c:75
RZ_API PJ * pj_ks(PJ *j, const char *k, const char *v)
Definition: pj.c:170
RZ_API PJ * pj_kn(PJ *j, const char *k, ut64 n)
Definition: pj.c:121
RZ_API PJ * pj_kN(PJ *j, const char *k, st64 n)
Definition: pj.c:128
#define RZ_PRINT_FLAGS_HEADER
Definition: rz_print.h:18
RZ_API const char * rz_str_rwx_i(int rwx)
Definition: str.c:332
static const char * rz_str_get(const char *str)
Definition: rz_str.h:187
RZ_API char * rz_str_newf(const char *fmt,...) RZ_PRINTF_CHECK(1
RZ_API int rz_str_rwx(const char *str)
Definition: str.c:318
RZ_API char * rz_str_array_join(const char **a, size_t n, const char *sep)
Definition: str.c:3861
RZ_API int rz_str_replace_char(char *s, int a, int b)
Definition: str.c:169
#define rz_strf(buf,...)
Convenience macro for local temporary strings.
Definition: rz_str.h:59
RZ_API void rz_table_visual_list(RzTable *table, RzList *list, ut64 seek, ut64 len, int width, bool va)
Definition: table.c:1205
RZ_API void rz_table_add_rowf(RzTable *t, const char *fmt,...)
Definition: table.c:316
RZ_API void rz_table_free(RzTable *t)
Definition: table.c:114
RZ_API char * rz_table_tostring(RzTable *t)
Definition: table.c:510
#define RZ_NEWS(x, y)
Definition: rz_types.h:283
#define RZ_PERM_R
Definition: rz_types.h:93
#define RZ_PERM_RW
Definition: rz_types.h:96
#define RZ_PERM_W
Definition: rz_types.h:94
#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_QUIETEST
Definition: rz_types.h:47
@ RZ_OUTPUT_MODE_STANDARD
Definition: rz_types.h:39
#define RZ_PERM_RWX
Definition: rz_types.h:98
#define PFMT64x
Definition: rz_types.h:393
#define UT64_MAX
Definition: rz_types_base.h:86
#define rz_pvector_foreach_prev(vec, it)
Definition: rz_vector.h:338
#define rz_pvector_foreach(vec, it)
Definition: rz_vector.h:334
RZ_API char * sdb_itoa(ut64 n, char *s, int base)
Definition: util.c:38
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 flags
Definition: sfsocketcall.h:123
static int
Definition: sfsocketcall.h:114
int size_t
Definition: sftypes.h:40
#define f(i)
Definition: sha256.c:46
Definition: malloc.c:26
Definition: gzappend.c:170
Definition: z80asm.h:102
Definition: rz_pj.h:12
ut64 baseaddr
where the linker maps the binary in memory
Definition: rz_bin.h:248
XX curplugin == o->plugin.
Definition: rz_bin.h:298
RzBinObject * o
Definition: rz_bin.h:305
int fd
when used in combination with RzIO, this refers to the io fd.
Definition: rz_bin.h:300
char * file
Definition: rz_bin.h:299
RzBinObjectLoadOptions opts
Definition: rz_bin.h:260
Represent the output state of a command handler.
Definition: rz_cmd.h:91
RzList * files
Definition: rz_core.h:315
RzBin * bin
Definition: rz_core.h:298
ut64 offset
Definition: rz_core.h:301
RzAnalysis * analysis
Definition: rz_core.h:322
RzIO * io
Definition: rz_core.h:313
RzNum * num
Definition: rz_core.h:316
RzCoreTaskScheduler tasks
Definition: rz_core.h:362
RzFlag * flags
Definition: rz_core.h:330
RzPrint * print
Definition: rz_core.h:327
RzCoreFile * file
Definition: rz_core.h:314
ut32 blocksize
Definition: rz_core.h:303
RzConfig * config
Definition: rz_core.h:300
struct rz_core_task_t * current_task
Definition: rz_core.h:276
struct rz_core_task_t * main_task
Definition: rz_core.h:277
int fd
Definition: rz_io.h:96
char * uri
Definition: rz_io.h:98
int perm
Definition: rz_io.h:97
Definition: rz_io.h:59
RzIDStorage * files
Definition: rz_io.h:75
struct rz_io_desc_t * desc
Definition: rz_io.h:60
ut64 value
Definition: rz_num.h:63
Definition: dis.h:43
RZ_API void rz_core_task_sync_end(RzCoreTaskScheduler *scheduler)
Definition: task.c:432
RZ_API void rz_core_task_sync_begin(RzCoreTaskScheduler *scheduler)
Definition: task.c:421
RZ_API RzListInfo * rz_listinfo_new(const char *name, RzInterval pitv, RzInterval vitv, int perm, const char *extra)
Definition: visual.c:4020
RZ_API void rz_listinfo_free(RzListInfo *info)
Definition: visual.c:4032
ut64(WINAPI *w32_GetEnabledXStateFeatures)()
static const z80_opcode fd[]
Definition: z80_tab.h:997
static int baseaddr
Definition: z80asm.c:79
static int addr
Definition: z80asm.c:58