* Add var vm.arch

* Fix vm arch setup at startup
* Fix flag set in visual mode when cursor is enabled
* Filter string names before adding flags in r_bin_load
* Fix r_flag_name_filter (do trim)
* Fix r_sys_rmkdir
* Update TODO
This commit is contained in:
Nibble 2010-10-23 14:27:13 +02:00
parent 431e626680
commit c79afe3568
8 changed files with 25 additions and 25 deletions

5
TODO
View File

@ -12,10 +12,6 @@ pancake
* fix arm assembler issue reported via twitter (umf :/)
nibble
* fix colorize of cursor selected bytes
* in Visual Debugger mode cursor mode also scrolls O_o
- cursor mode in visual breaks flags too (r2 -d ls ; Vcjjj)
- visual cursor mode and then :f jeje @ addr <- fails!
* Switch to 'arm' code analysis module :?
* mach0 armthumb bin detect
Questions
@ -120,6 +116,7 @@ Refactoring
0.7
===
* Refactor cursor stuff
* r2 -d <pid> > dh native > dp=824 > ... -- not really :) for 0.6
* Create radare2-testsuite project
- tests for ired, rax2, radare2, rabin2 ...

View File

@ -422,9 +422,10 @@ static int rabin_show_info() {
"e asm.arch=%s\n"
"e anal.plugin=%s\n"
"e asm.bits=%i\n"
"e vm.arch=%s\n"
"e asm.dwarf=%s\n",
info->rclass, info->big_endian?"true":"false", info->os,
info->arch, info->arch, info->bits,
info->arch, info->arch, info->bits, info->arch,
R_BIN_DBG_STRIPPED (info->dbg_info)?"false":"true");
} else {
eprintf ("[File info]\n");

View File

@ -1593,8 +1593,6 @@ static int cmd_flag(void *data, const char *input) {
int len = strlen (input)+1;
char *str = alloca (len);
ut64 off = core->offset;
if (core->print->cur_enabled)
off += core->print->cur;
memcpy (str, input+1, len);
switch (input[0]) {

View File

@ -230,11 +230,17 @@ static int config_asmarch_callback(void *user, void *data) {
if (!r_syscall_setup (core->syscall, node->value,
r_config_get (core->config, "asm.os")))
eprintf ("asm.arch: Cannot setup syscall os/arch for '%s'\n", node->value);
return R_TRUE;
}
static int config_vmarch_callback(void *user, void *data) {
RCore *core = (RCore *) user;
RConfigNode *node = (RConfigNode *) data;
r_vm_set_arch (core->vm, node->value, core->assembler->bits);
return R_TRUE;
}
static int config_asm_parser_callback(void *user, void *data) {
static int config_asmparser_callback(void *user, void *data) {
RCore *core = (RCore*) user;
RConfigNode *node = (RConfigNode*) data;
// XXX this is wrong? snprintf(buf, 127, "parse_%s", node->value),
@ -243,7 +249,7 @@ static int config_asm_parser_callback(void *user, void *data) {
return R_TRUE;
}
static int config_asm_bits_callback(void *user, void *data) {
static int config_asmbits_callback(void *user, void *data) {
RCore *core = (RCore *) user;
RConfigNode *node = (RConfigNode *) data;
int ret = r_asm_set_bits (core->assembler, node->i_value);
@ -283,7 +289,7 @@ R_API int r_core_config_init(RCore *core) {
// XXX: not portable
r_parse_use (core->parser, "x86.pseudo");
r_config_set_cb (cfg, "asm.parser", "x86.pseudo",
&config_asm_parser_callback);
&config_asmparser_callback);
r_config_set (cfg, "dir.plugins", LIBDIR"/radare2/");
/* anal */
@ -293,7 +299,7 @@ R_API int r_core_config_init(RCore *core) {
r_config_set_cb (cfg, "anal.plugin", "x86", &config_analplugin_callback);
/* asm */
r_config_set_i_cb (cfg, "asm.bits", 32,
&config_asm_bits_callback);
&config_asmbits_callback);
r_config_set (cfg, "asm.bytes", "true");
r_config_set (cfg, "asm.middle", "false"); // jump in the middle because of antidisasm tricks
r_config_set (cfg, "asm.comments", "true");
@ -356,6 +362,8 @@ R_API int r_core_config_init(RCore *core) {
r_config_set (cfg, "file.sha1", "");
r_config_set (cfg, "file.type", "");
r_config_set (cfg, "rap.loop", "true");
/* vm */
r_config_set_cb (cfg, "vm.arch", "x86", &config_vmarch_callback);
/* TODO cmd */
#if 0

View File

@ -65,10 +65,10 @@ R_API int r_core_bin_load(RCore *r, const char *file) {
r_config_set (r->config, "asm.dwarf", R_BIN_DBG_STRIPPED (info->dbg_info)?"false":"true");
}
r_flag_space_set (r->flags, "symbols");
// M -> Main
RBinAddr *binmain;
r_flag_space_set (r->flags, "symbols");
if ((binmain = r_bin_get_main (r->bin)) != NULL)
r_flag_set (r->flags, "main", va?baddr+binmain->rva:binmain->offset,
r->blocksize, 0);
@ -130,7 +130,7 @@ R_API int r_core_bin_load(RCore *r, const char *file) {
r_meta_add (r->meta, R_META_STRING, va?baddr+string->rva:string->offset,
(va?baddr+string->rva:string->offset)+string->size, string->string+i);
r_flag_name_filter (string->string);
snprintf (str, R_FLAG_NAME_SIZE, "str.%s", string->string+i);
snprintf (str, R_FLAG_NAME_SIZE, "str.%s", string->string);
r_flag_set (r->flags, str, va?baddr+string->rva:string->offset,
string->size, 0);
}

View File

@ -914,7 +914,7 @@ R_API int r_core_visual_cmd(RCore *core, int ch) {
break;
case ':': {
ut64 oseek = core->offset;
if (curset) r_core_seek (core, core->offset+cursor, 1);
if (curset) r_core_seek (core, core->offset+cursor, 0);
r_cons_fgets (buf, 1023, 0, NULL);
r_core_cmd (core, buf, 0);
r_cons_any_key ();

View File

@ -50,8 +50,7 @@ R_API int r_flag_name_check(const char *name) {
R_API int r_flag_name_filter(char *name) {
int i;
char *oname;
for(;*name==' ';name=name+1);
oname=name;
name = oname = r_str_trim (name);
for (i=0;*name!='\0'; name = name +1,i++) {
if (i>R_FLAG_NAME_SIZE) {
name[0] = '\0';

View File

@ -248,19 +248,16 @@ R_API int r_sys_rmkdir(const char *dir) {
// XXX: Wrong for w32 (/).. and no errno ?
while ((ptr = strchr (ptr, '/'))) {
*ptr = 0;
if (!r_sys_mkdir (path)) {
if (r_sys_mkdir_failed ()) {
eprintf ("r_sys_rmkdir: fail %s\n", dir);
free (path);
return R_FALSE;
}
if (!r_sys_mkdir (path) && r_sys_mkdir_failed ()) {
eprintf ("r_sys_rmkdir: fail %s\n", dir);
free (path);
return R_FALSE;
}
*ptr = '/';
ptr++;
}
ret = r_sys_mkdir (path);
if (r_sys_mkdir_failed ())
ret = R_TRUE;
if (!r_sys_mkdir (path) && r_sys_mkdir_failed ())
ret = R_FALSE;
free (path);
return ret;
}