Skip to content

Commit

Permalink
Better output for dL command ##debug
Browse files Browse the repository at this point in the history
  • Loading branch information
radare committed Jun 28, 2024
1 parent 13ea460 commit 4b946a7
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions libr/debug/plugin.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* radare - LGPL - Copyright 2009-2023 pancake */
/* radare - LGPL - Copyright 2009-2024 pancake */

#include <r_debug.h>
#include <config.h>
Expand All @@ -17,7 +17,7 @@ static RDebugPlugin *debug_static_plugins[] = {
};

R_API void r_debug_init_plugins(RDebug *dbg) {
r_return_if_fail (dbg);
R_RETURN_IF_FAIL (dbg);
int i;
dbg->plugins = RVecDebugPluginSession_new ();
for (i = 0; debug_static_plugins[i]; i++) {
Expand All @@ -26,7 +26,7 @@ R_API void r_debug_init_plugins(RDebug *dbg) {
}

R_API void r_debug_fini_plugins(RDebug *dbg) {
r_return_if_fail (dbg);
R_RETURN_IF_FAIL (dbg);
RVecDebugPluginSession_free (dbg->plugins);
}

Expand All @@ -35,7 +35,7 @@ static inline int find_plugin_by_name(const RDebugPluginSession *ds, const void
}

R_API bool r_debug_use(RDebug *dbg, const char *str) {
r_return_val_if_fail (dbg, false);
R_RETURN_VAL_IF_FAIL (dbg, false);
if (R_STR_ISNOTEMPTY (str)) {
RDebugPluginSession *ds = RVecDebugPluginSession_find (dbg->plugins, (void*)str, find_plugin_by_name);
if (!ds) {
Expand Down Expand Up @@ -79,9 +79,8 @@ R_API bool r_debug_use(RDebug *dbg, const char *str) {
}

R_API bool r_debug_plugin_list(RDebug *dbg, int mode) {
r_return_val_if_fail (dbg, false);
R_RETURN_VAL_IF_FAIL (dbg, false);
char spaces[16];
int count = 0;
memset (spaces, ' ', 15);
spaces[15] = 0;
PJ *pj = NULL;
Expand Down Expand Up @@ -111,12 +110,11 @@ R_API bool r_debug_plugin_list(RDebug *dbg, int mode) {
}
pj_end (pj);
} else {
dbg->cb_printf ("%d %s %s %s%s\n",
count, (ds == dbg->current)? "dbg": "---",
dbg->cb_printf ("%s %s %s%s\n",
(ds == dbg->current)? "*": "-",
meta.name, spaces, meta.license);
}
spaces[sp] = ' ';
count++;
}
if (mode == 'j') {
pj_end (pj);
Expand All @@ -126,7 +124,7 @@ R_API bool r_debug_plugin_list(RDebug *dbg, int mode) {
}

R_API bool r_debug_plugin_add(RDebug *dbg, RDebugPlugin *plugin) {
r_return_val_if_fail (dbg && plugin, false);
R_RETURN_VAL_IF_FAIL (dbg && plugin, false);
if (!plugin->meta.name) {
return false;
}
Expand All @@ -148,7 +146,7 @@ R_API bool r_debug_plugin_add(RDebug *dbg, RDebugPlugin *plugin) {
}

R_API bool r_debug_plugin_remove(RDebug *dbg, RDebugPlugin *plugin) {
r_return_val_if_fail (dbg && plugin, false);
R_RETURN_VAL_IF_FAIL (dbg && plugin, false);
RDebugPluginSession *ds = RVecDebugPluginSession_find (dbg->plugins,
(void*)plugin->meta.name, find_plugin_by_name);
if (ds) {
Expand All @@ -159,7 +157,7 @@ R_API bool r_debug_plugin_remove(RDebug *dbg, RDebugPlugin *plugin) {
}

R_API bool r_debug_plugin_set_reg_profile(RDebug *dbg, const char *profile) {
r_return_val_if_fail (dbg && profile, false);
R_RETURN_VAL_IF_FAIL (dbg && profile, false);
char *str = r_file_slurp (profile, NULL);
if (!str) {
R_LOG_ERROR ("r_debug_plugin_set_reg_profile: Cannot find '%s'", profile);
Expand Down

0 comments on commit 4b946a7

Please sign in to comment.