Debug plugin fallbacks ##debug

This commit is contained in:
pancake 2023-11-17 09:11:23 +01:00 committed by pancake
parent aa0b3e86df
commit 2e64ce0112
2 changed files with 19 additions and 4 deletions

View File

@ -1849,11 +1849,21 @@ static bool cb_dbgbackend(void *user, void *data) {
r_debug_plugin_list (core->dbg, 'q');
return false;
}
// TODO: probably not necessary
if (!strcmp (node->value, "bf")) {
// hack
r_config_set (core->config, "asm.arch", "bf");
}
r_debug_use (core->dbg, node->value);
if (r_debug_use (core->dbg, node->value)) {
RDebugPlugin *plugin = R_UNWRAP3 (core->dbg, current, plugin);
if (plugin) {
const char *name = plugin->meta.name;
r_core_cmd0 (core, "aei");
free (node->value);
node->value = strdup (name);
}
} else {
R_LOG_ERROR ("Cannot find a valid debug plugin");
}
return true;
}

View File

@ -36,9 +36,14 @@ 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);
RDebugPluginSession *ds = NULL;
if (R_STR_ISNOTEMPTY (str)) {
ds = RVecDebugPluginSession_find (dbg->plugins, (void*)str, find_plugin_by_name);
RDebugPluginSession *ds = RVecDebugPluginSession_find (dbg->plugins, (void*)str, find_plugin_by_name);
if (!ds) {
ds = RVecDebugPluginSession_find (dbg->plugins, (void*)"esil", find_plugin_by_name);
if (!ds) {
ds = RVecDebugPluginSession_find (dbg->plugins, (void*)"null", find_plugin_by_name);
}
}
if (ds) {
dbg->current = ds;
if (dbg->anal && dbg->anal->cur) {