Fix anal.x86.udis86 and asm.arm.winedbg plugin names

Add file.analyze eval config variable from radare1
Guess base arch anal.plugin when asm.arch is set
This commit is contained in:
pancake 2012-08-08 10:31:17 +02:00
parent 2f82ce6a22
commit 9a1a2fc981
4 changed files with 19 additions and 8 deletions

View File

@ -1,5 +1,4 @@
/* radare - LGPL - Copyright 2009-2012 */
/* nibble<.ds@gmail.com> */
/* radare - LGPL - Copyright 2009-2012 - nibble */
#include <r_lib.h>
#include <r_types.h>
@ -176,7 +175,7 @@ static int set_reg_profile(RAnal *anal) {
}
struct r_anal_plugin_t r_anal_plugin_x86_udis86 = {
.name = "x86_udis86",
.name = "x86.udis86",
.desc = "X86 analysis plugin (udis86 backend)",
.arch = R_SYS_ARCH_X86,
.bits = 32|64,

View File

@ -1,4 +1,4 @@
/* radare - LGPL - Copyright 2009-2011 nibble<.ds@gmail.com> */
/* radare - LGPL - Copyright 2009-2012 nibble */
#include <stdio.h>
#include <stdarg.h>
@ -22,7 +22,7 @@ static int disassemble(struct r_asm_t *a, struct r_asm_op_t *op, const ut8 *buf,
}
RAsmPlugin r_asm_plugin_arm_winedbg = {
.name = "arm_winedbg",
.name = "arm.winedbg",
.arch = "arm",
.bits = (int[]){ 16, 32, 0 },
.desc = "ARM disassembly plugin (winedbg backend)",

View File

@ -134,7 +134,9 @@ static int config_analplugin_callback(void *user, void *data) {
r_anal_list (core->anal);
return R_FALSE;
} else if (!r_anal_use (core->anal, node->value)) {
eprintf ("Cannot use '%s' anal plugin.\n", node->value);
const char *aa = r_config_get (core->config, "asm.arch");
if (!aa || strcmp (aa, node->value))
eprintf ("anal.plugin: cannot find '%s'\n", node->value);
return R_FALSE;
}
return R_TRUE;
@ -351,7 +353,13 @@ static int config_asmarch_callback(void *user, void *data) {
r_egg_setup (core->egg, node->value, core->anal->bits, 0, R_SYS_OS);
if (!r_asm_use (core->assembler, node->value))
eprintf ("asm.arch: cannot find (%s)\n", node->value);
r_config_set (core->config, "anal.plugin", node->value);
if (!r_config_set (core->config, "anal.plugin", node->value)) {
char *p, *s = strdup (node->value);
p = strchr (s, '.');
if (p) *p = 0;
r_config_set (core->config, "anal.plugin", s);
free (s);
}
if (!r_syscall_setup (core->anal->syscall, node->value,
asmos, core->anal->bits)) {
//eprintf ("asm.arch: Cannot setup syscall '%s/%s' from '%s'\n",
@ -509,7 +517,7 @@ R_API int r_core_config_init(RCore *core) {
#else
r_config_set_cb (cfg, "cfg.bigendian", "true", &config_bigendian_callback);
#endif
r_config_desc (cfg, "cfg.bigendian", "Use little (false) or big (true) endiannes\n");
r_config_desc (cfg, "cfg.bigendian", "Use little (false) or big (true) endiannes");
r_config_set_cb (cfg, "cfg.debug", "false", &config_cfgdebug_callback);
r_config_desc (cfg, "cfg.debug", "set/unset the debugger mode");
r_config_set_cb (cfg, "cfg.datefmt", "%d:%m:%Y %H:%M:%S %z", &config_cfgdatefmt_callback);
@ -616,6 +624,8 @@ R_API int r_core_config_init(RCore *core) {
r_config_desc (cfg, "io.va", "If enabled virtual address layout can be used");
r_config_set_cb (cfg, "io.cache", "false", &config_iocache_callback);
r_config_desc (cfg, "io.cache", "Enable cache for io changes");
r_config_set (cfg, "file.analyze", "false");
r_config_desc (cfg, "file.analyze", "Analyze file on load. Same as r2 -c aa ..");
r_config_set (cfg, "file.path", "");
r_config_desc (cfg, "file.path", "Path of current file");
r_config_set (cfg, "file.desc", "");

View File

@ -162,6 +162,8 @@ R_API int r_core_bin_load(RCore *r, const char *file) {
ut64 offset = r_bin_get_offset (r->bin);
r_core_bin_info (r, R_CORE_BIN_ACC_ALL, R_CORE_BIN_SET, va, NULL, offset);
}
if (r_config_get_i (r->config, "file.analyze"))
r_core_cmd0 (r, "aa");
return R_TRUE;
}