* Do not build asm.x86_as or asm.x86_nasm

- Deprecated as being problematic. x86.nz and x86.olly ftw
* Fix singleton crash in swig bindings
  - Requires valabind-tip
* Added 'wa*' and 'waf*' commands to show bytes instead of writing
This commit is contained in:
pancake 2011-10-09 21:54:14 +02:00
parent 42edc834d2
commit 16866fe504
8 changed files with 42 additions and 24 deletions

3
TODO
View File

@ -5,6 +5,9 @@
------8<-------------------8<--------------------8<-----------------8<----------
* Add command to assemble opcodes and files without writing
- wan? wax? wafx?
====[[ 0.8.6 ]]====
* asm.pseudo for brainfuck
* implement 'ax' to get/set xrefs (better than afl <addr>)

View File

@ -66,7 +66,7 @@ RAsmPlugin r_asm_plugin_x86_as = {
.init = NULL,
.fini = NULL,
.disassemble = NULL,
.assemble = &assemble,
.assemble = &assemble,
};
#ifndef CORELIB

View File

@ -124,8 +124,10 @@ R_API RCons *r_cons_new () {
}
R_API RCons *r_cons_free () {
if (I.buffer)
if (I.buffer) {
free (I.buffer);
I.buffer = NULL;
}
return NULL;
}

View File

@ -3022,30 +3022,40 @@ static int cmd_write(void *data, const char *input) {
}
break;
case 'a':
if (input[1]==' ') {
if (input[1]==' '||input[1]=='*') {
const char *file = input[1]=='*'? input+2: input+1;
RAsmCode *acode;
r_asm_set_pc (core->assembler, core->offset);
acode = r_asm_massemble (core->assembler, input+1);
acode = r_asm_massemble (core->assembler, file);
if (acode) {
if (r_config_get_i (core->config, "scr.prompt"))
eprintf ("Written %d bytes (%s)=wx %s\n", acode->len, input+1, acode->buf_hex);
r_core_write_at (core, core->offset, acode->buf, acode->len);
WSEEK (core, acode->len);
if (input[1]=='*') {
r_cons_printf ("wx %s\n", acode->buf_hex);
} else {
if (r_config_get_i (core->config, "scr.prompt"))
eprintf ("Written %d bytes (%s)=wx %s\n", acode->len, input+1, acode->buf_hex);
r_core_write_at (core, core->offset, acode->buf, acode->len);
WSEEK (core, acode->len);
r_core_block_read (core, 0);
}
r_asm_code_free (acode);
r_core_block_read (core, 0);
}
} else
if (input[1]=='f' && input[2]==' ') {
if (input[1]=='f' && (input[2]==' '||input[2]=='*')) {
const char *file = input[2]=='*'? input+4: input+3;
RAsmCode *acode;
r_asm_set_pc (core->assembler, core->offset);
acode = r_asm_assemble_file (core->assembler, input+3);
acode = r_asm_assemble_file (core->assembler, file);
if (acode) {
if (r_config_get_i (core->config, "scr.prompt"))
eprintf ("Written %d bytes (%s)=wx %s\n", acode->len, input+1, acode->buf_hex);
r_core_write_at (core, core->offset, acode->buf, acode->len);
WSEEK (core, acode->len);
if (input[2]=='*') {
r_cons_printf ("wx %s\n", acode->buf_hex);
} else {
if (r_config_get_i (core->config, "scr.prompt"))
eprintf ("Written %d bytes (%s)=wx %s\n", acode->len, input+1, acode->buf_hex);
r_core_write_at (core, core->offset, acode->buf, acode->len);
WSEEK (core, acode->len);
r_core_block_read (core, 0);
}
r_asm_code_free (acode);
r_core_block_read (core, 0);
} else eprintf ("Cannot assemble file\n");
} else eprintf ("Wrong argument\n");
break;

View File

@ -3,6 +3,8 @@
# fs.hfsplus
# fs.hfs
# fs.jfs
# do not build : asm.x86_as
# do not build : asm.x86_nasm
STATIC="asm.java
asm.bf
asm.arm
@ -16,9 +18,7 @@ asm.sparc
asm.ppc
asm.x86
asm.x86_olly
asm.x86_nasm
asm.x86_nz
asm.x86_as
asm.msil
anal.sh
anal.x86

View File

@ -1,4 +1,4 @@
/* radare - LGPL - Copyright 2009-2010 pancake<nopcode.org> */
/* radare - LGPL - Copyright 2009-2011 pancake<nopcode.org> */
[CCode (cheader_filename="r_cons.h", cprefix="r_cons", lower_case_cprefix="r_cons_")]
namespace Radare {
@ -6,7 +6,8 @@ namespace Radare {
[CCode (cname="struct r_cons_t", free_function="", cprefix="r_cons_")]
/* XXX: LEAK */
public class RCons {
public RCons ();
// public RCons ();
public static RCons singleton ();
static void free();
[CCode (cname="Color_RED")]

View File

@ -38,7 +38,7 @@ public class Radare.RDebug {
public bool map_dealloc (RDebug.Map map);
//public RList<RDebug.Map> map_list_new ();
//public void map_list_free (RList<RDebug.Map> maps);
public void map_list (uint64 addr);
public void map_list (uint64 addr, bool rad);
public RDebug.Map map_get(uint64 addr);
public bool map_sync ();

View File

@ -1,11 +1,13 @@
/* radare - LGPL - Copyright 2009 pancake<nopcode.org> */
/* radare - LGPL - Copyright 2009-2011 pancake<nopcode.org> */
namespace Radare {
[Compact]
[CCode (cheader_filename="r_line.h", cprefix="r_line_")]
[CCode (cname="RLine", cheader_filename="r_line.h", cprefix="r_line_")]
public class RLine {
public RLine(); //string symname);
//public RLine();
public static RLine singleton();
public static bool readline (); //int argc, char **argv);
public static void set_prompt (string promp);
public static bool hist_load (string file);
public static bool hist_add (string line);