Rizin
unix-like reverse engineering framework and cli tools
cmd_cmp.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_cmp.h>
5 #include "../core_private.h"
6 
7 static int rizin_compare_words(RzCore *core, ut64 of, ut64 od, int len, int ws) {
8  int i;
9  bool useColor = rz_config_get_i(core->config, "scr.color") != 0;
10  utAny v0, v1;
12  for (i = 0; i < len; i += ws) {
13  memset(&v0, 0, sizeof(v0));
14  memset(&v1, 0, sizeof(v1));
15  rz_io_nread_at(core->io, of + i, (ut8 *)&v0, ws);
16  rz_io_nread_at(core->io, od + i, (ut8 *)&v1, ws);
17  char ch = (v0.v64 == v1.v64) ? '=' : '!';
18  const char *color = useColor ? ch == '=' ? "" : pal->graph_false : "";
19  const char *colorEnd = useColor ? Color_RESET : "";
20 
21  if (useColor) {
22  rz_cons_printf("%s0x%08" PFMT64x " " Color_RESET, pal->offset, of + i);
23  } else {
24  rz_cons_printf("0x%08" PFMT64x " ", of + i);
25  }
26  switch (ws) {
27  case 1:
28  rz_cons_printf("%s0x%02x %c 0x%02x%s\n", color,
29  (ut32)(v0.v8 & 0xff), ch, (ut32)(v1.v8 & 0xff), colorEnd);
30  break;
31  case 2:
32  rz_cons_printf("%s0x%04hx %c 0x%04hx%s\n", color,
33  v0.v16, ch, v1.v16, colorEnd);
34  break;
35  case 4:
36  rz_cons_printf("%s0x%08" PFMT32x " %c 0x%08" PFMT32x "%s\n", color,
37  v0.v32, ch, v1.v32, colorEnd);
38  break;
39  case 8:
40  rz_cons_printf("%s0x%016" PFMT64x " %c 0x%016" PFMT64x "%s\n",
41  color, v0.v64, ch, v1.v64, colorEnd);
42  break;
43  }
44  }
45  return 0;
46 }
47 
49  int i, min = 1, inc = 16;
50  int headers = B_IS_SET(core->print->flags, RZ_PRINT_FLAGS_HEADER);
51  if (headers) {
53  }
54  for (i = 0; i < cmp->len; i += inc) {
55  min = RZ_MIN(16, (cmp->len - i));
56  if (!memcmp(cmp->data1 + i, cmp->data2 + i, min)) {
57  rz_cons_printf(" ");
58  rz_core_print_hexdiff(core, cmp->addr1 + i, cmp->data1 + i, cmp->addr1 + i, cmp->data1 + i, min, 0);
59  } else {
60  rz_cons_printf("- ");
61  rz_core_print_hexdiff(core, cmp->addr1 + i, cmp->data1 + i, cmp->addr2 + i, cmp->data2 + i, min, 0);
62  rz_cons_printf("+ ");
63  rz_core_print_hexdiff(core, cmp->addr2 + i, cmp->data2 + i, cmp->addr1 + i, cmp->data1 + i, min, 0);
64  }
65  }
66  if (headers) {
68  }
69  return true;
70 }
71 
72 static bool core_cmp_bits(RzCore *core, RzCompareData *cmp) {
73  const bool scr_color = rz_config_get_i(core->config, "scr.color");
74  int i;
76  const char *color = scr_color ? pal->offset : "";
77  const char *color_end = scr_color ? Color_RESET : "";
78  if (rz_config_get_i(core->config, "hex.header")) {
79  char *n = rz_str_newf("0x%08" PFMT64x, cmp->addr1);
80  const char *extra = rz_str_pad(' ', strlen(n) - 10);
81  free(n);
82  rz_cons_printf("%s- offset -%s 7 6 5 4 3 2 1 0%s\n", color, extra, color_end);
83  }
84  color = scr_color ? pal->graph_false : "";
85  color_end = scr_color ? Color_RESET : "";
86 
87  rz_cons_printf("%s0x%08" PFMT64x "%s ", color, cmp->addr1, color_end);
88  for (i = 7; i >= 0; i--) {
89  bool b0 = (cmp->data1[0] & 1 << i) ? 1 : 0;
90  bool b1 = (cmp->data2[0] & 1 << i) ? 1 : 0;
91  color = scr_color ? (b0 == b1) ? "" : b0 ? pal->graph_true
92  : pal->graph_false
93  : "";
94  color_end = scr_color ? Color_RESET : "";
95  rz_cons_printf("%s%d%s ", color, b0, color_end);
96  }
97  color = scr_color ? pal->graph_true : "";
98  color_end = scr_color ? Color_RESET : "";
99  rz_cons_printf("\n%s0x%08" PFMT64x "%s ", color, cmp->addr2, color_end);
100  for (i = 7; i >= 0; i--) {
101  bool b0 = (cmp->data1[0] & 1 << i) ? 1 : 0;
102  bool b1 = (cmp->data2[0] & 1 << i) ? 1 : 0;
103  color = scr_color ? (b0 == b1) ? "" : b1 ? pal->graph_true
104  : pal->graph_false
105  : "";
106  color_end = scr_color ? Color_RESET : "";
107  rz_cons_printf("%s%d%s ", color, b1, color_end);
108  }
109  rz_cons_newline();
110 
111  return true;
112 }
113 
114 // c
117  char *unescaped = strdup(argv[1]);
118  int len = rz_str_unescape(unescaped);
119  RzCompareData *cmp = rz_core_cmp_mem_data(core, core->offset, (ut8 *)unescaped, len);
120  if (!cmp) {
121  goto end;
122  }
123  int val = rz_core_cmp_print(core, cmp, state);
124  ret = val != -1 ? RZ_CMD_STATUS_OK : RZ_CMD_STATUS_ERROR;
125 
126 end:
128  free(unescaped);
129  return ret;
130 }
131 
132 // c1
133 RZ_IPI RzCmdStatus rz_cmd_cmp_bits_handler(RzCore *core, int argc, const char **argv) {
134  RzCompareData *cmp = rz_core_cmp_mem_mem(core, core->offset, rz_num_math(core->num, argv[1]), 1);
135  if (!cmp) {
136  return RZ_CMD_STATUS_ERROR;
137  }
138  bool val = core_cmp_bits(core, cmp);
141 }
142 
143 // ca
145  RzCompareData *cmp = rz_core_cmp_mem_mem(core, core->offset, rz_num_math(core->num, argv[1]), rz_num_math(core->num, argv[2]));
146  if (!cmp) {
147  return RZ_CMD_STATUS_ERROR;
148  }
149  int val = rz_core_cmp_print(core, cmp, state);
151  return val != -1 ? RZ_CMD_STATUS_OK : RZ_CMD_STATUS_ERROR;
152 }
153 
154 // cb
157  ut64 sz = rz_num_math(core->num, argv[2]);
158  if (sz > 8) {
159  RZ_LOG_ERROR("Cannot compare more than 8 bytes. Use the c command instead.\n");
160  return ret;
161  }
162 
163  ut64 num = rz_num_math(core->num, argv[1]);
164  ut64 mask = -1;
165  mask >>= 8 - sz;
166  ut64 valid_num = num & mask;
167  RzCompareData *cmp = rz_core_cmp_mem_data(core, core->offset, (ut8 *)&valid_num, sz);
168  if (!cmp) {
169  goto end;
170  }
171  int val = rz_core_cmp_print(core, cmp, state);
172  ret = val != -1 ? RZ_CMD_STATUS_OK : RZ_CMD_STATUS_ERROR;
173 
174 end:
176  return ret;
177 }
178 
179 // cc
181  ut64 addr = rz_num_math(core->num, argv[1]);
182  bool col = core->cons->columns > 123;
183  ut8 *b = malloc(core->blocksize);
184  if (b) {
185  memset(b, 0xff, core->blocksize);
186  rz_io_nread_at(core->io, addr, b, core->blocksize);
187  rz_core_print_hexdiff(core, core->offset, core->block, addr, b, core->blocksize, col);
188  }
189  free(b);
190  return RZ_CMD_STATUS_OK;
191 }
192 
193 // ccc
195  ut32 oflags = core->print->flags;
197  ut64 addr = rz_num_math(core->num, argv[1]);
198  bool col = core->cons->columns > 123;
199  ut8 *b = malloc(core->blocksize);
200  if (b) {
201  memset(b, 0xff, core->blocksize);
202  rz_io_nread_at(core->io, addr, b, core->blocksize);
203  rz_core_print_hexdiff(core, core->offset, core->block, addr, b, core->blocksize, col);
204  }
205  free(b);
206  core->print->flags = oflags;
207  return RZ_CMD_STATUS_OK;
208 }
209 
210 // ccd
211 RZ_IPI RzCmdStatus rz_cmd_cmp_disasm_handler(RzCore *core, int argc, const char **argv) {
212  RzList *cmp = rz_core_cmp_disasm(core, core->offset, rz_num_math(core->num, argv[1]), core->blocksize);
213  bool ret = rz_core_cmp_disasm_print(core, cmp, false);
214  rz_list_free(cmp);
215  return ret ? RZ_CMD_STATUS_OK : RZ_CMD_STATUS_ERROR;
216 }
217 
218 // cf
220  FILE *fd = rz_sys_fopen(argv[1], "rb");
221  if (!fd) {
222  RZ_LOG_ERROR("Cannot open file: %s\n", argv[1]);
223  return RZ_CMD_STATUS_ERROR;
224  }
226  ut8 *buf = (ut8 *)malloc(core->blocksize);
227  if (!buf) {
228  goto return_goto;
229  }
230  if (fread(buf, 1, core->blocksize, fd) < 1) {
231  RZ_LOG_ERROR("Cannot read file: %s\n", argv[1]);
232  goto return_goto;
233  }
234  RzCompareData *cmp = rz_core_cmp_mem_data(core, core->offset, buf, core->blocksize);
235  if (!cmp) {
236  goto return_goto;
237  }
238  int val = rz_core_cmp_print(core, cmp, state);
241 
242 return_goto:
243  free(buf);
244  fclose(fd);
245  return stat;
246 }
247 
248 // cu
249 RZ_IPI RzCmdStatus rz_cmd_cmp_unified_handler(RzCore *core, int argc, const char **argv) {
250  RzCompareData *cmp = rz_core_cmp_mem_mem(core, core->offset, rz_num_math(core->num, argv[1]), core->blocksize);
251  bool ret = rizin_compare_unified(core, cmp);
253  return ret ? RZ_CMD_STATUS_OK : RZ_CMD_STATUS_ERROR;
254 }
255 
256 // cu1
257 RZ_IPI RzCmdStatus rz_cmd_cmp_unified1_handler(RzCore *core, int argc, const char **argv) {
258  rizin_compare_words(core, core->offset, rz_num_math(core->num, argv[1]), core->blocksize, 1);
259  return RZ_CMD_STATUS_OK;
260 }
261 
262 // cu2
263 RZ_IPI RzCmdStatus rz_cmd_cmp_unified2_handler(RzCore *core, int argc, const char **argv) {
264  rizin_compare_words(core, core->offset, rz_num_math(core->num, argv[1]), core->blocksize, 2);
265  return RZ_CMD_STATUS_OK;
266 }
267 
268 // cu4
269 RZ_IPI RzCmdStatus rz_cmd_cmp_unified4_handler(RzCore *core, int argc, const char **argv) {
270  rizin_compare_words(core, core->offset, rz_num_math(core->num, argv[1]), core->blocksize, 4);
271  return RZ_CMD_STATUS_OK;
272 }
273 
274 // cu8
275 RZ_IPI RzCmdStatus rz_cmd_cmp_unified8_handler(RzCore *core, int argc, const char **argv) {
276  rizin_compare_words(core, core->offset, rz_num_math(core->num, argv[1]), core->blocksize, 8);
277  return RZ_CMD_STATUS_OK;
278 }
279 
280 // cud
282  RzList *cmp = rz_core_cmp_disasm(core, core->offset, rz_num_math(core->num, argv[1]), core->blocksize);
283  bool ret = rz_core_cmp_disasm_print(core, cmp, true);
284  rz_list_free(cmp);
285  return ret ? RZ_CMD_STATUS_OK : RZ_CMD_STATUS_ERROR;
286 }
287 
288 // cw
290  return rz_core_cmpwatch_add(core, core->offset, atoi(argv[1]), argv[2]) ? RZ_CMD_STATUS_OK : RZ_CMD_STATUS_ERROR;
291 }
292 
293 // cwl
296  return RZ_CMD_STATUS_OK;
297 }
298 
299 // cwr
302 }
303 
304 // cwu
307 }
308 
309 // cwx
312 }
313 
314 // cx
316  char *input = strdup(argv[1]);
318  unsigned char *buf;
319  int ret = false;
320  if (!(buf = (ut8 *)malloc(strlen(input) + 1))) {
321  goto return_goto;
322  }
323  ret = rz_hex_bin2str(core->block, strlen(input) / 2, (char *)buf);
324  for (int i = 0; i < ret * 2; i++) {
325  if (input[i] == '.') {
326  input[i] = buf[i];
327  }
328  }
329  ret = rz_hex_str2bin(input, buf);
330  if (ret < 1) {
331  RZ_LOG_ERROR("Cannot parse hexpair\n");
332  ret = false;
333  goto return_goto;
334  }
335  RzCompareData *cmp = rz_core_cmp_mem_data(core, core->offset, buf, strlen(input) / 2);
336  if (!cmp) {
337  goto return_goto;
338  }
339  core->num->value = cmp->same ? 0 : 1;
340  int val = rz_core_cmp_print(core, cmp, state);
342  ret = val != -1;
343 
344 return_goto:
345  free(input);
346  free(buf);
347  return ret ? RZ_CMD_STATUS_OK : RZ_CMD_STATUS_ERROR;
348 }
349 
350 // cX
352  unsigned char *buf = malloc(core->blocksize);
353  bool ret = false;
354  if (!buf) {
355  goto return_goto;
356  }
357  if (rz_io_nread_at(core->io, rz_num_math(core->num, argv[1]), buf, core->blocksize) == -1) {
358  RZ_LOG_ERROR("Cannot read hexdump at %s\n", argv[1]);
359  goto return_goto;
360  }
361 
362  RzCompareData *cmp = rz_core_cmp_mem_data(core, core->offset, buf, core->blocksize);
363  if (!cmp) {
364  free(cmp);
365  goto return_goto;
366  }
367  int val = rz_core_cmp_print(core, cmp, state);
369  ret = val != -1;
370 
371 return_goto:
372  free(buf);
373  return ret ? RZ_CMD_STATUS_OK : RZ_CMD_STATUS_ERROR;
374 }
size_t len
Definition: 6502dis.c:15
#define mask()
#define PFMT32x
#define RZ_IPI
Definition: analysis_wasm.c:11
lzma_index ** i
Definition: index.h:629
static RzILOpEffect * cmp(cs_insn *insn, bool is_thumb)
Definition: arm_il32.c:942
ut16 val
Definition: armass64_const.h:6
RZ_IPI RzCmdStatus rz_cmd_cmp_bytes_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
Definition: cmd_cmp.c:155
RZ_IPI RzCmdStatus rz_cmd_cmp_add_memory_watcher_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_cmp.c:289
static int rizin_compare_words(RzCore *core, ut64 of, ut64 od, int len, int ws)
Definition: cmd_cmp.c:7
RZ_IPI RzCmdStatus rz_cmd_cmp_hex_block_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_cmp.c:180
RZ_IPI RzCmdStatus rz_cmd_cmp_file_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
Definition: cmd_cmp.c:219
RZ_IPI RzCmdStatus rz_cmd_cmp_unified1_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_cmp.c:257
RZ_IPI RzCmdStatus rz_cmd_cmp_unified_disasm_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_cmp.c:281
RZ_IPI RzCmdStatus rz_cmd_cmp_remove_watcher_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_cmp.c:310
RZ_IPI RzCmdStatus rz_cmd_cmp_list_compare_watchers_handler(RzCore *core, int argc, const char **argv, RzOutputMode mode)
Definition: cmd_cmp.c:294
RZ_IPI RzCmdStatus rz_cmd_cmp_unified4_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_cmp.c:269
RZ_IPI RzCmdStatus rz_cmd_cmp_hex_diff_lines_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_cmp.c:194
static bool rizin_compare_unified(RzCore *core, RzCompareData *cmp)
Definition: cmd_cmp.c:48
RZ_IPI RzCmdStatus rz_cmd_cmp_reset_watcher_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_cmp.c:300
RZ_IPI RzCmdStatus rz_cmd_cmp_bits_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_cmp.c:133
RZ_IPI RzCmdStatus rz_cmd_cmp_string_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
Definition: cmd_cmp.c:115
RZ_IPI RzCmdStatus rz_cmd_cmp_disasm_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_cmp.c:211
RZ_IPI RzCmdStatus rz_cmd_cmp_unified2_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_cmp.c:263
static bool core_cmp_bits(RzCore *core, RzCompareData *cmp)
Definition: cmd_cmp.c:72
RZ_IPI RzCmdStatus rz_cmd_cmp_hex_block_hexdiff_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
Definition: cmd_cmp.c:351
RZ_IPI RzCmdStatus rz_cmd_cmp_hexpair_string_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
Definition: cmd_cmp.c:315
RZ_IPI RzCmdStatus rz_cmd_cmp_update_watcher_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_cmp.c:305
RZ_IPI RzCmdStatus rz_cmd_cmp_addr_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
Definition: cmd_cmp.c:144
RZ_IPI RzCmdStatus rz_cmd_cmp_unified_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_cmp.c:249
RZ_IPI RzCmdStatus rz_cmd_cmp_unified8_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_cmp.c:275
RZ_API bool rz_core_cmp_disasm_print(RzCore *core, const RzList *compare, bool unified)
Print the instruction comparison data compare.
Definition: cmp.c:243
RZ_API void rz_core_cmp_free(RzCompareData *cmp)
Free RzCompareData object.
Definition: cmp.c:226
RZ_API RZ_OWN RzList * rz_core_cmp_disasm(RzCore *core, ut64 addr1, ut64 addr2, ut32 len)
Compare the instructions at addr1 and addr2.
Definition: cmp.c:161
RZ_API RZ_OWN RzCompareData * rz_core_cmp_mem_mem(RzCore *core, ut64 addr1, ut64 addr2, ut32 len)
Compare memory at addr1 with the memory at addr2.
Definition: cmp.c:17
RZ_API RZ_OWN RzCompareData * rz_core_cmp_mem_data(RzCore *core, ut64 addr, RZ_NONNULL const ut8 *data, ut32 len)
Compare mem at addr with data data.
Definition: cmp.c:56
RZ_API int rz_core_cmp_print(RzCore *core, RZ_NONNULL const RzCompareData *cmp, RzCmdStateOutput *state)
Print a comparison cmp according to the print mode mode.
Definition: cmp.c:93
RZ_API ut64 rz_config_get_i(RzConfig *cfg, RZ_NONNULL const char *name)
Definition: config.c:119
RZ_API RzCons * rz_cons_singleton(void)
Definition: cons.c:300
RZ_API void rz_cons_newline(void)
Definition: cons.c:1274
RZ_API int rz_cons_printf(const char *format,...)
Definition: cons.c:1202
RZ_IPI void rz_core_print_hexdiff(RZ_NONNULL RzCore *core, ut64 aa, RZ_NONNULL const ut8 *_a, ut64 ba, RZ_NONNULL const ut8 *_b, int len, int scndcol)
Definition: cprint.c:182
uint32_t ut32
RZ_API void rz_core_cmpwatch_show(RzCore *core, ut64 addr, RzOutputMode mode)
Show/print the memory watcher present at address addr.
Definition: cmp.c:397
RZ_API bool rz_core_cmpwatch_update(RzCore *core, ut64 addr)
Update the memory watcher at address addr.
Definition: cmp.c:430
RZ_API bool rz_core_cmpwatch_del(RzCore *core, ut64 addr)
Delete a memory watcher at address addr.
Definition: cmp.c:375
RZ_API bool rz_core_cmpwatch_add(RzCore *core, ut64 addr, int size, const char *cmd)
Add a memory watcher at address addr od size size and command cmd.
Definition: cmp.c:337
RZ_API bool rz_core_cmpwatch_revert(RzCore *core, ut64 addr)
Revert/reset a memory watcher at address addr.
Definition: cmp.c:458
RZ_API void Ht_() free(HtName_(Ht) *ht)
Definition: ht_inc.c:130
const char int mode
Definition: ioapi.h:137
voidpf void * buf
Definition: ioapi.h:138
@ v0
Definition: lanai.h:84
@ v1
Definition: lanai.h:85
uint8_t ut8
Definition: lh5801.h:11
return memset(p, 0, total)
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 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 static sig const char static mode static oldfd struct tms static buf static getgid static geteuid const char static filename static arg static mask struct ustat static ubuf static getppid static setsid static egid sigset_t static set struct timeval struct timezone static tz fd_set fd_set fd_set struct timeval static timeout const char char static bufsiz const char static swapflags void static offset const char static length static mode static who const char struct statfs static buf unsigned unsigned num
Definition: sflib.h:126
static stat
Definition: sflib.h:131
static static fork const void static count static fd const char const char static newpath char char argv
Definition: sflib.h:40
return strdup("=SP r13\n" "=LR r14\n" "=PC r15\n" "=A0 r0\n" "=A1 r1\n" "=A2 r2\n" "=A3 r3\n" "=ZF zf\n" "=SF nf\n" "=OF vf\n" "=CF cf\n" "=SN or0\n" "gpr lr .32 56 0\n" "gpr pc .32 60 0\n" "gpr cpsr .32 64 0 ____tfiae_________________qvczn\n" "gpr or0 .32 68 0\n" "gpr tf .1 64.5 0 thumb\n" "gpr ef .1 64.9 0 endian\n" "gpr jf .1 64.24 0 java\n" "gpr qf .1 64.27 0 sticky_overflow\n" "gpr vf .1 64.28 0 overflow\n" "gpr cf .1 64.29 0 carry\n" "gpr zf .1 64.30 0 zero\n" "gpr nf .1 64.31 0 negative\n" "gpr itc .4 64.10 0 if_then_count\n" "gpr gef .4 64.16 0 great_or_equal\n" "gpr r0 .32 0 0\n" "gpr r1 .32 4 0\n" "gpr r2 .32 8 0\n" "gpr r3 .32 12 0\n" "gpr r4 .32 16 0\n" "gpr r5 .32 20 0\n" "gpr r6 .32 24 0\n" "gpr r7 .32 28 0\n" "gpr r8 .32 32 0\n" "gpr r9 .32 36 0\n" "gpr r10 .32 40 0\n" "gpr r11 .32 44 0\n" "gpr r12 .32 48 0\n" "gpr r13 .32 52 0\n" "gpr r14 .32 56 0\n" "gpr r15 .32 60 0\n" "gpr r16 .32 64 0\n" "gpr r17 .32 68 0\n")
int n
Definition: mipsasm.c:19
string FILE
Definition: benchmark.py:21
#define min(a, b)
Definition: qsort.h:83
enum rz_cmd_status_t RzCmdStatus
@ RZ_CMD_STATUS_OK
command handler exited in the right way
Definition: rz_cmd.h:24
@ RZ_CMD_STATUS_ERROR
command handler had issues while running (e.g. allocation error, etc.)
Definition: rz_cmd.h:26
#define Color_RESET
Definition: rz_cons.h:617
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 int rz_hex_bin2str(const ut8 *in, int len, char *out)
Definition: hex.c:382
RZ_API int rz_io_nread_at(RzIO *io, ut64 addr, ut8 *buf, int len)
Definition: io.c:338
#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
#define RZ_PRINT_FLAGS_DIFFOUT
Definition: rz_print.h:23
#define RZ_PRINT_FLAGS_HEADER
Definition: rz_print.h:18
RZ_API char * rz_str_newf(const char *fmt,...) RZ_PRINTF_CHECK(1
RZ_API const char * rz_str_pad(const char ch, int len)
Definition: str.c:3236
RZ_API int rz_str_unescape(char *buf)
Definition: str.c:1300
RZ_API void rz_str_remove_char(char *str, char c)
Definition: str.c:173
RZ_API FILE * rz_sys_fopen(const char *path, const char *mode)
Definition: sys.c:1815
RzOutputMode
Enum to describe the way data are printed.
Definition: rz_types.h:38
#define PFMT64x
Definition: rz_types.h:393
#define RZ_MIN(x, y)
#define B_SET(x, n)
#define UT64_MAX
Definition: rz_types_base.h:86
#define B_IS_SET(x, n)
#define B_UNSET(x, n)
#define b(i)
Definition: sha256.c:42
Represent the output state of a command handler.
Definition: rz_cmd.h:91
RzConsPrintablePalette pal
Definition: rz_cons.h:491
int columns
Definition: rz_cons.h:510
RzConsContext * context
Definition: rz_cons.h:502
RzCons * cons
Definition: rz_core.h:312
ut64 offset
Definition: rz_core.h:301
RzIO * io
Definition: rz_core.h:313
RzNum * num
Definition: rz_core.h:316
ut8 * block
Definition: rz_core.h:305
RzPrint * print
Definition: rz_core.h:327
ut32 blocksize
Definition: rz_core.h:303
RzConfig * config
Definition: rz_core.h:300
ut64 value
Definition: rz_num.h:63
int flags
Definition: rz_print.h:137
Definition: sftypes.h:80
Definition: dis.h:43
static int color
Definition: visual.c:20
ut64(WINAPI *w32_GetEnabledXStateFeatures)()
static const z80_opcode fd[]
Definition: z80_tab.h:997
static int addr
Definition: z80asm.c:58
static bool input(void *ud, zip_uint8_t *data, zip_uint64_t length)