Rizin
unix-like reverse engineering framework and cli tools
cmd_seek.c
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: 2009-2020 pancake <pancake@nopcode.org>
2 // SPDX-License-Identifier: LGPL-3.0-only
3 
4 #include "rz_types.h"
5 #include "rz_config.h"
6 #include "rz_cons.h"
7 #include "rz_core.h"
8 #include "rz_debug.h"
9 #include "rz_io.h"
10 
11 static void printPadded(RzCore *core, int pad) {
12  if (pad < 1) {
13  pad = 8;
14  }
15  char *fmt = rz_str_newf("0x%%0%d" PFMT64x, pad);
16  char *off = rz_str_newf(fmt, core->offset);
17  rz_cons_printf("%s\n", off);
18  free(off);
19  free(fmt);
20 }
21 
22 RZ_IPI bool rz_core_seek_to_register(RzCore *core, const char *regname, bool is_silent) {
24  return rz_core_seek_opt(core, off, true, !is_silent);
25 }
26 
27 RZ_IPI int rz_core_seek_opcode_backward(RzCore *core, int numinstr, bool silent) {
28  int i, val = 0;
29  // N previous instructions
30  ut64 addr = core->offset;
31  int ret = 0;
32  if (rz_core_prevop_addr(core, core->offset, numinstr, &addr)) {
33  ret = core->offset - addr;
34  } else {
35 #if 0
36  // core_asm_bwdis_len is really buggy and we should remove it. seems like prevop_addr
37  // works as expected, because is the one used from visual
38  ret = rz_core_asm_bwdis_len (core, &instr_len, &addr, numinstr);
39 #endif
40  addr = core->offset;
41  const int mininstrsize = rz_analysis_archinfo(core->analysis, RZ_ANALYSIS_ARCHINFO_MIN_OP_SIZE);
42  for (i = 0; i < numinstr; i++) {
43  ut64 prev_addr = rz_core_prevop_addr_force(core, addr, 1);
44  if (prev_addr == UT64_MAX) {
45  prev_addr = addr - mininstrsize;
46  }
47  if (prev_addr == UT64_MAX || prev_addr >= core->offset) {
48  break;
49  }
50  RzAsmOp op = { 0 };
51  rz_core_seek(core, prev_addr, true);
52  rz_asm_disassemble(core->rasm, &op, core->block, 32);
53  if (op.size < mininstrsize) {
54  op.size = mininstrsize;
55  }
56  val += op.size;
57  addr = prev_addr;
58  }
59  }
60  rz_core_seek_opt(core, addr, true, !silent);
61  val += ret;
62  return val;
63 }
64 
66  // N forward instructions
67  int i, ret, val = 0;
68  if (!silent) {
69  rz_core_seek_mark(core);
70  }
71  for (val = i = 0; i < n; i++) {
73  ret = rz_analysis_op(core->analysis, &op, core->offset, core->block,
75  if (ret < 1) {
76  ret = 1;
77  }
78  rz_core_seek_delta(core, ret, false);
80  val += ret;
81  }
82  rz_core_seek_save(core);
83  return val;
84 }
85 
86 RZ_IPI int rz_core_seek_opcode(RzCore *core, int n, bool silent) {
87  int val = (n < 0)
90  core->num->value = val;
91  return val;
92 }
93 
94 static void cmd_seek_opcode(RzCore *core, const char *input, bool silent) {
95  if (input[0] == '?') {
96  eprintf("Usage: so [-][n]\n");
97  return;
98  }
99  if (!strcmp(input, "-")) {
100  input = "-1";
101  }
102  int n = rz_num_math(core->num, input);
103  if (n == 0) {
104  n = 1;
105  }
106  rz_core_seek_opcode(core, n, silent);
107 }
108 
109 RZ_IPI int rz_seek_search(void *data, const char *input) {
110  RzCore *core = (RzCore *)data;
111  const char *pfx = rz_config_get(core->config, "search.prefix");
112  const ut64 saved_from = rz_config_get_i(core->config, "search.from");
113  const ut64 saved_maxhits = rz_config_get_i(core->config, "search.maxhits");
114  int kwidx = core->search->n_kws; // (int)rz_config_get_i (core->config, "search.kwidx")-1;
115  if (kwidx < 0) {
116  kwidx = 0;
117  }
118  switch (input[0]) {
119  case ' ':
120  case 'v':
121  case 'V':
122  case 'w':
123  case 'W':
124  case 'z':
125  case 'm':
126  case 'c':
127  case 'A':
128  case 'e':
129  case 'E':
130  case 'i':
131  case 'R':
132  case 'r':
133  case '/':
134  case 'x':
135  rz_config_set_i(core->config, "search.from", core->offset + 1);
136  rz_config_set_i(core->config, "search.maxhits", 1);
137  rz_core_cmdf(core, "sd 1@e:cfg.seek.silent=true; /%s; sd -1@e:cfg.seek.silent=true; s %s%d_0; f- %s%d_0",
138  input, pfx, kwidx, pfx, kwidx);
139  rz_config_set_i(core->config, "search.from", saved_from);
140  rz_config_set_i(core->config, "search.maxhits", saved_maxhits);
141  break;
142  case '?':
143  eprintf("Usage: s/.. arg.\n");
144  rz_cons_printf("/?\n");
145  break;
146  default:
147  eprintf("unknown search method\n");
148  break;
149  }
150  return 0;
151 }
152 
153 static RzCmdStatus bool2cmdstatus(bool res) {
154  return res ? RZ_CMD_STATUS_OK : RZ_CMD_STATUS_ERROR;
155 }
156 
157 RZ_IPI RzCmdStatus rz_seek_handler(RzCore *core, int argc, const char **argv) {
158  if (argc == 1) {
159  rz_cons_printf("0x%" PFMT64x "\n", core->offset);
160  return RZ_CMD_STATUS_OK;
161  }
162 
163  rz_core_seek_mark(core);
164 
165  // NOTE: hack to make it work with local function labels
166  char *ptr;
167  if ((ptr = strstr(argv[1], "+.")) != NULL) {
168  char *dup = strdup(argv[1]);
169  dup[ptr - argv[1]] = '\x00';
170  core->offset = rz_num_math(core->num, dup);
171  ;
172  free(dup);
173  }
174 
175  ut64 addr = rz_num_math(core->num, argv[1]);
176  if (core->num->nc.errors) {
177  RZ_LOG_ERROR("Cannot seek to unknown address '%s'\n", core->num->nc.calc_buf);
178  return RZ_CMD_STATUS_ERROR;
179  }
180  return bool2cmdstatus(rz_core_seek_and_save(core, addr, true));
181 }
182 
183 RZ_IPI RzCmdStatus rz_seek_delta_handler(RzCore *core, int argc, const char **argv) {
184  st64 delta = strtoll(argv[1], NULL, 0);
185  return bool2cmdstatus(rz_core_seek_delta(core, delta, true));
186 }
187 
188 RZ_IPI RzCmdStatus rz_seek_padded_handler(RzCore *core, int argc, const char **argv) {
189  int n = argc > 1 ? atoi(argv[1]) : 0;
190  printPadded(core, n);
191  return RZ_CMD_STATUS_OK;
192 }
193 
194 RZ_IPI RzCmdStatus rz_seek_base_handler(RzCore *core, int argc, const char **argv) {
195  return bool2cmdstatus(rz_core_seek_base(core, argv[1], true));
196 }
197 
199  int n = 1;
200  if (argc == 2) {
201  n = rz_num_math(core->num, argv[1]);
202  }
203  int delta = -core->blocksize / n;
204  return bool2cmdstatus(rz_core_seek_delta(core, delta, true));
205 }
206 
208  int n = 1;
209  if (argc == 2) {
210  n = rz_num_math(core->num, argv[1]);
211  }
212  int delta = core->blocksize / n;
213  return bool2cmdstatus(rz_core_seek_delta(core, delta, true));
214 }
215 
216 RZ_IPI RzCmdStatus rz_seek_redo_handler(RzCore *core, int argc, const char **argv) {
217  return bool2cmdstatus(rz_core_seek_redo(core));
218 }
219 
220 RZ_IPI RzCmdStatus rz_seek_undo_handler(RzCore *core, int argc, const char **argv) {
221  return bool2cmdstatus(rz_core_seek_undo(core));
222 }
223 
224 RZ_IPI RzCmdStatus rz_seek_undo_reset_handler(RzCore *core, int argc, const char **argv) {
225  rz_core_seek_reset(core);
226  return RZ_CMD_STATUS_OK;
227 }
228 
230  RzList *list = rz_core_seek_list(core);
231  RzListIter *iter;
232  RzCoreSeekItem *undo;
233  PJ *pj = state->d.pj;
235  bool current_met = false;
236  rz_list_foreach (list, iter, undo) {
237  RzFlagItem *f = rz_flag_get_at(core->flags, undo->offset, true);
238  const char *comment;
239  char *name = NULL;
240  if (f) {
241  if (f->offset != undo->offset) {
242  name = rz_str_newf("%s+%" PFMT64d, f->name, undo->offset - f->offset);
243  } else {
244  name = strdup(f->name);
245  }
246  }
247  current_met |= undo->is_current;
248  switch (state->mode) {
249  case RZ_OUTPUT_MODE_JSON:
250  pj_o(pj);
251  pj_kn(pj, "offset", undo->offset);
252  pj_kn(pj, "cursor", undo->cursor);
253  if (name) {
254  pj_ks(pj, "name", name);
255  }
256  pj_kb(pj, "current", undo->is_current);
257  pj_end(pj);
258  break;
260  comment = "";
261  if (undo->is_current) {
262  comment = " # current seek";
263  } else if (current_met) {
264  comment = " # redo";
265  }
266  rz_cons_printf("0x%" PFMT64x " %s%s\n", undo->offset, name ? name : "", comment);
267  break;
269  if (undo->is_current) {
270  rz_cons_printf("# Current seek @ 0x%" PFMT64x "\n", undo->offset);
271  } else if (current_met) {
272  rz_cons_printf("f redo_%d @ 0x%" PFMT64x "\n", RZ_ABS(undo->idx - 1), undo->offset);
273  } else {
274  rz_cons_printf("f undo_%d @ 0x%" PFMT64x "\n", RZ_ABS(undo->idx + 1), undo->offset);
275  }
276  break;
277  default:
279  break;
280  }
281  free(name);
282  }
284  return RZ_CMD_STATUS_OK;
285 }
286 
287 RZ_IPI RzCmdStatus rz_seek_asz_handler(RzCore *core, int argc, const char **argv) {
288  ut64 align = rz_num_math(NULL, argv[1]);
289  ut64 addr = core->offset;
290  rz_core_seek_mark(core);
291  if (argc > 2) {
292  addr = rz_num_math(core->num, argv[2]);
293  rz_core_seek(core, addr, false);
294  }
295  return bool2cmdstatus(rz_core_seek_align(core, align, true));
296 }
297 
298 RZ_IPI RzCmdStatus rz_seek_basicblock_handler(RzCore *core, int argc, const char **argv) {
299  return bool2cmdstatus(rz_core_seek_analysis_bb(core, core->offset, true));
300 }
301 
302 RZ_IPI RzCmdStatus rz_seek_function_handler(RzCore *core, int argc, const char **argv) {
303  RzAnalysisFunction *fcn = NULL;
304  ut64 addr;
305  if (argc == 1) {
306  fcn = rz_analysis_get_fcn_in(core->analysis, core->offset, 0);
307  if (!fcn) {
308  return RZ_CMD_STATUS_ERROR;
309  }
311  } else {
313  if (!fcn) {
314  return RZ_CMD_STATUS_ERROR;
315  }
316  addr = fcn->addr;
317  }
318  return bool2cmdstatus(rz_core_seek_and_save(core, addr, true));
319 }
320 
323  if (!fcn) {
324  return RZ_CMD_STATUS_ERROR;
325  }
326  return bool2cmdstatus(rz_core_seek_and_save(core, fcn->addr, true));
327 }
328 
329 RZ_IPI RzCmdStatus rz_seek_begin_handler(RzCore *core, int argc, const char **argv) {
330  RzIOMap *map = rz_io_map_get(core->io, core->offset);
331  ut64 addr = map ? map->itv.addr : 0;
332  return bool2cmdstatus(rz_core_seek_and_save(core, addr, true));
333 }
334 
335 RZ_IPI RzCmdStatus rz_seek_end_handler(RzCore *core, int argc, const char **argv) {
336  RzIOMap *map = rz_io_map_get(core->io, core->offset);
337  // XXX: this +2 is a hack. must fix gap between sections
338  ut64 addr = map ? map->itv.addr + map->itv.size + 2 : rz_io_fd_size(core->io, core->file->fd);
339  return bool2cmdstatus(rz_core_seek_and_save(core, addr, true));
340 }
341 
342 RZ_IPI RzCmdStatus rz_seek_next_handler(RzCore *core, int argc, const char **argv) {
343  const char *nkey;
344  if (argc == 1) {
345  nkey = rz_config_get(core->config, "scr.nkey");
346  } else {
347  nkey = argv[1];
348  }
349  return bool2cmdstatus(rz_core_seek_next(core, nkey, true));
350 }
351 
352 RZ_IPI RzCmdStatus rz_seek_prev_handler(RzCore *core, int argc, const char **argv) {
353  const char *nkey;
354  if (argc == 1) {
355  nkey = rz_config_get(core->config, "scr.nkey");
356  } else {
357  nkey = argv[1];
358  }
359  return bool2cmdstatus(rz_core_seek_prev(core, nkey, true));
360 }
361 
362 RZ_IPI RzCmdStatus rz_seek_opcode_handler(RzCore *core, int argc, const char **argv) {
363  cmd_seek_opcode(core, argc > 1 ? argv[1] : "", false);
364  return RZ_CMD_STATUS_OK;
365 }
366 
367 RZ_IPI RzCmdStatus rz_seek_register_handler(RzCore *core, int argc, const char **argv) {
368  return bool2cmdstatus(rz_core_seek_to_register(core, argv[1], false));
369 }
ut8 op
Definition: 6502dis.c:13
RZ_API ut64 rz_analysis_function_max_addr(RzAnalysisFunction *fcn)
Definition: function.c:328
RZ_API int rz_analysis_archinfo(RzAnalysis *analysis, int query)
Definition: analysis.c:449
#define RZ_IPI
Definition: analysis_wasm.c:11
lzma_index ** i
Definition: index.h:629
ut16 val
Definition: armass64_const.h:6
RZ_API int rz_asm_disassemble(RzAsm *a, RzAsmOp *op, const ut8 *buf, int len)
Definition: asm.c:543
RZ_API ut32 rz_core_asm_bwdis_len(RzCore *core, int *instr_len, ut64 *start_addr, ut32 nb)
Definition: casm.c:890
RZ_API int rz_core_cmdf(RzCore *core, const char *fmt,...)
Definition: cmd.c:5413
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 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_seek_opcode_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_seek.c:362
static void cmd_seek_opcode(RzCore *core, const char *input, bool silent)
Definition: cmd_seek.c:94
RZ_IPI bool rz_core_seek_to_register(RzCore *core, const char *regname, bool is_silent)
Definition: cmd_seek.c:22
RZ_IPI RzCmdStatus rz_seek_function_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_seek.c:302
RZ_IPI RzCmdStatus rz_seek_undo_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_seek.c:220
RZ_IPI RzCmdStatus rz_seek_register_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_seek.c:367
RZ_IPI RzCmdStatus rz_seek_function_current_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_seek.c:321
static void printPadded(RzCore *core, int pad)
Definition: cmd_seek.c:11
RZ_IPI RzCmdStatus rz_seek_padded_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_seek.c:188
RZ_IPI RzCmdStatus rz_seek_next_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_seek.c:342
RZ_IPI RzCmdStatus rz_seek_prev_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_seek.c:352
RZ_IPI int rz_core_seek_opcode_backward(RzCore *core, int numinstr, bool silent)
Definition: cmd_seek.c:27
RZ_IPI int rz_core_seek_opcode(RzCore *core, int n, bool silent)
Definition: cmd_seek.c:86
static RzCmdStatus bool2cmdstatus(bool res)
Definition: cmd_seek.c:153
RZ_IPI RzCmdStatus rz_seek_delta_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_seek.c:183
RZ_IPI int rz_seek_search(void *data, const char *input)
Definition: cmd_seek.c:109
RZ_IPI RzCmdStatus rz_seek_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_seek.c:157
RZ_IPI RzCmdStatus rz_seek_base_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_seek.c:194
RZ_IPI RzCmdStatus rz_seek_begin_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_seek.c:329
RZ_IPI RzCmdStatus rz_seek_blocksize_backward_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_seek.c:198
RZ_IPI int rz_core_seek_opcode_forward(RzCore *core, int n, bool silent)
Definition: cmd_seek.c:65
RZ_IPI RzCmdStatus rz_seek_undo_reset_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_seek.c:224
RZ_IPI RzCmdStatus rz_seek_blocksize_forward_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_seek.c:207
RZ_IPI RzCmdStatus rz_seek_end_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_seek.c:335
RZ_IPI RzCmdStatus rz_seek_basicblock_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_seek.c:298
RZ_IPI RzCmdStatus rz_seek_redo_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_seek.c:216
RZ_IPI RzCmdStatus rz_seek_asz_handler(RzCore *core, int argc, const char **argv)
Definition: cmd_seek.c:287
RZ_IPI RzCmdStatus rz_seek_history_list_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
Definition: cmd_seek.c:229
RZ_API ut64 rz_config_get_i(RzConfig *cfg, RZ_NONNULL const char *name)
Definition: config.c:119
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 int rz_cons_printf(const char *format,...)
Definition: cons.c:1202
RZ_API ut64 rz_core_reg_getv_by_role_or_name(RzCore *core, const char *name)
rz_reg_getv_by_role_or_name() on rz_core_reg_default()
Definition: creg.c:24
#define NULL
Definition: cris-opc.c:27
size_t map(int syms, int left, int len)
Definition: enough.c:237
RZ_DEPRECATE RZ_API RzAnalysisFunction * rz_analysis_get_fcn_in(RzAnalysis *analysis, ut64 addr, int type)
Definition: fcn.c:1687
RZ_API RzAnalysisFunction * rz_analysis_get_function_byname(RzAnalysis *a, const char *name)
Definition: fcn.c:1729
RZ_API RzFlagItem * rz_flag_get_at(RzFlag *f, ut64 off, bool closest)
Definition: flag.c:404
RZ_API void Ht_() free(HtName_(Ht) *ht)
Definition: ht_inc.c:130
static void list(RzEgg *egg)
Definition: rz-gg.c:52
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 dup
Definition: sflib.h:68
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")
@ RZ_ABS
int n
Definition: mipsasm.c:19
RZ_API bool rz_analysis_op_fini(RzAnalysisOp *op)
Definition: op.c:37
RZ_API int rz_analysis_op(RzAnalysis *analysis, RzAnalysisOp *op, ut64 addr, const ut8 *data, int len, RzAnalysisOpMask mask)
Definition: op.c:96
int off
Definition: pal.c:13
static void pad(RzStrBuf *sb, ut32 count)
Definition: protobuf.c:36
#define eprintf(x, y...)
Definition: rlcc.c:7
@ RZ_ANALYSIS_OP_MASK_BASIC
Definition: rz_analysis.h:440
#define RZ_ANALYSIS_ARCHINFO_MIN_OP_SIZE
Definition: rz_analysis.h:98
#define rz_warn_if_reached()
Definition: rz_assert.h:29
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
RZ_API ut64 rz_io_fd_size(RzIO *io, int fd)
Definition: io_fd.c:42
RZ_API RzIOMap * rz_io_map_get(RzIO *io, ut64 addr)
Definition: io_map.c:176
#define RZ_LOG_ERROR(fmtstr,...)
Definition: rz_log.h:58
RZ_API ut64 rz_num_math(RzNum *num, const char *str)
Definition: unum.c:456
RZ_API PJ * pj_kb(PJ *j, const char *k, bool v)
Definition: pj.c:177
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 char * rz_str_newf(const char *fmt,...) RZ_PRINTF_CHECK(1
#define PFMT64d
Definition: rz_types.h:394
@ RZ_OUTPUT_MODE_JSON
Definition: rz_types.h:40
@ 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 st64
Definition: rz_types_base.h:10
#define UT64_MAX
Definition: rz_types_base.h:86
RZ_API bool rz_core_seek_redo(RzCore *core)
Definition: seek.c:316
RZ_API RzList * rz_core_seek_list(RzCore *core)
Return the seek history.
Definition: seek.c:411
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_and_save(RzCore *core, ut64 addr, bool rb)
Save currently marked state in seek history and seek to addr .
Definition: seek.c:101
RZ_API bool rz_core_seek_mark(RzCore *core)
Mark current state (offset+cursor) as the next state to save in history.
Definition: seek.c:57
RZ_API bool rz_core_seek_next(RzCore *core, const char *type, bool save)
Seek to the next type of item from current offset.
Definition: seek.c:203
RZ_API int rz_core_seek_base(RzCore *core, const char *hex, bool save)
Seek to a new address composed of current offset with last hex digits replaced with those of hex.
Definition: seek.c:171
RZ_API void rz_core_seek_reset(RzCore *core)
Definition: seek.c:388
RZ_API bool rz_core_seek_prev(RzCore *core, const char *type, bool save)
Seek to the previous type of item from current offset.
Definition: seek.c:241
RZ_API bool rz_core_seek_undo(RzCore *core)
Definition: seek.c:301
RZ_API bool rz_core_seek_opt(RzCore *core, ut64 addr, bool rb, bool save)
Seek to addr and optionally save the current offset in seek history.
Definition: seek.c:141
RZ_API bool rz_core_seek_align(RzCore *core, ut64 align, bool save)
Seek to current offset aligned to align.
Definition: seek.c:274
RZ_API bool rz_core_seek_save(RzCore *core)
Save last marked position, if any, in the seek history.
Definition: seek.c:87
RZ_API bool rz_core_seek_analysis_bb(RzCore *core, ut64 addr, bool save)
Seek to basic block that contains address addr.
Definition: seek.c:289
RZ_API bool rz_core_seek(RzCore *core, ut64 addr, bool rb)
Seek to addr.
Definition: seek.c:116
#define f(i)
Definition: sha256.c:46
Definition: z80asm.h:102
Definition: rz_pj.h:12
Represent the output state of a command handler.
Definition: rz_cmd.h:91
int idx
Position of the item relative to the current seek item (0 current seek, < 0 for undos,...
Definition: rz_core.h:148
ut64 offset
Value of core->offset at the given time in history.
Definition: rz_core.h:145
bool is_current
True if this is the current seek value.
Definition: rz_core.h:147
int cursor
Position of the cursor at the given time in history.
Definition: rz_core.h:146
RzSearch * search
Definition: rz_core.h:331
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
ut8 * block
Definition: rz_core.h:305
RzFlag * flags
Definition: rz_core.h:330
RzCoreFile * file
Definition: rz_core.h:314
ut32 blocksize
Definition: rz_core.h:303
RzConfig * config
Definition: rz_core.h:300
const char * calc_buf
Definition: rz_num.h:54
int errors
Definition: rz_num.h:50
RzNumCalc nc
division by zero happened
Definition: rz_num.h:67
ut64 value
Definition: rz_num.h:63
Definition: dis.h:43
Definition: dis.c:32
RZ_API bool rz_core_prevop_addr(RzCore *core, ut64 start_addr, int numinstrs, ut64 *prev_addr)
Definition: visual.c:1173
RZ_API ut64 rz_core_prevop_addr_force(RzCore *core, ut64 start_addr, int numinstrs)
Definition: visual.c:1195
static st64 delta
Definition: vmenus.c:2425
ut64(WINAPI *w32_GetEnabledXStateFeatures)()
static char * regname(int reg)
Definition: dis.c:71
static int addr
Definition: z80asm.c:58
static bool input(void *ud, zip_uint8_t *data, zip_uint64_t length)