Rizin
unix-like reverse engineering framework and cli tools
bp_plugin.c File Reference
#include <rz_bp.h>

Go to the source code of this file.

Functions

RZ_API int rz_bp_plugin_del (RzBreakpoint *bp, const char *name)
 
RZ_API bool rz_bp_plugin_add (RzBreakpoint *bp, RZ_BORROW RZ_NONNULL RzBreakpointPlugin *plugin)
 
RZ_API int rz_bp_use (RZ_NONNULL RzBreakpoint *bp, RZ_NONNULL const char *name)
 
RZ_API void rz_bp_plugin_list (RzBreakpoint *bp)
 

Function Documentation

◆ rz_bp_plugin_add()

RZ_API bool rz_bp_plugin_add ( RzBreakpoint bp,
RZ_BORROW RZ_NONNULL RzBreakpointPlugin plugin 
)

Definition at line 24 of file bp_plugin.c.

24  {
25  rz_return_val_if_fail(bp && plugin, false);
28  /* avoid dupped plugins */
29  rz_list_foreach (bp->bps, iter, h) {
30  if (!strcmp(h->name, plugin->name)) {
31  return false;
32  }
33  }
35  if (!dup) {
36  return false;
37  }
38  memcpy(dup, plugin, sizeof(RzBreakpointPlugin));
39  bp->nbps++;
41  return true;
42 }
memcpy(mem, inblock.get(), min(CONTAINING_RECORD(inblock.get(), MEMBLOCK, data) ->size, size))
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
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
#define rz_return_val_if_fail(expr, val)
Definition: rz_assert.h:108
#define RZ_NEW(x)
Definition: rz_types.h:285
#define h(i)
Definition: sha256.c:48
int nbps
Definition: rz_bp.h:91
RzList * plugins
Definition: rz_bp.h:87
RzList * bps
Definition: rz_bp.h:93

References rz_bp_t::bps, dup, h, memcpy(), rz_bp_t::nbps, rz_bp_t::plugins, rz_list_append(), RZ_NEW, and rz_return_val_if_fail.

Referenced by rz_bp_new().

◆ rz_bp_plugin_del()

RZ_API int rz_bp_plugin_del ( RzBreakpoint bp,
const char *  name 
)

Definition at line 6 of file bp_plugin.c.

6  {
9  if (name && *name) {
10  rz_list_foreach (bp->plugins, iter, h) {
11  if (!strcmp(h->name, name)) {
12  if (bp->cur == h) {
13  bp->cur = NULL;
14  }
16  bp->nbps--;
17  return true;
18  }
19  }
20  }
21  return false;
22 }
#define NULL
Definition: cris-opc.c:27
RZ_API void rz_list_delete(RZ_NONNULL RzList *list, RZ_NONNULL RzListIter *iter)
Removes an entry in the list by using the RzListIter pointer.
Definition: list.c:162
Definition: z80asm.h:102
RzBreakpointPlugin * cur
Definition: rz_bp.h:85

References rz_bp_t::cur, h, rz_bp_t::nbps, NULL, rz_bp_t::plugins, and rz_list_delete().

Referenced by rz_cmd_debug_remove_bp_plugin_handler().

◆ rz_bp_plugin_list()

RZ_API void rz_bp_plugin_list ( RzBreakpoint bp)

Definition at line 61 of file bp_plugin.c.

61  {
64  rz_list_foreach (bp->plugins, iter, b) {
65  bp->cb_printf("bp %c %s\n",
66  (bp->cur && !strcmp(bp->cur->name, b->name)) ? '*' : '-',
67  b->name);
68  }
69 }
#define b(i)
Definition: sha256.c:42
char * name
Definition: rz_bp.h:34
PrintfCallback cb_printf
Definition: rz_bp.h:88

References b, rz_bp_t::cb_printf, rz_bp_t::cur, rz_bp_plugin_t::name, and rz_bp_t::plugins.

Referenced by rz_cmd_debug_bp_plugin_handler().

◆ rz_bp_use()

RZ_API int rz_bp_use ( RZ_NONNULL RzBreakpoint bp,
RZ_NONNULL const char *  name 
)

Switch to the registered breakpoint plugin called name

Definition at line 47 of file bp_plugin.c.

47  {
48  rz_return_val_if_fail(bp && name, false);
51  rz_list_foreach (bp->plugins, iter, h) {
52  if (!strcmp(h->name, name)) {
53  bp->cur = h;
54  return true;
55  }
56  }
57  return false;
58 }

References h, and rz_return_val_if_fail.

Referenced by cb_asmbits(), rz_cmd_debug_bp_plugin_handler(), and rz_core_init().