* Remove references to r_vm

* Don't build r_vm
* Deprecate cmd 'av'
This commit is contained in:
Nibble 2011-02-23 17:27:59 +01:00
parent 9845881b25
commit f3c32e3c17
8 changed files with 6 additions and 152 deletions

View File

@ -1,6 +1,6 @@
BIN=radare2
BINDEPS=r_core r_parse r_search r_cons r_lib r_config r_diff
BINDEPS+=r_bin r_debug r_anal r_reg r_bp r_io r_cmd r_th r_vm r_fs
BINDEPS+=r_bin r_debug r_anal r_reg r_bp r_io r_cmd r_th r_fs
BINDEPS+=r_sign r_print r_lang r_asm r_syscall r_hash r_line r_socket r_flags r_util
include ../binr.mk

View File

@ -1,6 +1,6 @@
BIN=radiff2
BINDEPS=r_core r_diff r_config r_parse r_lib r_cons r_search r_anal r_reg
BINDEPS+=r_bin r_flags r_debug r_vm r_bp r_io r_cmd r_fs
BINDEPS+=r_bin r_flags r_debug r_bp r_io r_cmd r_fs
BINDEPS+=r_sign r_print r_lang r_asm r_syscall r_hash r_line r_socket r_util
include ../binr.mk

View File

@ -6,7 +6,7 @@ PFX=${DESTDIR}${PREFIX}
#PREFIX=${PFX}
# Libraries
LIBLIST=util vm socket cons line lib io lang flags bin hash config syscall cmd
LIBLIST=util socket cons line lib io lang flags bin hash config syscall cmd
LIBLIST+=reg asm anal print parse search diff bp sign th db crypto debug fs core
# sysproxy ... common wat du?
@ -52,7 +52,7 @@ endif
# XXX needs autodetection of deps to remake and so..
.objs:
cd vm ; sh ../waitfordeps.sh r_`echo ${LIBLIST}|sed -e 's, , r_,g'`
sh ../waitfordeps.sh r_`echo ${LIBLIST}|sed -e 's, , r_,g'`
mkdir -p .objs
-for a in ${LIBLIST} ; do \
(cd .objs && ar x ../$$a/libr_$$a.a) ; \

View File

@ -2,7 +2,7 @@ NAME=r_core
DEPS=r_config r_cons r_line r_io r_cmd r_util r_print r_flags r_asm r_lib
DEPS+=r_debug r_hash r_bin r_lang r_io r_anal r_parse r_print r_bp
DEPS+=r_reg r_search r_syscall r_sign r_diff r_vm r_socket r_fs
DEPS+=r_reg r_search r_syscall r_sign r_diff r_socket r_fs
OBJ=core.o cmd.o file.o config.o visual.o io.o yank.o libs.o anal.o project.o gdiff.o asm.o rtr.o

View File

