Rizin
unix-like reverse engineering framework and cli tools
vmarks.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_core.h>
5 
7  size_t i;
8  for (i = 0; i < UT8_MAX; i++) {
9  core->marks[i] = UT64_MAX;
10  }
11  core->marks_init = true;
12 }
13 
15  size_t i;
16  if (!core->marks_init) {
17  return false;
18  }
19  bool res = false;
20  for (i = 0; i < UT8_MAX; i++) {
21  if (core->marks[i] != UT64_MAX) {
22  if (i > ASCII_MAX) {
23  rz_cons_printf("fV %zu 0x%" PFMT64x "\n", i - ASCII_MAX - 1, core->marks[i]);
24  } else {
25  rz_cons_printf("fV %c 0x%" PFMT64x "\n", (char)i, core->marks[i]);
26  }
27  res = true;
28  }
29  }
30  return res;
31 }
32 
34  if (!core->marks_init) {
36  }
37  core->marks[ch] = addr;
38 }
39 
41  if (!core->marks_init) {
42  return;
43  }
44  core->marks[ch] = UT64_MAX;
45 }
46 
48  if (IS_DIGIT(ch)) {
49  ch += ASCII_MAX + 1;
50  }
51  rz_core_visual_mark_set(core, ch, core->offset);
52 }
53 
55  if (core->marks_init && core->marks[ch] != UT64_MAX) {
56  rz_core_seek(core, core->marks[ch], true);
57  }
58 }
lzma_index ** i
Definition: index.h:629
RZ_API int rz_cons_printf(const char *format,...)
Definition: cons.c:1202
#define RZ_API
uint8_t ut8
Definition: lh5801.h:11
#define IS_DIGIT(x)
Definition: rz_str_util.h:11
#define PFMT64x
Definition: rz_types.h:393
#define ASCII_MAX
#define UT64_MAX
Definition: rz_types_base.h:86
#define UT8_MAX
RZ_API bool rz_core_seek(RzCore *core, ut64 addr, bool rb)
Seek to addr.
Definition: seek.c:116
ut64 marks[UT8_MAX+1]
Definition: rz_core.h:392
ut64 offset
Definition: rz_core.h:301
bool marks_init
Definition: rz_core.h:391
RZ_API void rz_core_visual_mark(RzCore *core, ut8 ch)
Definition: vmarks.c:47
RZ_API bool rz_core_visual_mark_dump(RzCore *core)
Definition: vmarks.c:14
RZ_API void rz_core_visual_mark_seek(RzCore *core, ut8 ch)
Definition: vmarks.c:54
RZ_API void rz_core_visual_mark_set(RzCore *core, ut8 ch, ut64 addr)
Definition: vmarks.c:33
RZ_API void rz_core_visual_mark_del(RzCore *core, ut8 ch)
Definition: vmarks.c:40
RZ_API void rz_core_visual_mark_reset(RzCore *core)
Definition: vmarks.c:6
ut64(WINAPI *w32_GetEnabledXStateFeatures)()
static int addr
Definition: z80asm.c:58