Skip to content

Commit

Permalink
Use RPluginMeta in bp plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
MewtR authored and trufae committed Nov 28, 2024
1 parent cc32b30 commit 55afe17
Show file tree
Hide file tree
Showing 11 changed files with 60 additions and 16 deletions.
10 changes: 5 additions & 5 deletions libr/bp/bp_plugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ R_API int r_bp_plugin_del(RBreakpoint *bp, const char *name) {
RBreakpointPlugin *h;
if (name && *name) {
r_list_foreach (bp->plugins, iter, h) {
if (!strcmp (h->name, name)) {
if (!strcmp (h->meta.name, name)) {
if (bp->cur == h) {
bp->cur = NULL;
}
Expand All @@ -29,7 +29,7 @@ R_API int r_bp_plugin_add(RBreakpoint *bp, RBreakpointPlugin *foo) {
}
/* avoid dupped plugins */
r_list_foreach (bp->bps, iter, h) {
if (!strcmp (h->name, foo->name)) {
if (!strcmp (h->meta.name, foo->meta.name)) {
return false;
}
}
Expand All @@ -48,7 +48,7 @@ R_API int r_bp_use(RBreakpoint *bp, const char *name, int bits) {
bp->bits = bits;
RBreakpointPlugin *h;
r_list_foreach (bp->plugins, iter, h) {
if (!strcmp (h->name, name)) {
if (!strcmp (h->meta.name, name)) {
bp->cur = h;
return true;
}
Expand All @@ -62,7 +62,7 @@ R_API void r_bp_plugin_list(RBreakpoint *bp) {
RBreakpointPlugin *b;
r_list_foreach (bp->plugins, iter, b) {
bp->cb_printf ("bp %c %s\n",
(bp->cur && !strcmp (bp->cur->name, b->name))? '*': '-',
b->name);
(bp->cur && !strcmp (bp->cur->meta.name, b->meta.name))? '*': '-',
b->meta.name);
}
}
7 changes: 6 additions & 1 deletion libr/bp/p/bp_arm.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,12 @@ static RBreakpointArch r_bp_plugin_arm_bps[] = {
};

RBreakpointPlugin r_bp_plugin_arm = {
.name = "arm",
.meta = {
.name = "arm",
.desc = "",
.author = "pancake",
.license = "LGPL-3.0-only",
},
.arch = "arm",
.nbps = 10,
.bps = r_bp_plugin_arm_bps,
Expand Down
7 changes: 6 additions & 1 deletion libr/bp/p/bp_bf.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ static RBreakpointArch r_bp_plugin_bf_bps[] = {
};

RBreakpointPlugin r_bp_plugin_bf = {
.name = "bf",
.meta = {
.name = "bf",
.desc = "",
.author = "pancake",
.license = "LGPL-3.0-only",
},
.arch = "bf",
.nbps = 2,
.bps = r_bp_plugin_bf_bps,
Expand Down
7 changes: 6 additions & 1 deletion libr/bp/p/bp_mips.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ static RBreakpointArch r_bp_plugin_mips_bps[] = {
};

RBreakpointPlugin r_bp_plugin_mips = {
.name = "mips",
.meta = {
.name = "mips",
.desc = "",
.author = "pancake",
.license = "LGPL-3.0-only",
},
.arch = "mips",
.nbps = 4,
.bps = r_bp_plugin_mips_bps,
Expand Down
7 changes: 6 additions & 1 deletion libr/bp/p/bp_null.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@ static RBreakpointArch r_bp_plugin_null_bps[] = {
};

RBreakpointPlugin r_bp_plugin_null = {
.name = "null",
.meta = {
.name = "null",
.desc = "",
.author = "pancake",
.license = "LGPL-3.0-only",
},
.arch = "null",
.nbps = 0,
.bps = r_bp_plugin_null_bps,
Expand Down
7 changes: 6 additions & 1 deletion libr/bp/p/bp_ppc.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@ static RBreakpointArch r_bp_plugin_ppc_bps[] = {
};

RBreakpointPlugin r_bp_plugin_ppc = {
.name = "ppc",
.meta = {
.name = "ppc",
.desc = "",
.author = "pancake",
.license = "LGPL-3.0-only",
},
.arch = "ppc",
.nbps = 2,
.bps = r_bp_plugin_ppc_bps,
Expand Down
7 changes: 6 additions & 1 deletion libr/bp/p/bp_riscv.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ static RBreakpointArch r_bp_plugin_riscv_bps[] = {
};

RBreakpointPlugin r_bp_plugin_riscv = {
.name = "riscv",
.meta = {
.name = "riscv",
.desc = "",
.author = "pancake",
.license = "LGPL-3.0-only",
},
.arch = "riscv",
.nbps = 2,
.bps = r_bp_plugin_riscv_bps,
Expand Down
7 changes: 6 additions & 1 deletion libr/bp/p/bp_s390x.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@ static RBreakpointArch r_bp_plugin_s390x_bps[] = {
};

RBreakpointPlugin r_bp_plugin_s390x = {
.name = "s390",
.meta = {
.name = "s390",
.desc = "",
.author = "pancake",
.license = "LGPL-3.0-only",
},
.arch = "s390",
.nbps = 3,
.bps = r_bp_plugin_s390x_bps,
Expand Down
7 changes: 6 additions & 1 deletion libr/bp/p/bp_sh.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ static RBreakpointArch r_bp_plugin_sh_bps[] = {
};

RBreakpointPlugin r_bp_plugin_sh = {
.name = "sh",
.meta = {
.name = "sh",
.desc = "",
.author = "pancake",
.license = "LGPL-3.0-only",
},
.arch = "sh",
.nbps = 2,
.bps = r_bp_plugin_sh_bps,
Expand Down
7 changes: 6 additions & 1 deletion libr/bp/p/bp_x86.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ static RBreakpointArch r_bp_plugin_x86_bps[] = {
};

RBreakpointPlugin r_bp_plugin_x86 = {
.name = "x86",
.meta = {
.name = "x86",
.desc = "",
.author = "pancake",
.license = "LGPL-3.0-only",
},
.arch = "x86",
.nbps = 2,
.bps = r_bp_plugin_x86_bps,
Expand Down
3 changes: 1 addition & 2 deletions libr/include/r_bp.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ R_LIB_VERSION_HEADER(r_bp);
#define R_BP_MAXPIDS 10
#define R_BP_CONT_NORMAL 0
#define R_BP_CONT_NORMAL 0

typedef struct r_bp_arch_t {
int bits;
int length;
Expand All @@ -32,7 +31,7 @@ enum {
};

typedef struct r_bp_plugin_t {
char *name;
RPluginMeta meta;
char *arch;
int type; // R_BP_TYPE_SW
int nbps;
Expand Down

0 comments on commit 55afe17

Please sign in to comment.