Rizin
unix-like reverse engineering framework and cli tools
bp_watch.c
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: 2010-2017 pancake <pancake@nopcode.org>
2 // SPDX-FileCopyrightText: 2010-2017 rkx1209 <rkx1209dev@gmail.com>
3 // SPDX-License-Identifier: LGPL-3.0-only
4 
5 #include <rz_bp.h>
6 
8 
10  if (bp->breakpoint) {
11  bp->breakpoint(bp, b, true);
12  }
13 }
14 
17  if (addr == UT64_MAX || size < 1) {
18  return NULL;
19  }
20  if (rz_bp_get_in(bp, addr, perm)) {
21  RZ_LOG_ERROR("Breakpoint already set at this address.\n");
22  return NULL;
23  }
25  if (!b) {
26  return NULL;
27  }
28  b->addr = addr;
29  b->size = size;
30  b->enabled = true;
31  b->perm = perm;
32  b->hw = hw;
33  if (hw) {
34  rz_bp_watch_add_hw(bp, b);
35  } else {
36  RZ_LOG_ERROR("[TODO]: Software watchpoint is not implemented yet (use ESIL)\n");
37  /* TODO */
38  }
39  rz_bp_item_insert(bp, b);
40  return b;
41 }
42 
43 RZ_API void rz_bp_watch_del(void) {
44 }
#define RZ_IPI
Definition: analysis_wasm.c:11
RZ_API RzBreakpointItem * rz_bp_get_in(RzBreakpoint *bp, ut64 addr, int perm)
Definition: bp.c:139
static void rz_bp_watch_add_hw(RzBreakpoint *bp, RzBreakpointItem *b)
Definition: bp_watch.c:9
RZ_API void rz_bp_watch_del(void)
Definition: bp_watch.c:43
RZ_IPI void rz_bp_item_insert(RzBreakpoint *bp, RzBreakpointItem *b)
Definition: bp.c:189
RZ_API RZ_BORROW RzBreakpointItem * rz_bp_watch_add(RZ_NONNULL RzBreakpoint *bp, ut64 addr, int size, int hw, int perm)
Definition: bp_watch.c:15
#define RZ_API
#define NULL
Definition: cris-opc.c:27
voidpf void uLong size
Definition: ioapi.h:138
#define rz_return_val_if_fail(expr, val)
Definition: rz_assert.h:108
#define RZ_LOG_ERROR(fmtstr,...)
Definition: rz_log.h:58
#define RZ_NEW0(x)
Definition: rz_types.h:284
#define RZ_NONNULL
Definition: rz_types.h:64
#define RZ_BORROW
Definition: rz_types.h:63
#define UT64_MAX
Definition: rz_types_base.h:86
#define b(i)
Definition: sha256.c:42
Definition: rz_bp.h:78
RzBreakpointCallback breakpoint
Definition: rz_bp.h:89
ut64(WINAPI *w32_GetEnabledXStateFeatures)()
static int addr
Definition: z80asm.c:58