@ -126,7 +126,6 @@ static void r_print_disasm(RPrint *p, RCore *core, ut64 addr, ut8 *buf, int len,
nb = nbytes*2;
core->inc = 0;
r_vm_reset (core->vm);
if (core->print->cur_enabled) {
if (core->print->cur<0)
core->print->cur = 0;
@ -433,10 +432,8 @@ r_cons_printf ("%s ", pre);
int os = core->assembler->syntax;
r_asm_set_syntax (core->assembler, R_ASM_SYNTAX_INTEL);
ret = r_asm_disassemble (core->assembler, &ao, buf+idx, len-idx);
if (ret>0)
r_vm_op_eval (core->vm, ao.buf_asm);
r_asm_set_syntax (core->assembler, os);
} else r_vm_op_eval (core->vm, asmop.buf_asm);
}
if (!r_anal_cc_update (core->anal, &cc, &analop)) {
if (show_functions) {
@ -2105,47 +2102,6 @@ static int var_cmd(RCore *core, const char *str) {
}
#endif
#if 0
-- function boundaries are used to limit variables life-cycle --
// global vars are handled as flags??
// "CV 0x8049200 x global_counter
// local vars
// types: glar: g=global, l=local, a=arg, r=argreg
Cv l d i @ 0x8048200
/* using code analysis we can identify local var accesses */
f.ex:
; Set var0
0x4a13c014, mov [ebp-0x34], eax
; set name for variable accessed.
Cvn counter @ 0x4a13c014
stack frame {
var1 { offset, size, type, name }
var2 { offset, size, type, name }
}
// how to track a variable
#endif
// dir=0: import, dir=1: export
static void vmimport(RCore *core, int dir) {
struct list_head *pos;
list_for_each(pos, &core->vm->regs) {
RVmReg *r = list_entry(pos, RVmReg, list);
if (dir) {
r_cons_printf ("ave %s=0x%"PFMT64x"\n", r->name, r->value);
r_cons_printf ("f vm.%s=0x%"PFMT64x"\n", r->name, r->value);
} else {
//ut64 value = r_num_math (core->num, r->name);
ut64 value = r_debug_reg_get (core->dbg, r->name);
r_cons_printf ("ave %s=0x%"PFMT64x"\n", r->name, value);
}
}
}
static int cmd_anal(void *data, const char *input) {
const char *ptr;
RCore *core = (RCore *)data;
@ -2486,86 +2442,6 @@ static int cmd_anal(void *data, const char *input) {
break;
}
break;
case 'v':
switch(input[1]) {
case 'e':
if (input[2]=='\0')
r_cons_printf ("Usage: \"ave [expression]\n"
"Note: The prefix '\"' quotes the command and does not parses pipes and so\n");
else r_vm_eval (core->vm, input+2);
break;
case 'f':
if (input[2]=='\0')
r_cons_printf ("Usage: avf [file]\n");
else r_vm_eval_file(core->vm, input+2);
break;
case 'r':
if (input[2]=='?')
r_cons_printf (
"Usage: avr [reg|type]\n"
" avr+ eax int32 ; add register\n"
" avr- eax ; remove register\n"
" \"avra al al=eax&0xff al=al&0xff,eax=eax>16,eax=eax<16,eax=eax|al\n"
" ; set register alias\n"
" avr eax ; view register\n"
" avr eax=33 ; set register value\n"
" avr* ; show registers as in flags\n"
" avrt ; list valid register types\n"
"Note: The prefix '\"' quotes the command and does not parses pipes and so\n");
else r_vm_cmd_reg (core->vm, input+2);
break;
case 'I':
vmimport (core, 1);
break;
case 'i':
vmimport (core, 0);
break;
case '-':
r_vm_init (core->vm, 1);
break;
case 'o':
if (input[2]=='\0')
r_vm_op_list (core->vm);
else if (input[2]=='?')
r_vm_cmd_op_help ();
else r_vm_cmd_op (core->vm, input+2);
break;
case '\0':
case '?':
r_cons_printf("Usage: av[ier] [arg]\n"
" ave eax=33 ; evaluate expression in vm\n"
" avf file ; evaluate expressions from file\n"
" avi ; import register values from flags (eax, ..)\n"
" avI ; import register values from vm flags (vm.eax, ..)\n"
" avm ; select MMU (default current one)\n"
" avo op expr ; define new opcode (avo? for help)\n"
" avr ; show registers\n"
" avx N ; execute N instructions from cur seek\n"
" av- ; restart vm using asm.arch\n"
" av* ; show registers as in flags\n"
" avr eax ; show register eax\n"
" avrr eax ; set return register\n" // TODO .merge avrr and avrc
" avrc eip esp ebp ; set basic cpu registers PC, SP, BP\n"
" avra ; show register aliases\n"
" avra al eax=0xff ; define 'get' alias for register 'al'\n"
" avrt ; list valid register types\n"
" e vm.realio ; if true enables real write changes\n"
"Note: The prefix '\"' quotes the command and does not parses pipes and so\n");
break;
case 'm':
eprintf("TODO\n");
break;
case 'x':
r_vm_emulate (core->vm, atoi (input+2));
break;
case '*':
r_vm_print(core->vm, -2);
break;
default:
r_vm_print(core->vm, 0);
break;
}
break;
case 'r':
switch(input[1]) {
case '?':

View File

@ -1,7 +1,6 @@
/* radare - LGPL - Copyright 2009-2011 pancake<nopcode.org> */
#include <r_core.h>
#define HAVE_VM 0
static int config_scrcols_callback(void *user, void *data) {
int c = R_MIN (128, R_MAX (((RConfigNode*)data)->i_value, 0));
@ -256,15 +255,6 @@ static int config_asmarch_callback(void *user, void *data) {
return R_TRUE;
}
#if HAVE_VM
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;
}
#endif
static int config_asmparser_callback(void *user, void *data) {
RCore *core = (RCore*) user;
RConfigNode *node = (RConfigNode*) data;
@ -290,10 +280,6 @@ static int config_asmbits_callback(void *user, void *data) {
}
if (!r_anal_set_bits (core->anal, node->i_value))
eprintf ("asm.arch: Cannot setup '%i' bits analysis engine\n", (int)node->i_value);
#if HAVE_VM
if (core->assembler->cur)
r_vm_set_arch (core->vm, core->assembler->cur->name, node->i_value);
#endif
// TODO: change debugger backend bit profile here
return ret;
}
@ -392,10 +378,6 @@ 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 */
#if HAVE_VM
r_config_set_cb (cfg, "vm.arch", "x86", &config_vmarch_callback);
#endif
/* zoom */
r_config_set_i (cfg, "zoom.from", 0);
r_config_set_i (cfg, "zoom.to", 0);

View File

@ -273,7 +273,6 @@ R_API int r_core_init(RCore *core) {
r_line_hist_load (".radare2_history");
singleton = R_FALSE;
}
core->vm = r_vm_new ();
core->print = r_print_new ();
core->print->printf = (void *)r_cons_printf;
core->lang = r_lang_new ();
@ -321,7 +320,6 @@ R_API int r_core_init(RCore *core) {
core->dbg->printf = r_cons_printf;
core->dbg->bp->printf = r_cons_printf;
r_debug_io_bind (core->dbg, core->io);
r_io_bind (core->io, &(core->vm->iob));
r_core_config_init (core);
// XXX fix path here

View File

@ -10,7 +10,6 @@
#include "r_parse.h"
#include "r_anal.h"
#include "r_cmd.h"
#include "r_vm.h"
#include "r_meta.h"
#include "r_cons.h"
#include "r_line.h"
@ -101,7 +100,6 @@ typedef struct r_core_t {
RConfig *config;
RSearch *search;
RSign *sign;
RVm *vm;
RFS *fs;
char *cmdqueue;
ut64 inc;