mirror of
https://github.com/radareorg/radare2.git
synced 2024-11-27 23:20:40 +00:00
Rename core.assembler to core.rasm (#16814)
This commit is contained in:
parent
7326cb8efa
commit
f8a9011924
@ -139,7 +139,7 @@ static bool objc_find_refs(RCore *core) {
|
||||
const int objc2ClassMethImpOffs = 0x10;
|
||||
|
||||
objc.core = core;
|
||||
objc.word_size = (core->assembler->bits == 64)? 8: 4;
|
||||
objc.word_size = (core->rasm->bits == 64)? 8: 4;
|
||||
|
||||
RList *sections = r_bin_get_sections (core->bin);
|
||||
if (!sections) {
|
||||
|
@ -1006,9 +1006,9 @@ R_API RAnalOp* r_core_anal_op(RCore *core, ut64 addr, int mask) {
|
||||
if (core->anal->verbose) {
|
||||
eprintf ("WARNING: Implement RAnalOp.MASK_DISASM for current anal.arch. Using the sluggish RAsmOp fallback for now.\n");
|
||||
}
|
||||
r_asm_set_pc (core->assembler, addr);
|
||||
r_asm_set_pc (core->rasm, addr);
|
||||
r_asm_op_init (&asmop);
|
||||
if (r_asm_disassemble (core->assembler, &asmop, ptr, len) > 0) {
|
||||
if (r_asm_disassemble (core->rasm, &asmop, ptr, len) > 0) {
|
||||
op->mnemonic = strdup (r_strbuf_get (&asmop.buf_asm));
|
||||
}
|
||||
r_asm_op_fini (&asmop);
|
||||
@ -3692,9 +3692,9 @@ R_API int r_core_anal_search(RCore *core, ut64 from, ut64 to, ut64 ref, int mode
|
||||
ut64 at;
|
||||
char bckwrds, do_bckwrd_srch;
|
||||
int arch = -1;
|
||||
if (core->assembler->bits == 64) {
|
||||
if (core->rasm->bits == 64) {
|
||||
// speedup search
|
||||
if (!strncmp (core->assembler->cur->name, "arm", 3)) {
|
||||
if (!strncmp (core->rasm->cur->name, "arm", 3)) {
|
||||
arch = R2_ARCH_ARM64;
|
||||
}
|
||||
}
|
||||
@ -4139,7 +4139,7 @@ R_API int r_core_anal_data(RCore *core, ut64 addr, int count, int depth, int wor
|
||||
ut64 dstaddr = 0LL;
|
||||
ut8 *buf = core->block;
|
||||
int len = core->blocksize;
|
||||
int word = wordsize ? wordsize: core->assembler->bits / 8;
|
||||
int word = wordsize ? wordsize: core->rasm->bits / 8;
|
||||
char *str;
|
||||
int i, j;
|
||||
|
||||
@ -4693,7 +4693,7 @@ static int esilbreak_reg_write(RAnalEsil *esil, const char *name, ut64 *val) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (core->assembler->bits == 32 && strstr (core->assembler->cur->name, "arm")) {
|
||||
if (core->rasm->bits == 32 && strstr (core->rasm->cur->name, "arm")) {
|
||||
if ((!(at & 1)) && r_io_is_valid_offset (anal->iob.io, at, 0)) { // !core->anal->opt.noncode)) {
|
||||
add_string_ref (anal->coreb.core, esil->address, at);
|
||||
}
|
||||
@ -4747,7 +4747,7 @@ static void getpcfromstack(RCore *core, RAnalEsil *esil) {
|
||||
goto err_anal_op;
|
||||
}
|
||||
|
||||
r_asm_set_pc (core->assembler, cur);
|
||||
r_asm_set_pc (core->rasm, cur);
|
||||
esilstr = R_STRBUF_SAFEGET (&op.esil);
|
||||
if (!esilstr) {
|
||||
goto err_anal_op;
|
||||
@ -4785,7 +4785,7 @@ static void getpcfromstack(RCore *core, RAnalEsil *esil) {
|
||||
(op.type != R_ANAL_OP_TYPE_RET && op.type != R_ANAL_OP_TYPE_CRET)) {
|
||||
goto err_anal_op;
|
||||
}
|
||||
r_asm_set_pc (core->assembler, cur);
|
||||
r_asm_set_pc (core->rasm, cur);
|
||||
|
||||
esilstr = R_STRBUF_SAFEGET (&op.esil);
|
||||
r_anal_esil_set_pc (&esil_cpy, cur);
|
||||
@ -4967,7 +4967,7 @@ repeat:
|
||||
}
|
||||
|
||||
r_anal_op_fini (&op);
|
||||
r_asm_set_pc (core->assembler, cur);
|
||||
r_asm_set_pc (core->rasm, cur);
|
||||
if (!r_anal_op (core->anal, &op, cur, buf + i, iend - i, R_ANAL_OP_MASK_ESIL | R_ANAL_OP_MASK_VAL | R_ANAL_OP_MASK_HINT)) {
|
||||
i += minopsize - 1; // XXX dupe in op.size below
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ R_API void r_core_asm_hit_free(void *_hit) {
|
||||
R_API char* r_core_asm_search(RCore *core, const char *input) {
|
||||
RAsmCode *acode;
|
||||
char *ret;
|
||||
if (!(acode = r_asm_massemble (core->assembler, input))) {
|
||||
if (!(acode = r_asm_massemble (core->rasm, input))) {
|
||||
return NULL;
|
||||
}
|
||||
ret = r_asm_code_get_hex (acode);
|
||||
@ -135,7 +135,7 @@ R_API RList *r_core_asm_strsearch(RCore *core, const char *input, ut64 from, ut6
|
||||
if (addr >= to) {
|
||||
break;
|
||||
}
|
||||
r_asm_set_pc (core->assembler, addr);
|
||||
r_asm_set_pc (core->rasm, addr);
|
||||
if (mode == 'i') {
|
||||
RAnalOp analop = {0};
|
||||
ut64 len = R_MIN (15, core->blocksize - idx);
|
||||
@ -165,7 +165,7 @@ R_API RList *r_core_asm_strsearch(RCore *core, const char *input, ut64 from, ut6
|
||||
r_core_asm_hit_free (hit);
|
||||
goto beach;
|
||||
}
|
||||
r_asm_disassemble (core->assembler, &op, buf + addrbytes * idx,
|
||||
r_asm_disassemble (core->rasm, &op, buf + addrbytes * idx,
|
||||
core->blocksize - addrbytes * idx);
|
||||
hit->code = r_str_newf (r_strbuf_get (&op.buf_asm));
|
||||
idx = (matchcount)? tidx + 1: idx + 1;
|
||||
@ -187,7 +187,7 @@ R_API RList *r_core_asm_strsearch(RCore *core, const char *input, ut64 from, ut6
|
||||
r_anal_op_fini (&analop);
|
||||
} else {
|
||||
if (!(len = r_asm_disassemble (
|
||||
core->assembler, &op,
|
||||
core->rasm, &op,
|
||||
buf + addrbytes * idx,
|
||||
core->blocksize - addrbytes * idx))) {
|
||||
idx = (matchcount)? tidx + 1: idx + 1;
|
||||
@ -267,7 +267,7 @@ R_API RList *r_core_asm_strsearch(RCore *core, const char *input, ut64 from, ut6
|
||||
}
|
||||
}
|
||||
r_cons_break_pop ();
|
||||
r_asm_set_pc (core->assembler, toff);
|
||||
r_asm_set_pc (core->rasm, toff);
|
||||
beach:
|
||||
free (buf);
|
||||
free (ptr);
|
||||
@ -363,11 +363,11 @@ static int handle_forward_disassemble(RCore* core, RList *hits, ut8* buf, ut64 l
|
||||
return end_addr;
|
||||
}
|
||||
|
||||
r_asm_set_pc (core->assembler, current_instr_addr);
|
||||
r_asm_set_pc (core->rasm, current_instr_addr);
|
||||
while (tmp_current_buf_pos < len && temp_instr_addr < end_addr) {
|
||||
temp_instr_len = len - tmp_current_buf_pos;
|
||||
IFDBG eprintf("Current position: %"PFMT64d" instr_addr: 0x%"PFMT64x"\n", tmp_current_buf_pos, temp_instr_addr);
|
||||
temp_instr_len = r_asm_disassemble (core->assembler, &op, buf+tmp_current_buf_pos, temp_instr_len);
|
||||
temp_instr_len = r_asm_disassemble (core->rasm, &op, buf+tmp_current_buf_pos, temp_instr_len);
|
||||
|
||||
if (temp_instr_len == 0){
|
||||
is_valid = false;
|
||||
@ -512,7 +512,7 @@ R_API RList *r_core_asm_bwdisassemble(RCore *core, ut64 addr, int n, int len) {
|
||||
if (r_cons_is_breaked ()) {
|
||||
break;
|
||||
}
|
||||
c = r_asm_mdisassemble (core->assembler, buf + len - idx, idx);
|
||||
c = r_asm_mdisassemble (core->rasm, buf + len - idx, idx);
|
||||
if (strstr (c->assembly, "invalid") || strstr (c->assembly, ".byte")) {
|
||||
r_asm_code_free(c);
|
||||
continue;
|
||||
@ -530,9 +530,9 @@ R_API RList *r_core_asm_bwdisassemble(RCore *core, ut64 addr, int n, int len) {
|
||||
}
|
||||
}
|
||||
at = addr - idx / addrbytes;
|
||||
r_asm_set_pc (core->assembler, at);
|
||||
r_asm_set_pc (core->rasm, at);
|
||||
for (hit_count = 0; hit_count < n; hit_count++) {
|
||||
int instrlen = r_asm_disassemble (core->assembler, &op,
|
||||
int instrlen = r_asm_disassemble (core->rasm, &op,
|
||||
buf + len - addrbytes * (addr - at), addrbytes * (addr - at));
|
||||
add_hit_to_hits (hits, at, instrlen, true);
|
||||
at += instrlen;
|
||||
@ -579,10 +579,10 @@ static RList * r_core_asm_back_disassemble_all(RCore *core, ut64 addr, ut64 len,
|
||||
break;
|
||||
}
|
||||
// reset assembler
|
||||
r_asm_set_pc (core->assembler, current_instr_addr);
|
||||
r_asm_set_pc (core->rasm, current_instr_addr);
|
||||
current_instr_len = len - current_buf_pos + extra_padding;
|
||||
IFDBG eprintf("current_buf_pos: 0x%"PFMT64x", current_instr_len: %d\n", current_buf_pos, current_instr_len);
|
||||
current_instr_len = r_asm_disassemble (core->assembler, &op, buf+current_buf_pos, current_instr_len);
|
||||
current_instr_len = r_asm_disassemble (core->rasm, &op, buf+current_buf_pos, current_instr_len);
|
||||
hit = r_core_asm_hit_new ();
|
||||
hit->addr = current_instr_addr;
|
||||
hit->len = current_instr_len;
|
||||
@ -659,9 +659,9 @@ static RList *r_core_asm_back_disassemble (RCore *core, ut64 addr, int len, ut64
|
||||
break;
|
||||
}
|
||||
// reset assembler
|
||||
r_asm_set_pc (core->assembler, current_instr_addr);
|
||||
r_asm_set_pc (core->rasm, current_instr_addr);
|
||||
current_instr_len = next_buf_pos - current_buf_pos;
|
||||
current_instr_len = r_asm_disassemble (core->assembler, &op, buf+current_buf_pos, current_instr_len);
|
||||
current_instr_len = r_asm_disassemble (core->rasm, &op, buf+current_buf_pos, current_instr_len);
|
||||
IFDBG {
|
||||
ut32 byte_cnt = current_instr_len ? current_instr_len : 1;
|
||||
eprintf("current_instr_addr: 0x%"PFMT64x", current_buf_pos: 0x%"PFMT64x", current_instr_len: %d \n", current_instr_addr, current_buf_pos, current_instr_len);
|
||||
@ -741,7 +741,7 @@ static RList *r_core_asm_back_disassemble (RCore *core, ut64 addr, int len, ut64
|
||||
}
|
||||
} while (((int) current_buf_pos >= 0) && (int)(len - current_buf_pos) >= 0);
|
||||
|
||||
r_asm_set_pc (core->assembler, addr);
|
||||
r_asm_set_pc (core->rasm, addr);
|
||||
free (buf);
|
||||
return hits;
|
||||
}
|
||||
|
@ -204,7 +204,7 @@ R_API int r_core_bin_set_env(RCore *r, RBinFile *binfile) {
|
||||
} else {
|
||||
r_config_set (r->config, "anal.cpu", arch);
|
||||
}
|
||||
r_asm_use (r->assembler, arch);
|
||||
r_asm_use (r->rasm, arch);
|
||||
r_core_bin_info (r, R_CORE_BIN_ACC_ALL, R_MODE_SET, va, NULL, NULL);
|
||||
r_core_bin_set_cur (r, binfile);
|
||||
return true;
|
||||
@ -547,7 +547,7 @@ static void sdb_concat_by_path(Sdb *s, const char *path) {
|
||||
R_API void r_core_anal_type_init(RCore *core) {
|
||||
r_return_if_fail (core && core->anal);
|
||||
const char *dir_prefix = r_config_get (core->config, "dir.prefix");
|
||||
int bits = core->assembler->bits;
|
||||
int bits = core->rasm->bits;
|
||||
Sdb *types = core->anal->sdb_types;
|
||||
// make sure they are empty this is initializing
|
||||
sdb_reset (types);
|
||||
@ -4170,7 +4170,7 @@ R_API int r_core_bin_set_arch_bits(RCore *r, const char *name, const char * arch
|
||||
name = desc->name;
|
||||
}
|
||||
/* Check if the arch name is a valid name */
|
||||
if (!r_asm_is_valid (r->assembler, arch)) {
|
||||
if (!r_asm_is_valid (r->rasm, arch)) {
|
||||
return false;
|
||||
}
|
||||
/* Find a file with the requested name/arch/bits */
|
||||
@ -4197,10 +4197,10 @@ R_API int r_core_bin_update_arch_bits(RCore *r) {
|
||||
if (!r) {
|
||||
return 0;
|
||||
}
|
||||
if (r->assembler) {
|
||||
bits = r->assembler->bits;
|
||||
if (r->assembler->cur) {
|
||||
arch = r->assembler->cur->arch;
|
||||
if (r->rasm) {
|
||||
bits = r->rasm->bits;
|
||||
if (r->rasm->cur) {
|
||||
arch = r->rasm->cur->arch;
|
||||
}
|
||||
}
|
||||
binfile = r_bin_cur (r->bin);
|
||||
|
@ -118,7 +118,7 @@ static const char *has_esil(RCore *core, const char *name) {
|
||||
static void rasm2_list(RCore *core, const char *arch, int fmt) {
|
||||
int i;
|
||||
const char *feat2, *feat;
|
||||
RAsm *a = core->assembler;
|
||||
RAsm *a = core->rasm;
|
||||
char bits[32];
|
||||
RAsmPlugin *h;
|
||||
RListIter *iter;
|
||||
@ -450,7 +450,7 @@ static bool cb_scrrainbow(void *user, void *data) {
|
||||
static bool cb_asmpseudo (void *user, void *data) {
|
||||
RCore *core = (RCore *) user;
|
||||
RConfigNode *node = (RConfigNode *) data;
|
||||
core->assembler->pseudo = node->i_value;
|
||||
core->rasm->pseudo = node->i_value;
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -469,12 +469,12 @@ static bool cb_asmsecsub(void *user, void *data) {
|
||||
static bool cb_asmassembler(void *user, void *data) {
|
||||
RCore *core = (RCore *) user;
|
||||
RConfigNode *node = (RConfigNode *) data;
|
||||
r_asm_use_assembler (core->assembler, node->value);
|
||||
r_asm_use_assembler (core->rasm, node->value);
|
||||
return true;
|
||||
}
|
||||
|
||||
static void update_cmdpdc_options(RCore *core, RConfigNode *node) {
|
||||
r_return_if_fail (core && core->assembler && node);
|
||||
r_return_if_fail (core && core->rasm && node);
|
||||
RListIter *iter;
|
||||
r_list_purge (node->options);
|
||||
char *opts = r_core_cmd_str (core, "e cmd.pdc=?");
|
||||
@ -491,13 +491,13 @@ static void update_cmdpdc_options(RCore *core, RConfigNode *node) {
|
||||
static void update_asmcpu_options(RCore *core, RConfigNode *node) {
|
||||
RAsmPlugin *h;
|
||||
RListIter *iter;
|
||||
r_return_if_fail (core && core->assembler);
|
||||
r_return_if_fail (core && core->rasm);
|
||||
const char *arch = r_config_get (core->config, "asm.arch");
|
||||
if (!arch || !*arch) {
|
||||
return;
|
||||
}
|
||||
r_list_purge (node->options);
|
||||
r_list_foreach (core->assembler->plugins, iter, h) {
|
||||
r_list_foreach (core->rasm->plugins, iter, h) {
|
||||
if (h->cpus && !strcmp (arch, h->name)) {
|
||||
char *c = strdup (h->cpus);
|
||||
int i, n = r_str_split (c, ',');
|
||||
@ -521,7 +521,7 @@ static bool cb_asmcpu(void *user, void *data) {
|
||||
rasm2_list (core, r_config_get (core->config, "asm.arch"), node->value[1]);
|
||||
return 0;
|
||||
}
|
||||
r_asm_set_cpu (core->assembler, node->value);
|
||||
r_asm_set_cpu (core->rasm, node->value);
|
||||
r_config_set (core->config, "anal.cpu", node->value);
|
||||
return true;
|
||||
}
|
||||
@ -529,9 +529,9 @@ static bool cb_asmcpu(void *user, void *data) {
|
||||
static void update_asmarch_options(RCore *core, RConfigNode *node) {
|
||||
RAsmPlugin *h;
|
||||
RListIter *iter;
|
||||
if (core && node && core->assembler) {
|
||||
if (core && node && core->rasm) {
|
||||
r_list_purge (node->options);
|
||||
r_list_foreach (core->assembler->plugins, iter, h) {
|
||||
r_list_foreach (core->rasm->plugins, iter, h) {
|
||||
SETOPTIONS (node, h->name, NULL);
|
||||
}
|
||||
}
|
||||
@ -543,7 +543,7 @@ static bool cb_asmarch(void *user, void *data) {
|
||||
RConfigNode *node = (RConfigNode *) data;
|
||||
const char *asmos = NULL;
|
||||
int bits = R_SYS_BITS;
|
||||
if (!*node->value || !core || !core->assembler) {
|
||||
if (!*node->value || !core || !core->rasm) {
|
||||
return false;
|
||||
}
|
||||
asmos = r_config_get (core->config, "asm.os");
|
||||
@ -563,15 +563,15 @@ static bool cb_asmarch(void *user, void *data) {
|
||||
}
|
||||
r_egg_setup (core->egg, node->value, bits, 0, R_SYS_OS);
|
||||
|
||||
if (!r_asm_use (core->assembler, node->value)) {
|
||||
if (!r_asm_use (core->rasm, node->value)) {
|
||||
eprintf ("asm.arch: cannot find (%s)\n", node->value);
|
||||
return false;
|
||||
}
|
||||
//we should strdup here otherwise will crash if any r_config_set
|
||||
//free the old value
|
||||
char *asm_cpu = strdup (r_config_get (core->config, "asm.cpu"));
|
||||
if (core->assembler->cur) {
|
||||
const char *newAsmCPU = core->assembler->cur->cpus;
|
||||
if (core->rasm->cur) {
|
||||
const char *newAsmCPU = core->rasm->cur->cpus;
|
||||
if (newAsmCPU) {
|
||||
if (*newAsmCPU) {
|
||||
char *nac = strdup (newAsmCPU);
|
||||
@ -587,7 +587,7 @@ static bool cb_asmarch(void *user, void *data) {
|
||||
r_config_set (core->config, "asm.cpu", "");
|
||||
}
|
||||
}
|
||||
bits = core->assembler->cur->bits;
|
||||
bits = core->rasm->cur->bits;
|
||||
if (8 & bits) {
|
||||
bits = 8;
|
||||
} else if (16 & bits) {
|
||||
@ -600,8 +600,8 @@ static bool cb_asmarch(void *user, void *data) {
|
||||
}
|
||||
snprintf (asmparser, sizeof (asmparser), "%s.pseudo", node->value);
|
||||
r_config_set (core->config, "asm.parser", asmparser);
|
||||
if (core->assembler->cur && core->anal &&
|
||||
!(core->assembler->cur->bits & core->anal->bits)) {
|
||||
if (core->rasm->cur && core->anal &&
|
||||
!(core->rasm->cur->bits & core->anal->bits)) {
|
||||
r_config_set_i (core->config, "asm.bits", bits);
|
||||
}
|
||||
|
||||
@ -631,7 +631,7 @@ static bool cb_asmarch(void *user, void *data) {
|
||||
}
|
||||
//if (!strcmp (node->value, "bf"))
|
||||
// r_config_set (core->config, "dbg.backend", "bf");
|
||||
__setsegoff (core->config, node->value, core->assembler->bits);
|
||||
__setsegoff (core->config, node->value, core->rasm->bits);
|
||||
|
||||
// set a default endianness
|
||||
int bigbin = r_bin_is_big_endian (core->bin);
|
||||
@ -640,11 +640,11 @@ static bool cb_asmarch(void *user, void *data) {
|
||||
}
|
||||
|
||||
// try to set endian of RAsm to match binary
|
||||
r_asm_set_big_endian (core->assembler, bigbin);
|
||||
r_asm_set_big_endian (core->rasm, bigbin);
|
||||
// set endian of display to match binary
|
||||
core->print->big_endian = bigbin;
|
||||
|
||||
r_asm_set_cpu (core->assembler, asm_cpu);
|
||||
r_asm_set_cpu (core->rasm, asm_cpu);
|
||||
free (asm_cpu);
|
||||
RConfigNode *asmcpu = r_config_node_get (core->config, "asm.cpu");
|
||||
if (asmcpu) {
|
||||
@ -696,15 +696,15 @@ static bool cb_asmbits(void *user, void *data) {
|
||||
int bits = node->i_value;
|
||||
#if 0
|
||||
// TODO: pretty good optimization, but breaks many tests when arch is different i think
|
||||
if (bits == core->assembler->bits && bits == core->anal->bits && bits == core->dbg->bits) {
|
||||
if (bits == core->rasm->bits && bits == core->anal->bits && bits == core->dbg->bits) {
|
||||
// early optimization
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
if (bits > 0) {
|
||||
ret = r_asm_set_bits (core->assembler, bits);
|
||||
ret = r_asm_set_bits (core->rasm, bits);
|
||||
if (!ret) {
|
||||
RAsmPlugin *h = core->assembler->cur;
|
||||
RAsmPlugin *h = core->rasm->cur;
|
||||
if (!h) {
|
||||
eprintf ("e asm.bits: Cannot set value, no plugins defined yet\n");
|
||||
ret = true;
|
||||
@ -762,9 +762,9 @@ static bool cb_asmbits(void *user, void *data) {
|
||||
static void update_asmfeatures_options(RCore *core, RConfigNode *node) {
|
||||
int i, argc;
|
||||
|
||||
if (core && core->assembler && core->assembler->cur) {
|
||||
if (core->assembler->cur->features) {
|
||||
char *features = strdup (core->assembler->cur->features);
|
||||
if (core && core->rasm && core->rasm->cur) {
|
||||
if (core->rasm->cur->features) {
|
||||
char *features = strdup (core->rasm->cur->features);
|
||||
argc = r_str_split (features, ',');
|
||||
for (i = 0; i < argc; i++) {
|
||||
node->options->free = free;
|
||||
@ -793,9 +793,9 @@ static bool cb_asmfeatures(void *user, void *data) {
|
||||
print_node_options (node);
|
||||
return 0;
|
||||
}
|
||||
R_FREE (core->assembler->features);
|
||||
R_FREE (core->rasm->features);
|
||||
if (node->value[0]) {
|
||||
core->assembler->features = strdup (node->value);
|
||||
core->rasm->features = strdup (node->value);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
@ -835,14 +835,14 @@ static bool cb_emuskip(void *user, void *data) {
|
||||
static bool cb_asm_armimm(void *user, void *data) {
|
||||
RCore *core = (RCore *) user;
|
||||
RConfigNode *node = (RConfigNode *) data;
|
||||
core->assembler->immdisp = node->i_value ? true : false;
|
||||
core->rasm->immdisp = node->i_value ? true : false;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool cb_asm_invhex(void *user, void *data) {
|
||||
RCore *core = (RCore *) user;
|
||||
RConfigNode *node = (RConfigNode *) data;
|
||||
core->assembler->invhex = node->i_value;
|
||||
core->rasm->invhex = node->i_value;
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -853,7 +853,7 @@ static bool cb_asm_pcalign(void *user, void *data) {
|
||||
if (align < 0) {
|
||||
align = 0;
|
||||
}
|
||||
core->assembler->pcalign = align;
|
||||
core->rasm->pcalign = align;
|
||||
core->anal->pcalign = align;
|
||||
return true;
|
||||
}
|
||||
@ -1056,7 +1056,7 @@ static bool cb_asmsyntax(void *user, void *data) {
|
||||
if (syntax == -1) {
|
||||
return false;
|
||||
}
|
||||
r_asm_set_syntax (core->assembler, syntax);
|
||||
r_asm_set_syntax (core->rasm, syntax);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -1073,7 +1073,7 @@ static bool cb_bigendian(void *user, void *data) {
|
||||
RCore *core = (RCore *) user;
|
||||
RConfigNode *node = (RConfigNode *) data;
|
||||
// Try to set endian based on preference, restrict by RAsmPlugin
|
||||
bool isbig = r_asm_set_big_endian (core->assembler, node->i_value);
|
||||
bool isbig = r_asm_set_big_endian (core->rasm, node->i_value);
|
||||
// Set anal endianness the same as asm
|
||||
r_anal_set_big_endian (core->anal, isbig);
|
||||
// the big endian should also be assigned to dbg->bp->endian
|
||||
@ -2283,7 +2283,7 @@ static bool cb_segoff(void *user, void *data) {
|
||||
static bool cb_seggrn(void *user, void *data) {
|
||||
RCore *core = (RCore *) user;
|
||||
RConfigNode *node = (RConfigNode *) data;
|
||||
core->assembler->seggrn = node->i_value;
|
||||
core->rasm->seggrn = node->i_value;
|
||||
core->anal->seggrn = node->i_value;
|
||||
core->print->seggrn = node->i_value;
|
||||
return true;
|
||||
|
@ -14,7 +14,7 @@ static bool __isMips (RAsm *a) {
|
||||
}
|
||||
|
||||
static void loadGP(RCore *core) {
|
||||
if (__isMips (core->assembler)) {
|
||||
if (__isMips (core->rasm)) {
|
||||
ut64 gp = r_num_math (core->num, "loc._gp");
|
||||
if (!gp || gp == UT64_MAX) {
|
||||
r_config_set (core->config, "anal.roregs", "zero");
|
||||
@ -253,7 +253,7 @@ R_API char *r_core_sysenv_begin(RCore * core, const char *cmd) {
|
||||
}
|
||||
r_sys_setenv ("R2_OFFSET", sdb_fmt ("%"PFMT64d, core->offset));
|
||||
r_sys_setenv ("R2_XOFFSET", sdb_fmt ("0x%08"PFMT64x, core->offset));
|
||||
r_sys_setenv ("R2_ENDIAN", core->assembler->big_endian? "big": "little");
|
||||
r_sys_setenv ("R2_ENDIAN", core->rasm->big_endian? "big": "little");
|
||||
r_sys_setenv ("R2_BSIZE", sdb_fmt ("%d", core->blocksize));
|
||||
|
||||
// dump current config file so other r2 tools can use the same options
|
||||
@ -876,7 +876,7 @@ R_API RCoreFile *r_core_file_open(RCore *r, const char *file, int flags, ut64 lo
|
||||
if (!flags) {
|
||||
flags = R_PERM_R;
|
||||
}
|
||||
r->io->bits = r->assembler->bits; // TODO: we need an api for this
|
||||
r->io->bits = r->rasm->bits; // TODO: we need an api for this
|
||||
RIODesc *fd = r_io_open_nomap (r->io, file, flags, 0644);
|
||||
if (r_cons_is_breaked()) {
|
||||
goto beach;
|
||||
|
@ -1520,7 +1520,7 @@ R_API char *cmd_syscall_dostr(RCore *core, st64 n, ut64 addr) {
|
||||
// XXX this is a hack to make syscall args work on x86-32 and x86-64
|
||||
// we need to shift sn first.. which is bad, but needs to be redesigned
|
||||
int regidx = i;
|
||||
if (core->assembler->bits == 32 && !strcmp (core->assembler->cpu, "x86")) {
|
||||
if (core->rasm->bits == 32 && !strcmp (core->rasm->cpu, "x86")) {
|
||||
regidx++;
|
||||
}
|
||||
ut64 arg = r_debug_arg_get (core->dbg, R_ANAL_CC_TYPE_FASTCALL, regidx);
|
||||
@ -1619,11 +1619,11 @@ static void core_anal_bytes(RCore *core, const ut8 *buf, int len, int nops, int
|
||||
}
|
||||
for (i = idx = ret = 0; idx < len && (!nops || (nops && i < nops)); i++, idx += ret) {
|
||||
addr = core->offset + idx;
|
||||
r_asm_set_pc (core->assembler, addr);
|
||||
r_asm_set_pc (core->rasm, addr);
|
||||
hint = r_anal_hint_get (core->anal, addr);
|
||||
ret = r_anal_op (core->anal, &op, addr, buf + idx, len - idx,
|
||||
R_ANAL_OP_MASK_ESIL | R_ANAL_OP_MASK_OPEX | R_ANAL_OP_MASK_HINT);
|
||||
(void)r_asm_disassemble (core->assembler, &asmop, buf + idx, len - idx);
|
||||
(void)r_asm_disassemble (core->rasm, &asmop, buf + idx, len - idx);
|
||||
esilstr = R_STRBUF_SAFEGET (&op.esil);
|
||||
opexstr = R_STRBUF_SAFEGET (&op.opex);
|
||||
char *mnem = strdup (r_asm_op_get_asm (&asmop));
|
||||
@ -1654,7 +1654,7 @@ static void core_anal_bytes(RCore *core, const ut8 *buf, int len, int nops, int
|
||||
char *opname = strdup (r_asm_op_get_asm (&asmop));
|
||||
if (opname) {
|
||||
r_str_split (opname, ' ');
|
||||
char *d = r_asm_describe (core->assembler, opname);
|
||||
char *d = r_asm_describe (core->rasm, opname);
|
||||
if (d && *d) {
|
||||
r_cons_printf ("%s: %s\n", opname, d);
|
||||
free (d);
|
||||
@ -1719,7 +1719,7 @@ static void core_anal_bytes(RCore *core, const ut8 *buf, int len, int nops, int
|
||||
if (sp) {
|
||||
*sp = 0;
|
||||
}
|
||||
char *d = r_asm_describe (core->assembler, opname);
|
||||
char *d = r_asm_describe (core->rasm, opname);
|
||||
if (d && *d) {
|
||||
pj_ks (pj, "description", d);
|
||||
}
|
||||
@ -1872,7 +1872,7 @@ static void core_anal_bytes(RCore *core, const ut8 *buf, int len, int nops, int
|
||||
if (sp) {
|
||||
*sp = 0;
|
||||
}
|
||||
char *d = r_asm_describe (core->assembler, opname);
|
||||
char *d = r_asm_describe (core->rasm, opname);
|
||||
if (d && *d) {
|
||||
printline ("description", "%s\n", d);
|
||||
}
|
||||
@ -4492,7 +4492,7 @@ repeat:
|
||||
return_tail (1);
|
||||
}
|
||||
}
|
||||
r_asm_set_pc (core->assembler, addr);
|
||||
r_asm_set_pc (core->rasm, addr);
|
||||
// run esil pin command here
|
||||
const char *pincmd = r_anal_pin_call (core->anal, addr);
|
||||
if (pincmd) {
|
||||
@ -5616,7 +5616,7 @@ static void __anal_esil_function(RCore *core, ut64 addr) {
|
||||
bool opskip;
|
||||
while (pc < end) {
|
||||
left = R_MIN (end - pc, 32);
|
||||
// r_asm_set_pc (core->assembler, pc);
|
||||
// r_asm_set_pc (core->rasm, pc);
|
||||
ret = r_anal_op (core->anal, &op, pc, buf + pc - bb->addr, left, R_ANAL_OP_MASK_HINT | R_ANAL_OP_MASK_ESIL); // read overflow
|
||||
opskip = false;
|
||||
switch (op.type) {
|
||||
@ -6272,13 +6272,13 @@ static void cmd_anal_opcode(RCore *core, const char *input) {
|
||||
} else if (input[1] == 'd') {
|
||||
const int id = (input[2]==' ')
|
||||
?(int)r_num_math (core->num, input + 2): -1;
|
||||
char *ops = r_asm_mnemonics (core->assembler, id, false);
|
||||
char *ops = r_asm_mnemonics (core->rasm, id, false);
|
||||
if (ops) {
|
||||
char *ptr = ops;
|
||||
char *nl = strchr (ptr, '\n');
|
||||
while (nl) {
|
||||
*nl = 0;
|
||||
char *desc = r_asm_describe (core->assembler, ptr);
|
||||
char *desc = r_asm_describe (core->rasm, ptr);
|
||||
if (desc) {
|
||||
const char *pad = r_str_pad (' ', 16 - strlen (ptr));
|
||||
r_cons_printf ("%s%s%s\n", ptr, pad, desc);
|
||||
@ -6293,11 +6293,11 @@ static void cmd_anal_opcode(RCore *core, const char *input) {
|
||||
}
|
||||
} else if (input[1] == 'l' || input[1] == '=' || input[1] == ' ' || input[1] == 'j') {
|
||||
if (input[1] == ' ' && !IS_DIGIT (input[2])) {
|
||||
r_cons_printf ("%d\n", r_asm_mnemonics_byname (core->assembler, input + 2));
|
||||
r_cons_printf ("%d\n", r_asm_mnemonics_byname (core->rasm, input + 2));
|
||||
} else {
|
||||
const int id = (input[1] == ' ')
|
||||
?(int)r_num_math (core->num, input + 2): -1;
|
||||
char *ops = r_asm_mnemonics (core->assembler, id, input[1] == 'j');
|
||||
char *ops = r_asm_mnemonics (core->rasm, id, input[1] == 'j');
|
||||
if (ops) {
|
||||
r_cons_println (ops);
|
||||
free (ops);
|
||||
@ -6343,13 +6343,13 @@ static void cmd_anal_opcode(RCore *core, const char *input) {
|
||||
case 'd': // "aod"
|
||||
if (input[1] == 'a') { // "aoda"
|
||||
// list sdb database
|
||||
sdb_foreach (core->assembler->pair, listOpDescriptions, core);
|
||||
sdb_foreach (core->rasm->pair, listOpDescriptions, core);
|
||||
} else if (input[1] == 0) {
|
||||
int cur = R_MAX (core->print->cur, 0);
|
||||
// XXX: we need cmd_xxx.h (cmd_anal.h)
|
||||
core_anal_bytes (core, core->block + cur, core->blocksize, 1, 'd');
|
||||
} else if (input[1] == ' ') {
|
||||
char *d = r_asm_describe (core->assembler, input + 2);
|
||||
char *d = r_asm_describe (core->rasm, input + 2);
|
||||
if (d && *d) {
|
||||
r_cons_println (d);
|
||||
free (d);
|
||||
@ -6570,7 +6570,7 @@ static void _anal_calls(RCore *core, ut64 addr, ut64 addr_end, bool printCommand
|
||||
setBits = hint->bits;
|
||||
}
|
||||
r_anal_hint_free (hint);
|
||||
if (setBits != core->assembler->bits) {
|
||||
if (setBits != core->rasm->bits) {
|
||||
r_config_set_i (core->config, "asm.bits", setBits);
|
||||
}
|
||||
if (r_anal_op (core->anal, &op, addr, buf + bufi, bsz - bufi, 0) > 0) {
|
||||
@ -7005,8 +7005,8 @@ static char *get_buf_asm(RCore *core, ut64 from, ut64 addr, RAnalFunction *fcn,
|
||||
core->parser->relsub_addr = from;
|
||||
}
|
||||
r_io_read_at (core->io, addr, buf, size);
|
||||
r_asm_set_pc (core->assembler, addr);
|
||||
r_asm_disassemble (core->assembler, &asmop, buf, size);
|
||||
r_asm_set_pc (core->rasm, addr);
|
||||
r_asm_disassemble (core->rasm, &asmop, buf, size);
|
||||
int ba_len = r_strbuf_length (&asmop.buf_asm) + 128;
|
||||
char *ba = malloc (ba_len);
|
||||
strcpy (ba, r_strbuf_get (&asmop.buf_asm));
|
||||
@ -7372,8 +7372,8 @@ static bool cmd_anal_refs(RCore *core, const char *input) {
|
||||
// TODO: Use r_core_anal_op(DISASM) instead of all those 4 lines
|
||||
ut8 buf[16];
|
||||
r_io_read_at (core->io, ref->addr, buf, sizeof (buf));
|
||||
r_asm_set_pc (core->assembler, ref->addr);
|
||||
r_asm_disassemble (core->assembler, &asmop, buf, sizeof (buf));
|
||||
r_asm_set_pc (core->rasm, ref->addr);
|
||||
r_asm_disassemble (core->rasm, &asmop, buf, sizeof (buf));
|
||||
pj_o (pj);
|
||||
pj_kn (pj, "from", ref->at);
|
||||
pj_kn (pj, "to", ref->addr);
|
||||
@ -7402,8 +7402,8 @@ static bool cmd_anal_refs(RCore *core, const char *input) {
|
||||
desc = flag->name;
|
||||
} else {
|
||||
r_io_read_at (core->io, ref->addr, buf, sizeof (buf));
|
||||
r_asm_set_pc (core->assembler, ref->addr);
|
||||
r_asm_disassemble (core->assembler, &asmop, buf, sizeof(buf));
|
||||
r_asm_set_pc (core->rasm, ref->addr);
|
||||
r_asm_disassemble (core->rasm, &asmop, buf, sizeof(buf));
|
||||
RAnalHint *hint = r_anal_hint_get (core->anal, ref->addr);
|
||||
r_parse_filter (core->parser, ref->addr, core->flags, hint, r_asm_op_get_asm (&asmop),
|
||||
str, sizeof (str), core->print->big_endian);
|
||||
@ -7742,8 +7742,8 @@ static void cmd_anal_hint(RCore *core, const char *input) {
|
||||
RAnalOp op = { 0 };
|
||||
ut8 code[128] = { 0 };
|
||||
(void)r_io_read_at (core->io, core->offset, code, sizeof (code));
|
||||
r_asm_set_pc (core->assembler, addr);
|
||||
(void)r_asm_disassemble (core->assembler, &asmop, code, core->blocksize);
|
||||
r_asm_set_pc (core->rasm, addr);
|
||||
(void)r_asm_disassemble (core->rasm, &asmop, code, core->blocksize);
|
||||
int ret = r_anal_op (core->anal, &op, core->offset, code, core->blocksize, R_ANAL_OP_MASK_VAL);
|
||||
if (ret >= 0) {
|
||||
// HACK: Just convert only the first imm seen
|
||||
@ -8675,7 +8675,7 @@ static void cmd_anal_aad(RCore *core, const char *input) {
|
||||
}
|
||||
|
||||
static bool archIsThumbable(RCore *core) {
|
||||
RAsm *as = core ? core->assembler : NULL;
|
||||
RAsm *as = core ? core->rasm : NULL;
|
||||
if (as && as->cur && as->bits <= 32 && as->cur->name) {
|
||||
return strstr (as->cur->name, "arm");
|
||||
}
|
||||
@ -8742,7 +8742,7 @@ static void cmd_anal_aav(RCore *core, const char *input) {
|
||||
r_print_rowlog_done (core->print, oldstr);
|
||||
|
||||
int vsize = 4; // 32bit dword
|
||||
if (core->assembler->bits == 64) {
|
||||
if (core->rasm->bits == 64) {
|
||||
vsize = 8;
|
||||
}
|
||||
|
||||
@ -9332,7 +9332,7 @@ static bool anal_fcn_data_gaps (RCore *core, const char *input) {
|
||||
ut64 end = UT64_MAX;
|
||||
RAnalFunction *fcn;
|
||||
RListIter *iter;
|
||||
int i, wordsize = (core->assembler->bits == 64)? 8: 4;
|
||||
int i, wordsize = (core->rasm->bits == 64)? 8: 4;
|
||||
r_list_sort (core->anal->fcns, cmpaddr);
|
||||
r_list_foreach (core->anal->fcns, iter, fcn) {
|
||||
if (end != UT64_MAX) {
|
||||
|
@ -389,13 +389,13 @@ static int cmd_cmp_disasm(RCore *core, const char *input, int mode) {
|
||||
case 'c': // columns
|
||||
for (i = j = 0; i < core->blocksize && j < core->blocksize;) {
|
||||
// dis A
|
||||
r_asm_set_pc (core->assembler, core->offset + i);
|
||||
(void) r_asm_disassemble (core->assembler, &op,
|
||||
r_asm_set_pc (core->rasm, core->offset + i);
|
||||
(void) r_asm_disassemble (core->rasm, &op,
|
||||
core->block + i, core->blocksize - i);
|
||||
|
||||
// dis B
|
||||
r_asm_set_pc (core->assembler, off + i);
|
||||
(void) r_asm_disassemble (core->assembler, &op2,
|
||||
r_asm_set_pc (core->rasm, off + i);
|
||||
(void) r_asm_disassemble (core->rasm, &op2,
|
||||
buf + j, core->blocksize - j);
|
||||
|
||||
// show output
|
||||
@ -429,13 +429,13 @@ static int cmd_cmp_disasm(RCore *core, const char *input, int mode) {
|
||||
case 'u': // unified
|
||||
for (i = j = 0; i < core->blocksize && j < core->blocksize;) {
|
||||
// dis A
|
||||
r_asm_set_pc (core->assembler, core->offset + i);
|
||||
(void) r_asm_disassemble (core->assembler, &op,
|
||||
r_asm_set_pc (core->rasm, core->offset + i);
|
||||
(void) r_asm_disassemble (core->rasm, &op,
|
||||
core->block + i, core->blocksize - i);
|
||||
|
||||
// dis B
|
||||
r_asm_set_pc (core->assembler, off + i);
|
||||
(void) r_asm_disassemble (core->assembler, &op2,
|
||||
r_asm_set_pc (core->rasm, off + i);
|
||||
(void) r_asm_disassemble (core->rasm, &op2,
|
||||
buf + j, core->blocksize - j);
|
||||
|
||||
// show output
|
||||
|
@ -850,10 +850,10 @@ static int step_until_inst(RCore *core, const char *instr, bool regex) {
|
||||
pc = r_debug_reg_get (core->dbg, "PC");
|
||||
r_debug_reg_sync (core->dbg, R_REG_TYPE_ALL, false);
|
||||
/* TODO: disassemble instruction and strstr */
|
||||
r_asm_set_pc (core->assembler, pc);
|
||||
r_asm_set_pc (core->rasm, pc);
|
||||
// TODO: speedup if instructions are in the same block as the previous
|
||||
r_io_read_at (core->io, pc, buf, sizeof (buf));
|
||||
ret = r_asm_disassemble (core->assembler, &asmop, buf, sizeof (buf));
|
||||
ret = r_asm_disassemble (core->rasm, &asmop, buf, sizeof (buf));
|
||||
eprintf ("0x%08"PFMT64x" %d %s\n", pc, ret, r_asm_op_get_asm (&asmop)); // asmop.buf_asm);
|
||||
if (ret > 0) {
|
||||
const char *buf_asm = r_asm_op_get_asm (&asmop);
|
||||
@ -1357,7 +1357,7 @@ static int grab_bits(RCore *core, const char *arg, int *pcbits2) {
|
||||
const char *pcname = r_reg_get_name (core->anal->reg, R_REG_NAME_PC);
|
||||
RRegItem *reg = r_reg_get (core->anal->reg, pcname, 0);
|
||||
if (reg) {
|
||||
if (core->assembler->bits != reg->size)
|
||||
if (core->rasm->bits != reg->size)
|
||||
pcbits = reg->size;
|
||||
}
|
||||
}
|
||||
@ -1544,7 +1544,7 @@ static int r_debug_heap(RCore *core, const char *input) {
|
||||
const char *m = r_config_get (core->config, "dbg.malloc");
|
||||
if (m && !strcmp ("glibc", m)) {
|
||||
#if __linux__ && __GNU_LIBRARY__ && __GLIBC__ && __GLIBC_MINOR__
|
||||
if (core->assembler->bits == 64) {
|
||||
if (core->rasm->bits == 64) {
|
||||
cmd_dbg_map_heap_glibc_64 (core, input + 1);
|
||||
} else {
|
||||
cmd_dbg_map_heap_glibc_32 (core, input + 1);
|
||||
@ -1554,7 +1554,7 @@ static int r_debug_heap(RCore *core, const char *input) {
|
||||
#endif
|
||||
#if HAVE_JEMALLOC
|
||||
} else if (m && !strcmp ("jemalloc", m)) {
|
||||
if (core->assembler->bits == 64) {
|
||||
if (core->rasm->bits == 64) {
|
||||
cmd_dbg_map_jemalloc_64 (core, input + 1);
|
||||
} else {
|
||||
cmd_dbg_map_jemalloc_32 (core, input + 1);
|
||||
@ -1956,7 +1956,7 @@ R_API void r_core_debug_ri(RCore *core, RReg *reg, int mode) {
|
||||
HtUP *db = ht_up_new0 ();
|
||||
|
||||
r_list_foreach (list, iter, r) {
|
||||
if (r->size != core->assembler->bits) {
|
||||
if (r->size != core->rasm->bits) {
|
||||
continue;
|
||||
}
|
||||
ut64 value = r_reg_get_value (reg, r);
|
||||
@ -2007,7 +2007,7 @@ R_API void r_core_debug_rr(RCore *core, RReg *reg, int mode) {
|
||||
bool use_colors = had_colors != 0;
|
||||
int delta = 0;
|
||||
ut64 diff, value;
|
||||
int bits = core->assembler->bits;
|
||||
int bits = core->rasm->bits;
|
||||
//XXX: support other RRegisterType
|
||||
RList *list = r_reg_get_list (reg, R_REG_TYPE_GPR);
|
||||
RListIter *iter;
|
||||
@ -2512,7 +2512,7 @@ static void cmd_debug_reg(RCore *core, const char *str) {
|
||||
r_print_hexdump (core->print, 0ll, buf, len, 64, 8, 1);
|
||||
break;
|
||||
default:
|
||||
if (core->assembler->bits == 64) {
|
||||
if (core->rasm->bits == 64) {
|
||||
r_print_hexdump (core->print, 0ll, buf, len, 64, 8, 1);
|
||||
} else {
|
||||
r_print_hexdump (core->print, 0ll, buf, len, 32, 4, 1);
|
||||
@ -2997,7 +2997,7 @@ static void cmd_debug_reg(RCore *core, const char *str) {
|
||||
const char *pcname = r_reg_get_name (core->anal->reg, R_REG_NAME_PC);
|
||||
RRegItem *reg = r_reg_get (core->anal->reg, pcname, 0);
|
||||
if (reg) {
|
||||
if (core->assembler->bits != reg->size) {
|
||||
if (core->rasm->bits != reg->size) {
|
||||
pcbits = reg->size;
|
||||
}
|
||||
}
|
||||
@ -5417,8 +5417,8 @@ static int cmd_debug(void *data, const char *input) {
|
||||
}
|
||||
case 'a': { // "dxa"
|
||||
RAsmCode *acode;
|
||||
r_asm_set_pc (core->assembler, core->offset);
|
||||
acode = r_asm_massemble (core->assembler, input + 2);
|
||||
r_asm_set_pc (core->rasm, core->offset);
|
||||
acode = r_asm_massemble (core->rasm, input + 2);
|
||||
if (acode) {
|
||||
r_reg_arena_push (core->dbg->reg);
|
||||
r_debug_execute (core->dbg, acode->bytes, acode->len, 0);
|
||||
@ -5438,7 +5438,7 @@ static int cmd_debug(void *data, const char *input) {
|
||||
r_egg_load (egg, input + 1, 0);
|
||||
r_egg_compile (egg);
|
||||
b = r_egg_get_bin (egg);
|
||||
r_asm_set_pc (core->assembler, core->offset);
|
||||
r_asm_set_pc (core->rasm, core->offset);
|
||||
r_reg_arena_push (core->dbg->reg);
|
||||
ut64 tmpsz;
|
||||
const ut8 *tmp = r_buf_data (b, &tmpsz);
|
||||
|
@ -136,7 +136,7 @@ static int cmd_egg(void *data, const char *input) {
|
||||
char *oa, *p;
|
||||
r_egg_setup (egg,
|
||||
r_config_get (core->config, "asm.arch"),
|
||||
core->assembler->bits, 0,
|
||||
core->rasm->bits, 0,
|
||||
r_config_get (core->config, "asm.os")); // XXX
|
||||
switch (*input) {
|
||||
case 's': // "gs"
|
||||
|
@ -1051,7 +1051,7 @@ R_API void r_core_file_reopen_remote_debug(RCore *core, char *uri, ut64 addr) {
|
||||
|
||||
RList *old_sections = __save_old_sections (core);
|
||||
ut64 old_base = core->bin->cur->o->baddr_shift;
|
||||
int bits = core->assembler->bits;
|
||||
int bits = core->rasm->bits;
|
||||
r_config_set_i (core->config, "asm.bits", bits);
|
||||
r_config_set_i (core->config, "cfg.debug", true);
|
||||
// Set referer as the original uri so we could return to it with `oo`
|
||||
@ -1117,7 +1117,7 @@ R_API void r_core_file_reopen_debug(RCore *core, const char *args) {
|
||||
|
||||
RList *old_sections = __save_old_sections (core);
|
||||
ut64 old_base = core->bin->cur->o->baddr_shift;
|
||||
int bits = core->assembler->bits;
|
||||
int bits = core->rasm->bits;
|
||||
char *bin_abspath = r_file_abspath (binpath);
|
||||
char *escaped_path = r_str_arg_escape (bin_abspath);
|
||||
char *newfile = r_str_newf ("dbg://%s %s", escaped_path, args);
|
||||
|
@ -611,9 +611,9 @@ static void __cmd_pad(RCore *core, const char *arg) {
|
||||
eprintf ("Usage: pad [hexpairs] # disassembly given bytes\n");
|
||||
return;
|
||||
}
|
||||
r_asm_set_pc (core->assembler, core->offset);
|
||||
r_asm_set_pc (core->rasm, core->offset);
|
||||
bool is_pseudo = r_config_get_i (core->config, "asm.pseudo");
|
||||
RAsmCode *acode = r_asm_mdisassemble_hexstr (core->assembler, is_pseudo ? core->parser : NULL, arg);
|
||||
RAsmCode *acode = r_asm_mdisassemble_hexstr (core->rasm, is_pseudo ? core->parser : NULL, arg);
|
||||
if (acode) {
|
||||
r_cons_print (acode->assembly);
|
||||
r_asm_code_free (acode);
|
||||
@ -2487,13 +2487,13 @@ static void printraw(RCore *core, int len, int mode) {
|
||||
|
||||
|
||||
static void _handle_call(RCore *core, char *line, char **str) {
|
||||
if (!core || !core->assembler || !core->assembler->cur) {
|
||||
if (!core || !core->rasm || !core->rasm->cur) {
|
||||
*str = NULL;
|
||||
return;
|
||||
}
|
||||
if (strstr (core->assembler->cur->arch, "x86")) {
|
||||
if (strstr (core->rasm->cur->arch, "x86")) {
|
||||
*str = strstr (line, "call ");
|
||||
} else if (strstr (core->assembler->cur->arch, "arm")) {
|
||||
} else if (strstr (core->rasm->cur->arch, "arm")) {
|
||||
*str = strstr (line, " b ");
|
||||
if (*str && strstr (*str, " 0x")) {
|
||||
/*
|
||||
@ -2914,7 +2914,7 @@ static void cmd_print_pv(RCore *core, const char *input, bool useBytes) {
|
||||
ut8 *block = core->block;
|
||||
int blocksize = core->blocksize;
|
||||
ut8 *block_end = core->block + blocksize;
|
||||
int i, n = core->assembler->bits / 8;
|
||||
int i, n = core->rasm->bits / 8;
|
||||
int type = 'v';
|
||||
bool fixed_size = true;
|
||||
switch (input[0]) {
|
||||
@ -3091,14 +3091,14 @@ static void cmd_print_pv(RCore *core, const char *input, bool useBytes) {
|
||||
break;
|
||||
default:
|
||||
v = r_read_ble64 (block, core->print->big_endian);
|
||||
switch (core->assembler->bits / 8) {
|
||||
switch (core->rasm->bits / 8) {
|
||||
case 1: r_cons_printf ("0x%02" PFMT64x "\n", v & UT8_MAX); break;
|
||||
case 2: r_cons_printf ("0x%04" PFMT64x "\n", v & UT16_MAX); break;
|
||||
case 4: r_cons_printf ("0x%08" PFMT64x "\n", v & UT32_MAX); break;
|
||||
case 8: r_cons_printf ("0x%016" PFMT64x "\n", v & UT64_MAX); break;
|
||||
default: break;
|
||||
}
|
||||
block += core->assembler->bits / 8;
|
||||
block += core->rasm->bits / 8;
|
||||
break;
|
||||
}
|
||||
} while (repeat > 0);
|
||||
@ -4197,14 +4197,14 @@ static void disasm_ropchain(RCore *core, ut64 addr, char type_print) {
|
||||
(void)r_io_read_at (core->io, addr, buf, core->blocksize);
|
||||
while (p + 4 < core->blocksize) {
|
||||
const bool be = core->print->big_endian;
|
||||
if (core->assembler->bits == 64) {
|
||||
if (core->rasm->bits == 64) {
|
||||
n = r_read_ble64 (buf + p, be);
|
||||
} else {
|
||||
n = r_read_ble32 (buf + p, be);
|
||||
}
|
||||
r_cons_printf ("[0x%08"PFMT64x"] 0x%08"PFMT64x"\n", addr + p, n);
|
||||
disasm_until_ret (core, n, type_print, NULL);
|
||||
if (core->assembler->bits == 64) {
|
||||
if (core->rasm->bits == 64) {
|
||||
p += 8;
|
||||
} else {
|
||||
p += 4;
|
||||
@ -4868,8 +4868,8 @@ static int cmd_print(void *data, const char *input) {
|
||||
int printed = 0;
|
||||
int bufsz;
|
||||
RAnalOp aop = {0};
|
||||
r_asm_set_pc (core->assembler, core->offset);
|
||||
RAsmCode *acode = r_asm_massemble (core->assembler, input + 2);
|
||||
r_asm_set_pc (core->rasm, core->offset);
|
||||
RAsmCode *acode = r_asm_massemble (core->rasm, input + 2);
|
||||
if (acode) {
|
||||
bufsz = acode->len;
|
||||
while (printed < bufsz) {
|
||||
@ -4945,8 +4945,8 @@ static int cmd_print(void *data, const char *input) {
|
||||
} else {
|
||||
int i;
|
||||
int bytes;
|
||||
r_asm_set_pc (core->assembler, core->offset);
|
||||
RAsmCode *acode = r_asm_massemble (core->assembler, input + 1);
|
||||
r_asm_set_pc (core->rasm, core->offset);
|
||||
RAsmCode *acode = r_asm_massemble (core->rasm, input + 1);
|
||||
if (acode) {
|
||||
bytes = acode->len;
|
||||
for (i = 0; i < bytes; i++) {
|
||||
@ -5507,7 +5507,7 @@ static int cmd_print(void *data, const char *input) {
|
||||
}
|
||||
r_cons_break_push (NULL, NULL);
|
||||
for (i = j = 0; i < core->blocksize && j < l; i += ret, j++) {
|
||||
ret = r_asm_disassemble (core->assembler, &asmop, block + i, len - i);
|
||||
ret = r_asm_disassemble (core->rasm, &asmop, block + i, len - i);
|
||||
if (r_cons_is_breaked ()) {
|
||||
break;
|
||||
}
|
||||
@ -5917,7 +5917,7 @@ l = use_blocksize;
|
||||
RAsmOp asmop = {
|
||||
0
|
||||
};
|
||||
(void) r_asm_disassemble (core->assembler, &asmop, buf + i, len - i);
|
||||
(void) r_asm_disassemble (core->rasm, &asmop, buf + i, len - i);
|
||||
int sz = asmop.size;
|
||||
if (sz < 1) {
|
||||
sz = 1;
|
||||
@ -6379,7 +6379,7 @@ l = use_blocksize;
|
||||
pj_free (pj);
|
||||
} else {
|
||||
const int ocols = core->print->cols;
|
||||
int bitsize = core->assembler->bits;
|
||||
int bitsize = core->rasm->bits;
|
||||
/* Thumb is 16bit arm but handles 32bit data */
|
||||
if (bitsize == 16) {
|
||||
bitsize = 32;
|
||||
|
@ -1065,8 +1065,8 @@ static RList *construct_rop_gadget(RCore *core, ut64 addr, ut8 *buf, int buflen,
|
||||
if (!opst) {
|
||||
R_LOG_WARN ("Anal plugin %s did not return disassembly\n", core->anal->cur->name);
|
||||
RAsmOp asmop;
|
||||
r_asm_set_pc (core->assembler, addr);
|
||||
if (!r_asm_disassemble (core->assembler, &asmop, buf + idx, buflen - idx)) {
|
||||
r_asm_set_pc (core->rasm, addr);
|
||||
if (!r_asm_disassemble (core->rasm, &asmop, buf + idx, buflen - idx)) {
|
||||
valid = false;
|
||||
goto ret;
|
||||
}
|
||||
@ -1182,8 +1182,8 @@ static void print_rop(RCore *core, RList *hitlist, char mode, bool *json_first)
|
||||
r_list_foreach (hitlist, iter, hit) {
|
||||
ut8 *buf = malloc (hit->len);
|
||||
r_io_read_at (core->io, hit->addr, buf, hit->len);
|
||||
r_asm_set_pc (core->assembler, hit->addr);
|
||||
r_asm_disassemble (core->assembler, &asmop, buf, hit->len);
|
||||
r_asm_set_pc (core->rasm, hit->addr);
|
||||
r_asm_disassemble (core->rasm, &asmop, buf, hit->len);
|
||||
r_anal_op (core->anal, &analop, hit->addr, buf, hit->len, R_ANAL_OP_MASK_ESIL);
|
||||
size += hit->len;
|
||||
if (analop.type != R_ANAL_OP_TYPE_RET) {
|
||||
@ -1215,8 +1215,8 @@ static void print_rop(RCore *core, RList *hitlist, char mode, bool *json_first)
|
||||
r_list_foreach (hitlist, iter, hit) {
|
||||
ut8 *buf = malloc (hit->len);
|
||||
r_io_read_at (core->io, hit->addr, buf, hit->len);
|
||||
r_asm_set_pc (core->assembler, hit->addr);
|
||||
r_asm_disassemble (core->assembler, &asmop, buf, hit->len);
|
||||
r_asm_set_pc (core->rasm, hit->addr);
|
||||
r_asm_disassemble (core->rasm, &asmop, buf, hit->len);
|
||||
r_anal_op (core->anal, &analop, hit->addr, buf, hit->len, R_ANAL_OP_MASK_BASIC);
|
||||
size += hit->len;
|
||||
const char *opstr = R_STRBUF_SAFEGET (&analop.esil);
|
||||
@ -1256,8 +1256,8 @@ static void print_rop(RCore *core, RList *hitlist, char mode, bool *json_first)
|
||||
}
|
||||
buf[hit->len] = 0;
|
||||
r_io_read_at (core->io, hit->addr, buf, hit->len);
|
||||
r_asm_set_pc (core->assembler, hit->addr);
|
||||
r_asm_disassemble (core->assembler, &asmop, buf, hit->len);
|
||||
r_asm_set_pc (core->rasm, hit->addr);
|
||||
r_asm_disassemble (core->rasm, &asmop, buf, hit->len);
|
||||
r_anal_op (core->anal, &analop, hit->addr, buf, hit->len, R_ANAL_OP_MASK_ESIL);
|
||||
size += hit->len;
|
||||
if (analop.type != R_ANAL_OP_TYPE_RET) {
|
||||
@ -1503,9 +1503,9 @@ static int r_core_search_rop(RCore *core, RInterval search_itv, int opt, const c
|
||||
R_MIN ((delta - i), 4096));
|
||||
end = i + 2048;
|
||||
}
|
||||
ret = r_asm_disassemble (core->assembler, &asmop, buf + i, delta - i);
|
||||
ret = r_asm_disassemble (core->rasm, &asmop, buf + i, delta - i);
|
||||
if (ret) {
|
||||
r_asm_set_pc (core->assembler, from + i);
|
||||
r_asm_set_pc (core->rasm, from + i);
|
||||
RList *hitlist = construct_rop_gadget (core,
|
||||
from + i, buf, delta, i, grep, regexp,
|
||||
rx_list, end_gadget, badstart);
|
||||
@ -1915,8 +1915,8 @@ static void do_ref_search(RCore *core, ut64 addr,ut64 from, ut64 to, struct sear
|
||||
if (list) {
|
||||
r_list_foreach (list, iter, ref) {
|
||||
r_io_read_at (core->io, ref->addr, buf, size);
|
||||
r_asm_set_pc (core->assembler, ref->addr);
|
||||
r_asm_disassemble (core->assembler, &asmop, buf, size);
|
||||
r_asm_set_pc (core->rasm, ref->addr);
|
||||
r_asm_disassemble (core->rasm, &asmop, buf, size);
|
||||
fcn = r_anal_get_fcn_in (core->anal, ref->addr, 0);
|
||||
RAnalHint *hint = r_anal_hint_get (core->anal, ref->addr);
|
||||
r_parse_filter (core->parser, ref->addr, core->flags, hint, r_strbuf_get (&asmop.buf_asm),
|
||||
@ -2572,7 +2572,7 @@ static void search_similar_pattern(RCore *core, int count, struct search_paramet
|
||||
}
|
||||
|
||||
static bool isArm(RCore *core) {
|
||||
RAsm *as = core ? core->assembler : NULL;
|
||||
RAsm *as = core ? core->rasm : NULL;
|
||||
if (as && as->cur && as->cur->arch) {
|
||||
if (r_str_startswith (as->cur->arch, "arm")) {
|
||||
if (as->cur->bits < 64) {
|
||||
@ -2877,7 +2877,7 @@ static void __core_cmd_search_asm_byteswap (RCore *core, int nth) {
|
||||
}
|
||||
for (i = 0; i <= 0xff; i++) {
|
||||
buf[nth] = i;
|
||||
if (r_asm_disassemble (core->assembler, &asmop, buf, sizeof (buf)) > 0) {
|
||||
if (r_asm_disassemble (core->rasm, &asmop, buf, sizeof (buf)) > 0) {
|
||||
const char *asmstr = r_strbuf_get (&asmop.buf_asm);
|
||||
if (!strstr (asmstr, "invalid") && !strstr (asmstr, "unaligned")) {
|
||||
r_cons_printf ("%02x %s\n", i, asmstr);
|
||||
@ -3822,7 +3822,7 @@ reread:
|
||||
int ochunksize;
|
||||
int i, len, chunksize = r_config_get_i (core->config, "search.chunk");
|
||||
if (chunksize < 1) {
|
||||
chunksize = core->assembler->bits / 8;
|
||||
chunksize = core->rasm->bits / 8;
|
||||
}
|
||||
len = r_str_unescape (str);
|
||||
ochunksize = chunksize = R_MIN (len, chunksize);
|
||||
|
@ -272,7 +272,7 @@ static int cmd_seek_opcode_backward(RCore *core, int numinstr) {
|
||||
}
|
||||
RAsmOp op = {0};
|
||||
r_core_seek (core, prev_addr, true);
|
||||
r_asm_disassemble (core->assembler, &op, core->block, 32);
|
||||
r_asm_disassemble (core->rasm, &op, core->block, 32);
|
||||
if (op.size < mininstrsize) {
|
||||
op.size = mininstrsize;
|
||||
}
|
||||
|
@ -1169,9 +1169,9 @@ static int cmd_write(void *data, const char *input) {
|
||||
switch (input[1]) {
|
||||
case ' ':
|
||||
if (input[2] && input[3]==' ') {
|
||||
r_asm_set_pc (core->assembler, core->offset);
|
||||
r_asm_set_pc (core->rasm, core->offset);
|
||||
eprintf ("modify (%c)=%s\n", input[2], input+4);
|
||||
len = r_asm_modify (core->assembler, core->block, input[2],
|
||||
len = r_asm_modify (core->rasm, core->block, input[2],
|
||||
r_num_math (core->num, input+4));
|
||||
eprintf ("len=%d\n", len);
|
||||
if (len>0) {
|
||||
@ -1574,8 +1574,8 @@ static int cmd_write(void *data, const char *input) {
|
||||
case '*': {
|
||||
const char *file = r_str_trim_head_ro (input + 2);
|
||||
RAsmCode *acode;
|
||||
r_asm_set_pc (core->assembler, core->offset);
|
||||
acode = r_asm_massemble (core->assembler, file);
|
||||
r_asm_set_pc (core->rasm, core->offset);
|
||||
acode = r_asm_massemble (core->rasm, file);
|
||||
if (acode) {
|
||||
if (input[1] == 'i') { // "wai"
|
||||
RAnalOp analop;
|
||||
@ -1618,7 +1618,7 @@ static int cmd_write(void *data, const char *input) {
|
||||
case 'f': // "waf"
|
||||
if ((input[2] == ' ' || input[2] == '*')) {
|
||||
const char *file = input + ((input[2] == '*')? 4: 3);
|
||||
r_asm_set_pc (core->assembler, core->offset);
|
||||
r_asm_set_pc (core->rasm, core->offset);
|
||||
|
||||
char *src = r_file_slurp (file, NULL);
|
||||
if (src) {
|
||||
@ -1639,7 +1639,7 @@ static int cmd_write(void *data, const char *input) {
|
||||
}
|
||||
}
|
||||
if (*b) {
|
||||
RAsmCode *ac = r_asm_massemble (core->assembler, b);
|
||||
RAsmCode *ac = r_asm_massemble (core->rasm, b);
|
||||
if (ac) {
|
||||
r_io_write_at (core->io, addr, ac->bytes, ac->len);
|
||||
r_asm_code_free (ac);
|
||||
@ -1659,10 +1659,10 @@ static int cmd_write(void *data, const char *input) {
|
||||
case 'F': // "waF"
|
||||
if ((input[2] == ' ' || input[2] == '*')) {
|
||||
const char *file = input + ((input[2] == '*')? 4: 3);
|
||||
r_asm_set_pc (core->assembler, core->offset);
|
||||
r_asm_set_pc (core->rasm, core->offset);
|
||||
char *f = r_file_slurp (file, NULL);
|
||||
if (f) {
|
||||
RAsmCode *acode = r_asm_massemble (core->assembler, f);
|
||||
RAsmCode *acode = r_asm_massemble (core->rasm, f);
|
||||
if (acode) {
|
||||
char* hex = r_asm_code_get_hex (acode);
|
||||
if (input[2] == '*') {
|
||||
|
@ -487,7 +487,7 @@ static ut64 num_callback(RNum *userptr, const char *str, int *ok) {
|
||||
case '[':
|
||||
{
|
||||
ut64 n = 0LL;
|
||||
int refsz = core->assembler->bits / 8;
|
||||
int refsz = core->rasm->bits / 8;
|
||||
const char *p = NULL;
|
||||
if (strlen (str) > 5) {
|
||||
p = strchr (str + 5, ':');
|
||||
@ -2006,9 +2006,9 @@ static void update_sdb(RCore *core) {
|
||||
//sdb_ns_set (core->sdb, "flags", core->flags->sdb);
|
||||
//sdb_ns_set (core->sdb, "bin", core->bin->sdb);
|
||||
//SDB// syscall/
|
||||
if (core->assembler && core->assembler->syscall && core->assembler->syscall->db) {
|
||||
core->assembler->syscall->db->refs++;
|
||||
sdb_ns_set (DB, "syscall", core->assembler->syscall->db);
|
||||
if (core->rasm && core->rasm->syscall && core->rasm->syscall->db) {
|
||||
core->rasm->syscall->db->refs++;
|
||||
sdb_ns_set (DB, "syscall", core->rasm->syscall->db);
|
||||
}
|
||||
d = sdb_ns (DB, "debug", 1);
|
||||
if (core->dbg->sgnls) {
|
||||
@ -2077,7 +2077,7 @@ static char *r_core_anal_hasrefs_to_depth(RCore *core, ut64 value, int depth) {
|
||||
r_strbuf_appendf (s, " (%s)", mapname);
|
||||
R_FREE (mapname);
|
||||
}
|
||||
int bits = core->assembler->bits;
|
||||
int bits = core->rasm->bits;
|
||||
switch (bits) {
|
||||
case 16: // umf, not in sync with pxr
|
||||
{
|
||||
@ -2159,8 +2159,8 @@ static char *r_core_anal_hasrefs_to_depth(RCore *core, ut64 value, int depth) {
|
||||
r_strbuf_appendf (s, " %sX%s", c, cend);
|
||||
/* instruction disassembly */
|
||||
r_io_read_at (core->io, value, buf, sizeof (buf));
|
||||
r_asm_set_pc (core->assembler, value);
|
||||
r_asm_disassemble (core->assembler, &op, buf, sizeof (buf));
|
||||
r_asm_set_pc (core->rasm, value);
|
||||
r_asm_disassemble (core->rasm, &op, buf, sizeof (buf));
|
||||
r_strbuf_appendf (s, " '%s'", r_asm_op_get_asm (&op));
|
||||
/* get library name */
|
||||
{ // NOTE: dup for mapname?
|
||||
@ -2181,7 +2181,7 @@ static char *r_core_anal_hasrefs_to_depth(RCore *core, ut64 value, int depth) {
|
||||
ut32 *n32 = (ut32 *)buf;
|
||||
ut64 *n64 = (ut64*)buf;
|
||||
r_io_read_at (core->io, value, buf, sizeof (buf));
|
||||
ut64 n = (core->assembler->bits == 64)? *n64: *n32;
|
||||
ut64 n = (core->rasm->bits == 64)? *n64: *n32;
|
||||
r_strbuf_appendf (s, " 0x%"PFMT64x, n);
|
||||
}
|
||||
}
|
||||
@ -2215,7 +2215,7 @@ static char *r_core_anal_hasrefs_to_depth(RCore *core, ut64 value, int depth) {
|
||||
ut32 *n32 = (ut32 *)buf;
|
||||
ut64 *n64 = (ut64*)buf;
|
||||
r_io_read_at (core->io, value, buf, sizeof (buf));
|
||||
ut64 n = (core->assembler->bits == 64)? *n64: *n32;
|
||||
ut64 n = (core->rasm->bits == 64)? *n64: *n32;
|
||||
if(n != value) {
|
||||
char* rrstr = r_core_anal_hasrefs_to_depth (core, n, depth-1);
|
||||
if (rrstr) {
|
||||
@ -2621,9 +2621,9 @@ R_API bool r_core_init(RCore *core) {
|
||||
core->lang->cb_printf = r_cons_printf;
|
||||
r_lang_define (core->lang, "RCore", "core", core);
|
||||
r_lang_set_user_ptr (core->lang, core);
|
||||
core->assembler = r_asm_new ();
|
||||
core->assembler->num = core->num;
|
||||
r_asm_set_user_ptr (core->assembler, core);
|
||||
core->rasm = r_asm_new ();
|
||||
core->rasm->num = core->num;
|
||||
r_asm_set_user_ptr (core->rasm, core);
|
||||
core->anal = r_anal_new ();
|
||||
core->gadgets = r_list_newf ((RListFree)r_core_gadget_free);
|
||||
core->anal->ev = core->ev;
|
||||
@ -2634,7 +2634,7 @@ R_API bool r_core_init(RCore *core) {
|
||||
core->anal->cb.on_fcn_delete = on_fcn_delete;
|
||||
core->anal->cb.on_fcn_rename = on_fcn_rename;
|
||||
core->print->sdb_types = core->anal->sdb_types;
|
||||
core->assembler->syscall = r_syscall_ref (core->anal->syscall); // BIND syscall anal/asm
|
||||
core->rasm->syscall = r_syscall_ref (core->anal->syscall); // BIND syscall anal/asm
|
||||
r_anal_set_user_ptr (core->anal, core);
|
||||
core->anal->cb_printf = (void *) r_cons_printf;
|
||||
core->parser = r_parse_new ();
|
||||
@ -2664,7 +2664,7 @@ R_API bool r_core_init(RCore *core) {
|
||||
core->asmqjmps = R_NEWS (ut64, core->asmqjmps_size);
|
||||
}
|
||||
|
||||
r_bin_bind (core->bin, &(core->assembler->binb));
|
||||
r_bin_bind (core->bin, &(core->rasm->binb));
|
||||
r_bin_bind (core->bin, &(core->anal->binb));
|
||||
r_bin_bind (core->bin, &(core->anal->binb));
|
||||
|
||||
@ -2713,7 +2713,7 @@ R_API bool r_core_init(RCore *core) {
|
||||
//r_core_loadlibs (core);
|
||||
|
||||
// TODO: get arch from r_bin or from native arch
|
||||
r_asm_use (core->assembler, R_SYS_ARCH);
|
||||
r_asm_use (core->rasm, R_SYS_ARCH);
|
||||
r_anal_use (core->anal, R_SYS_ARCH);
|
||||
if (R_SYS_BITS & R_SYS_BITS_64) {
|
||||
r_config_set_i (core->config, "asm.bits", 64);
|
||||
@ -2798,8 +2798,8 @@ R_API void r_core_fini(RCore *c) {
|
||||
c->rcmd = r_cmd_free (c->rcmd);
|
||||
r_list_free (c->cmd_descriptors);
|
||||
c->anal = r_anal_free (c->anal);
|
||||
r_asm_free (c->assembler);
|
||||
c->assembler = NULL;
|
||||
r_asm_free (c->rasm);
|
||||
c->rasm = NULL;
|
||||
c->print = r_print_free (c->print);
|
||||
c->bin = (r_bin_free (c->bin), NULL);
|
||||
c->lang = (r_lang_free (c->lang), NULL);
|
||||
@ -3085,9 +3085,9 @@ R_API int r_core_seek_align(RCore *core, ut64 align, int times) {
|
||||
R_API char *r_core_op_str(RCore *core, ut64 addr) {
|
||||
RAsmOp op = {0};
|
||||
ut8 buf[64];
|
||||
r_asm_set_pc (core->assembler, addr);
|
||||
r_asm_set_pc (core->rasm, addr);
|
||||
r_io_read_at (core->io, addr, buf, sizeof (buf));
|
||||
int ret = r_asm_disassemble (core->assembler, &op, buf, sizeof (buf));
|
||||
int ret = r_asm_disassemble (core->rasm, &op, buf, sizeof (buf));
|
||||
char *str = (ret > 0)? strdup (r_strbuf_get (&op.buf_asm)): NULL;
|
||||
r_asm_op_fini (&op);
|
||||
return str;
|
||||
@ -3523,7 +3523,7 @@ R_API RBuffer *r_core_syscall (RCore *core, const char *name, const char *args)
|
||||
num = r_syscall_get_num (core->anal->syscall, name);
|
||||
|
||||
//bits check
|
||||
switch (core->assembler->bits) {
|
||||
switch (core->rasm->bits) {
|
||||
case 32:
|
||||
if (strcmp (name, "setup") && !num ) {
|
||||
eprintf ("syscall not found!\n");
|
||||
|
@ -415,7 +415,7 @@ static void ds_print_ref_lines(char *line, char *line_col, RDisasmState *ds) {
|
||||
}
|
||||
|
||||
static void get_bits_comment(RCore *core, RAnalFunction *f, char *cmt, int cmt_size) {
|
||||
if (core && f && cmt && cmt_size > 0 && f->bits && f->bits != core->assembler->bits) {
|
||||
if (core && f && cmt && cmt_size > 0 && f->bits && f->bits != core->rasm->bits) {
|
||||
const char *asm_arch = r_config_get (core->config, "asm.arch");
|
||||
if (asm_arch && *asm_arch && strstr (asm_arch, "arm")) {
|
||||
switch (f->bits) {
|
||||
@ -1072,7 +1072,7 @@ static void ds_build_op_str(RDisasmState *ds, bool print_color) {
|
||||
if (core->parser->relsub && ds->analop.refptr) {
|
||||
if (core->parser->relsub_addr == 0) {
|
||||
ut64 killme = UT64_MAX;
|
||||
const int be = core->assembler->big_endian;
|
||||
const int be = core->rasm->big_endian;
|
||||
r_io_read_i (core->io, ds->analop.ptr, &killme, ds->analop.refptr, be);
|
||||
core->parser->relsub_addr = killme;
|
||||
}
|
||||
@ -2061,7 +2061,7 @@ static void ds_show_comments_describe(RDisasmState *ds) {
|
||||
*op = 0;
|
||||
}
|
||||
r_str_case (locase, 0);
|
||||
desc = r_asm_describe (ds->core->assembler, locase);
|
||||
desc = r_asm_describe (ds->core->rasm, locase);
|
||||
free (locase);
|
||||
}
|
||||
if (desc && *desc) {
|
||||
@ -2438,7 +2438,7 @@ static int ds_disassemble(RDisasmState *ds, ut8 *buf, int len) {
|
||||
ds->opstr = strdup (ds->hint->opcode);
|
||||
}
|
||||
r_asm_op_fini (&ds->asmop);
|
||||
ret = r_asm_disassemble (core->assembler, &ds->asmop, buf, len);
|
||||
ret = r_asm_disassemble (core->rasm, &ds->asmop, buf, len);
|
||||
if (ds->asmop.size < 1) {
|
||||
ds->asmop.size = 1;
|
||||
}
|
||||
@ -2518,7 +2518,7 @@ static int ds_disassemble(RDisasmState *ds, ut8 *buf, int len) {
|
||||
ret = -1;
|
||||
#if HASRETRY
|
||||
if (!ds->cbytes && ds->tries > 0) {
|
||||
ds->addr = core->assembler->pc;
|
||||
ds->addr = core->rasm->pc;
|
||||
ds->tries--;
|
||||
ds->idx = 0;
|
||||
ds->retry = true;
|
||||
@ -3484,7 +3484,7 @@ static bool ds_print_core_vmode_jump_hit(RDisasmState *ds, int pos) {
|
||||
static void getPtr(RDisasmState *ds, ut64 addr, int pos) {
|
||||
ut8 buf[sizeof (ut64)] = {0};
|
||||
r_io_read_at (ds->core->io, addr, buf, sizeof (buf));
|
||||
if (ds->core->assembler->bits == 64) {
|
||||
if (ds->core->rasm->bits == 64) {
|
||||
ut64 n64 = r_read_ble64 (buf, 0);
|
||||
ds_print_shortcut (ds, n64, pos);
|
||||
} else {
|
||||
@ -3520,10 +3520,10 @@ static bool ds_print_core_vmode(RDisasmState *ds, int pos) {
|
||||
ut64 size;
|
||||
RAnalMetaItem *mi = r_meta_get_at (ds->core->anal, ds->at, R_META_TYPE_ANY, &size);
|
||||
if (mi) {
|
||||
int obits = ds->core->assembler->bits;
|
||||
ds->core->assembler->bits = size * 8;
|
||||
int obits = ds->core->rasm->bits;
|
||||
ds->core->rasm->bits = size * 8;
|
||||
getPtr (ds, ds->at, pos);
|
||||
ds->core->assembler->bits = obits;
|
||||
ds->core->rasm->bits = obits;
|
||||
gotShortcut = true;
|
||||
}
|
||||
}
|
||||
@ -3712,7 +3712,7 @@ static void ds_print_asmop_payload(RDisasmState *ds, const ut8 *buf) {
|
||||
if (ds->asmop.payload != 0) {
|
||||
r_cons_printf ("\n; .. payload of %d byte(s)", ds->asmop.payload);
|
||||
if (ds->showpayloads) {
|
||||
int mod = ds->asmop.payload % ds->core->assembler->dataalign;
|
||||
int mod = ds->asmop.payload % ds->core->rasm->dataalign;
|
||||
int x;
|
||||
for (x = 0; x < ds->asmop.payload; x++) {
|
||||
r_cons_printf ("\n 0x%02x", buf[ds->oplen + x]);
|
||||
@ -3809,7 +3809,7 @@ static void ds_print_str(RDisasmState *ds, const char *str, int len, ut64 refadd
|
||||
}
|
||||
// do not resolve strings on arm64 pointed with ADRP
|
||||
if (ds->analop.type == R_ANAL_OP_TYPE_LEA) {
|
||||
if (ds->core->assembler->bits == 64 && r_str_startswith (r_config_get (ds->core->config, "asm.arch"), "arm")) {
|
||||
if (ds->core->rasm->bits == 64 && r_str_startswith (r_config_get (ds->core->config, "asm.arch"), "arm")) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -4332,7 +4332,7 @@ static int myregwrite(RAnalEsil *esil, const char *name, ut64 *val) {
|
||||
ignored = true;
|
||||
break;
|
||||
case R_ANAL_OP_TYPE_LEA:
|
||||
if (ds->core->assembler->bits == 64 && r_str_startswith (r_config_get (ds->core->config, "asm.arch"), "arm")) {
|
||||
if (ds->core->rasm->bits == 64 && r_str_startswith (r_config_get (ds->core->config, "asm.arch"), "arm")) {
|
||||
ignored = true;
|
||||
}
|
||||
break;
|
||||
@ -4878,7 +4878,7 @@ static void ds_print_comments_right(RDisasmState *ds) {
|
||||
*op = 0;
|
||||
}
|
||||
r_str_case (locase, 0);
|
||||
desc = r_asm_describe (core->assembler, locase);
|
||||
desc = r_asm_describe (core->rasm, locase);
|
||||
free (locase);
|
||||
}
|
||||
if (ds->show_usercomments || ds->show_comments) {
|
||||
@ -5171,7 +5171,7 @@ R_API int r_core_print_disasm(RPrint *p, RCore *core, ut64 addr, ut8 *buf, int l
|
||||
}
|
||||
toro:
|
||||
// uhm... is this necessary? imho can be removed
|
||||
r_asm_set_pc (core->assembler, r_core_pava (core, ds->addr + idx));
|
||||
r_asm_set_pc (core->rasm, r_core_pava (core, ds->addr + idx));
|
||||
core->cons->vline = r_config_get_i (core->config, "scr.utf8") ? (r_config_get_i (core->config, "scr.utf8.curvy") ? r_vline_uc : r_vline_u) : r_vline_a;
|
||||
|
||||
if (core->print->cur_enabled) {
|
||||
@ -5249,13 +5249,13 @@ toro:
|
||||
ds->printed_flag_addr = UT64_MAX;
|
||||
// XXX. this must be done in ds_update_pc()
|
||||
// ds_update_pc (ds, ds->at);
|
||||
r_asm_set_pc (core->assembler, ds->at);
|
||||
r_asm_set_pc (core->rasm, ds->at);
|
||||
ds_update_ref_lines (ds);
|
||||
r_anal_op_fini (&ds->analop);
|
||||
r_anal_op (core->anal, &ds->analop, ds->at, buf + addrbytes * idx, (int)(len - addrbytes * idx), R_ANAL_OP_MASK_ALL);
|
||||
if (ds_must_strip (ds)) {
|
||||
inc = ds->analop.size;
|
||||
// inc = ds->asmop.payload + (ds->asmop.payload % ds->core->assembler->dataalign);
|
||||
// inc = ds->asmop.payload + (ds->asmop.payload % ds->core->rasm->dataalign);
|
||||
r_anal_op_fini (&ds->analop);
|
||||
continue;
|
||||
}
|
||||
@ -5471,13 +5471,13 @@ toro:
|
||||
ret = ds_print_middle (ds, ret);
|
||||
|
||||
ds_print_asmop_payload (ds, buf + addrbytes * idx);
|
||||
if (core->assembler->syntax != R_ASM_SYNTAX_INTEL) {
|
||||
if (core->rasm->syntax != R_ASM_SYNTAX_INTEL) {
|
||||
RAsmOp ao; /* disassemble for the vm .. */
|
||||
int os = core->assembler->syntax;
|
||||
r_asm_set_syntax (core->assembler, R_ASM_SYNTAX_INTEL);
|
||||
r_asm_disassemble (core->assembler, &ao, buf + addrbytes * idx,
|
||||
int os = core->rasm->syntax;
|
||||
r_asm_set_syntax (core->rasm, R_ASM_SYNTAX_INTEL);
|
||||
r_asm_disassemble (core->rasm, &ao, buf + addrbytes * idx,
|
||||
len - addrbytes * idx + 5);
|
||||
r_asm_set_syntax (core->assembler, os);
|
||||
r_asm_set_syntax (core->rasm, os);
|
||||
}
|
||||
if (mi_type == R_META_TYPE_FORMAT) {
|
||||
if ((ds->show_comments || ds->show_usercomments) && ds->show_comment_right) {
|
||||
@ -5511,13 +5511,13 @@ toro:
|
||||
ret = ds_print_middle (ds, ret);
|
||||
|
||||
ds_print_asmop_payload (ds, buf + addrbytes * idx);
|
||||
if (core->assembler->syntax != R_ASM_SYNTAX_INTEL) {
|
||||
if (core->rasm->syntax != R_ASM_SYNTAX_INTEL) {
|
||||
RAsmOp ao; /* disassemble for the vm .. */
|
||||
int os = core->assembler->syntax;
|
||||
r_asm_set_syntax (core->assembler, R_ASM_SYNTAX_INTEL);
|
||||
r_asm_disassemble (core->assembler, &ao, buf + addrbytes * idx,
|
||||
int os = core->rasm->syntax;
|
||||
r_asm_set_syntax (core->rasm, R_ASM_SYNTAX_INTEL);
|
||||
r_asm_disassemble (core->rasm, &ao, buf + addrbytes * idx,
|
||||
len - addrbytes * idx + 5);
|
||||
r_asm_set_syntax (core->assembler, os);
|
||||
r_asm_set_syntax (core->rasm, os);
|
||||
}
|
||||
if (ds->show_bytes_right && ds->show_bytes) {
|
||||
ds_comment (ds, true, "");
|
||||
@ -5580,7 +5580,7 @@ toro:
|
||||
if (inc < 1) {
|
||||
inc = 1;
|
||||
}
|
||||
inc += ds->asmop.payload + (ds->asmop.payload % ds->core->assembler->dataalign);
|
||||
inc += ds->asmop.payload + (ds->asmop.payload % ds->core->rasm->dataalign);
|
||||
}
|
||||
r_anal_op_fini (&ds->analop);
|
||||
|
||||
@ -5732,10 +5732,10 @@ R_API int r_core_print_disasm_instructions(RCore *core, int nb_bytes, int nb_opc
|
||||
}
|
||||
ds->hint = r_core_hint_begin (core, ds->hint, ds->at);
|
||||
ds->has_description = false;
|
||||
r_asm_set_pc (core->assembler, ds->at);
|
||||
r_asm_set_pc (core->rasm, ds->at);
|
||||
// XXX copypasta from main disassembler function
|
||||
// r_anal_get_fcn_in (core->anal, ds->at, R_ANAL_FCN_TYPE_NULL);
|
||||
ret = r_asm_disassemble (core->assembler, &ds->asmop,
|
||||
ret = r_asm_disassemble (core->rasm, &ds->asmop,
|
||||
core->block + addrbytes * i, core->blocksize - addrbytes * i);
|
||||
ds->oplen = ret;
|
||||
if (ds->midflags) {
|
||||
@ -5944,7 +5944,7 @@ R_API int r_core_print_disasm_json(RCore *core, ut64 addr, ut8 *buf, int nb_byte
|
||||
|
||||
at = addr + k;
|
||||
ds->hint = r_core_hint_begin (core, ds->hint, ds->at);
|
||||
r_asm_set_pc (core->assembler, at);
|
||||
r_asm_set_pc (core->rasm, at);
|
||||
// 32 is the biggest opcode length in intel
|
||||
// Make sure we have room for it
|
||||
if (dis_opcodes == 1 && i >= nb_bytes - 32) {
|
||||
@ -5961,7 +5961,7 @@ R_API int r_core_print_disasm_json(RCore *core, ut64 addr, ut8 *buf, int nb_byte
|
||||
break;
|
||||
}
|
||||
memset (&asmop, 0, sizeof (RAsmOp));
|
||||
ret = r_asm_disassemble (core->assembler, &asmop, buf + i, nb_bytes - i);
|
||||
ret = r_asm_disassemble (core->rasm, &asmop, buf + i, nb_bytes - i);
|
||||
if (ret < 1) {
|
||||
pj_o (pj);
|
||||
pj_kn (pj, "offset", at);
|
||||
@ -6150,8 +6150,8 @@ R_API int r_core_print_disasm_json(RCore *core, ut64 addr, ut8 *buf, int nb_byte
|
||||
}
|
||||
|
||||
pj_end (pj);
|
||||
i += ds->oplen + asmop.payload + (ds->asmop.payload % ds->core->assembler->dataalign); // bytes
|
||||
k += ds->oplen + asmop.payload + (ds->asmop.payload % ds->core->assembler->dataalign); // delta from addr
|
||||
i += ds->oplen + asmop.payload + (ds->asmop.payload % ds->core->rasm->dataalign); // bytes
|
||||
k += ds->oplen + asmop.payload + (ds->asmop.payload % ds->core->rasm->dataalign); // delta from addr
|
||||
j++; // instructions
|
||||
line++;
|
||||
|
||||
@ -6195,11 +6195,11 @@ R_API int r_core_print_disasm_all(RCore *core, ut64 addr, int l, int len, int mo
|
||||
for (i = 0; i < l; i++) {
|
||||
ds->at = addr + i;
|
||||
ds->vat = r_core_pava (core, ds->at);
|
||||
r_asm_set_pc (core->assembler, ds->vat);
|
||||
r_asm_set_pc (core->rasm, ds->vat);
|
||||
if (r_cons_is_breaked ()) {
|
||||
break;
|
||||
}
|
||||
ret = r_asm_disassemble (core->assembler, &asmop, buf + i, l - i);
|
||||
ret = r_asm_disassemble (core->rasm, &asmop, buf + i, l - i);
|
||||
if (ret < 1) {
|
||||
switch (mode) {
|
||||
case 'j':
|
||||
@ -6448,8 +6448,8 @@ toro:
|
||||
break;
|
||||
}
|
||||
}
|
||||
r_asm_set_pc (core->assembler, core->offset + i);
|
||||
ret = r_asm_disassemble (core->assembler, &asmop, core->block + addrbytes * i,
|
||||
r_asm_set_pc (core->rasm, core->offset + i);
|
||||
ret = r_asm_disassemble (core->rasm, &asmop, core->block + addrbytes * i,
|
||||
core->blocksize - addrbytes * i);
|
||||
if (midflags || midbb) {
|
||||
RDisasmState ds = {
|
||||
|
@ -78,7 +78,7 @@ R_API bool r_core_hack_arm64(RCore *core, const char *op, const RAnalOp *analop)
|
||||
return true;
|
||||
}
|
||||
R_API bool r_core_hack_arm(RCore *core, const char *op, const RAnalOp *analop) {
|
||||
const int bits = core->assembler->bits;
|
||||
const int bits = core->rasm->bits;
|
||||
const ut8 *b = core->block;
|
||||
|
||||
if (!strcmp (op, "nop")) {
|
||||
@ -266,7 +266,7 @@ R_API bool r_core_hack_x86(RCore *core, const char *op, const RAnalOp *analop) {
|
||||
R_API int r_core_hack(RCore *core, const char *op) {
|
||||
bool (*hack)(RCore *core, const char *op, const RAnalOp *analop) = NULL;
|
||||
const char *asmarch = r_config_get (core->config, "asm.arch");
|
||||
const int asmbits = core->assembler->bits;
|
||||
const int asmbits = core->rasm->bits;
|
||||
|
||||
if (!asmarch) {
|
||||
return false;
|
||||
|
@ -36,7 +36,7 @@ CB (debug, dbg)
|
||||
CB (bp, dbg->bp)
|
||||
CB (lang, lang)
|
||||
CB (anal, anal)
|
||||
CB (asm, assembler)
|
||||
CB (asm, rasm)
|
||||
CB (parse, parser)
|
||||
CB (bin, bin)
|
||||
CB (egg, egg)
|
||||
|
@ -1630,7 +1630,7 @@ void __fix_cursor_down(RCore *core) {
|
||||
//XXX: ugly hack
|
||||
for (i = 0; i < 2; i++) {
|
||||
RAsmOp op;
|
||||
int sz = r_asm_disassemble (core->assembler,
|
||||
int sz = r_asm_disassemble (core->rasm,
|
||||
&op, core->block, 32);
|
||||
if (sz < 1) {
|
||||
sz = 1;
|
||||
|
@ -30,8 +30,8 @@ static int readline_callback(void *_a, const char *str) {
|
||||
" this assembler supports various directives like .hex ...\n");
|
||||
} else {
|
||||
r_asm_code_free (a->acode);
|
||||
r_asm_set_pc (a->core->assembler, a->off);
|
||||
a->acode = r_asm_massemble (a->core->assembler, str);
|
||||
r_asm_set_pc (a->core->rasm, a->off);
|
||||
a->acode = r_asm_massemble (a->core->rasm, str);
|
||||
if (a->acode) {
|
||||
char* hex = r_asm_code_get_hex (a->acode);
|
||||
r_cons_printf ("[VA:%d]> %s\n", a->acode? a->acode->len: 0, str);
|
||||
|
@ -200,7 +200,7 @@ static const char *stackPrintCommand(RCore *core) {
|
||||
if (r_config_get_i (core->config, "stack.bytes")) {
|
||||
return "px";
|
||||
}
|
||||
switch (core->assembler->bits) {
|
||||
switch (core->rasm->bits) {
|
||||
case 64: return "pxq"; break;
|
||||
case 32: return "pxw"; break;
|
||||
}
|
||||
@ -399,7 +399,7 @@ static void rotateAsmBits(RCore *core) {
|
||||
bits == 32 ? 64:
|
||||
bits == 16 ? 32:
|
||||
bits == 8 ? 16: bits;
|
||||
if ((core->assembler->cur->bits & nb) == nb) {
|
||||
if ((core->rasm->cur->bits & nb) == nb) {
|
||||
r_core_cmdf (core, "ahb %d", nb);
|
||||
break;
|
||||
}
|
||||
@ -1145,7 +1145,7 @@ static void setprintmode(RCore *core, int n) {
|
||||
case R_CORE_VISUAL_MODE_PD:
|
||||
case R_CORE_VISUAL_MODE_DB:
|
||||
r_asm_op_init (&op);
|
||||
r_asm_disassemble (core->assembler, &op, core->block, R_MIN (32, core->blocksize));
|
||||
r_asm_disassemble (core->rasm, &op, core->block, R_MIN (32, core->blocksize));
|
||||
r_asm_op_fini (&op);
|
||||
break;
|
||||
default:
|
||||
@ -1803,7 +1803,7 @@ static void cursor_nextrow(RCore *core, bool use_ocur) {
|
||||
return;
|
||||
}
|
||||
if (next_roff + 32 < core->blocksize) {
|
||||
sz = r_asm_disassemble (core->assembler, &op,
|
||||
sz = r_asm_disassemble (core->rasm, &op,
|
||||
core->block + next_roff, 32);
|
||||
if (sz < 1) {
|
||||
sz = 1;
|
||||
@ -1891,7 +1891,7 @@ static void cursor_prevrow(RCore *core, bool use_ocur) {
|
||||
RAsmOp op;
|
||||
prev_roff = 0;
|
||||
r_core_seek (core, prev_addr, true);
|
||||
prev_sz = r_asm_disassemble (core->assembler, &op,
|
||||
prev_sz = r_asm_disassemble (core->rasm, &op,
|
||||
core->block, 32);
|
||||
}
|
||||
} else {
|
||||
@ -1953,7 +1953,7 @@ static bool fix_cursor(RCore *core) {
|
||||
reset_print_cur (p);
|
||||
} else if ((!cur_is_visible && is_close) || !off_is_visible) {
|
||||
RAsmOp op;
|
||||
int sz = r_asm_disassemble (core->assembler,
|
||||
int sz = r_asm_disassemble (core->rasm,
|
||||
&op, core->block, 32);
|
||||
if (sz < 1) {
|
||||
sz = 1;
|
||||
@ -2973,7 +2973,7 @@ R_API int r_core_visual_cmd(RCore *core, const char *arg) {
|
||||
if (isDisasmPrint (core->printidx)) {
|
||||
if (core->print->screen_bounds == core->offset) {
|
||||
ut64 addr = core->print->screen_bounds;
|
||||
addr += r_asm_disassemble (core->assembler, &op, core->block, 32);
|
||||
addr += r_asm_disassemble (core->rasm, &op, core->block, 32);
|
||||
}
|
||||
if (addr == core->offset || addr == UT64_MAX) {
|
||||
addr = core->offset + 48;
|
||||
@ -3271,7 +3271,7 @@ R_API int r_core_visual_cmd(RCore *core, const char *arg) {
|
||||
if (core->seltab) {
|
||||
const char *creg = core->dbg->creg;
|
||||
if (creg) {
|
||||
int delta = core->assembler->bits / 8;
|
||||
int delta = core->rasm->bits / 8;
|
||||
r_core_cmdf (core, "dr %s = %s-%d\n", creg, creg, delta);
|
||||
}
|
||||
} else {
|
||||
@ -3314,7 +3314,7 @@ R_API int r_core_visual_cmd(RCore *core, const char *arg) {
|
||||
if (core->seltab) {
|
||||
const char *creg = core->dbg->creg;
|
||||
if (creg) {
|
||||
int delta = core->assembler->bits / 8;
|
||||
int delta = core->rasm->bits / 8;
|
||||
r_core_cmdf (core, "dr %s = %s+%d\n", creg, creg, delta);
|
||||
}
|
||||
} else {
|
||||
@ -4117,8 +4117,8 @@ R_API void r_core_visual_disasm_down(RCore *core, RAsmOp *op, int *cols) {
|
||||
if (f && f->folded) {
|
||||
*cols = core->offset - r_anal_function_max_addr (f);
|
||||
} else {
|
||||
r_asm_set_pc (core->assembler, core->offset);
|
||||
*cols = r_asm_disassemble (core->assembler,
|
||||
r_asm_set_pc (core->rasm, core->offset);
|
||||
*cols = r_asm_disassemble (core->rasm,
|
||||
op, core->block, 32);
|
||||
if (midflags || midbb) {
|
||||
int skip_bytes_flag = 0, skip_bytes_bb = 0;
|
||||
|
@ -147,7 +147,7 @@ R_API bool r_core_visual_esil(RCore *core) {
|
||||
for (;;) {
|
||||
r_cons_clear00 ();
|
||||
// bool use_color = core->print->flags & R_PRINT_FLAGS_COLOR;
|
||||
(void) r_asm_disassemble (core->assembler, &asmop, buf, sizeof (ut64));
|
||||
(void) r_asm_disassemble (core->rasm, &asmop, buf, sizeof (ut64));
|
||||
analop.type = -1;
|
||||
(void)r_anal_op (core->anal, &analop, core->offset, buf, sizeof (ut64), R_ANAL_OP_MASK_ESIL);
|
||||
analopType = analop.type & R_ANAL_OP_TYPE_MASK;
|
||||
@ -293,7 +293,7 @@ R_API bool r_core_visual_bit_editor(RCore *core) {
|
||||
for (;;) {
|
||||
r_cons_clear00 ();
|
||||
bool use_color = core->print->flags & R_PRINT_FLAGS_COLOR;
|
||||
(void) r_asm_disassemble (core->assembler, &asmop, buf, sizeof (ut64));
|
||||
(void) r_asm_disassemble (core->rasm, &asmop, buf, sizeof (ut64));
|
||||
analop.type = -1;
|
||||
(void)r_anal_op (core->anal, &analop, core->offset, buf, sizeof (ut64), R_ANAL_OP_MASK_ESIL);
|
||||
analopType = analop.type & R_ANAL_OP_TYPE_MASK;
|
||||
@ -1618,7 +1618,7 @@ R_API int r_core_visual_view_rop(RCore *core) {
|
||||
RStrBuf *sb = r_strbuf_new ("");
|
||||
char *msg;
|
||||
r_list_foreach (core->ropchain, iter, msg) {
|
||||
if (core->assembler->bits == 64) {
|
||||
if (core->rasm->bits == 64) {
|
||||
ut64 n = r_num_get (NULL, msg);
|
||||
n = r_read_be64 (&n);
|
||||
r_strbuf_appendf (sb, "%016"PFMT64x, n);
|
||||
|
@ -262,7 +262,7 @@ typedef struct r_core_t {
|
||||
RCmdDescriptor root_cmd_descriptor;
|
||||
RList/*<RCmdDescriptor>*/ *cmd_descriptors;
|
||||
RAnal *anal;
|
||||
RAsm *assembler;
|
||||
RAsm *rasm;
|
||||
/* ^^ */
|
||||
RCoreTimes *times;
|
||||
RParse *parser;
|
||||
|
@ -237,20 +237,19 @@ static int cb(RDiff *d, void *user, RDiffOp *op) {
|
||||
printf ("\n");
|
||||
if (core) {
|
||||
int len = R_MAX (4, op->a_len);
|
||||
RAsmCode *ac = r_asm_mdisassemble (core->assembler, op->a_buf, len);
|
||||
RAsmCode *ac = r_asm_mdisassemble (core->rasm, op->a_buf, len);
|
||||
char *acbufasm = strdup (ac->assembly);
|
||||
if (quiet) {
|
||||
char *bufasm = r_str_prefix_all (acbufasm, "- ");
|
||||
printf ("%s\n", bufasm);
|
||||
free (bufasm);
|
||||
free (acbufasm);
|
||||
} else {
|
||||
char *bufasm = r_str_prefix_all (acbufasm, Color_RED"- ");
|
||||
printf ("%s"Color_RESET, bufasm);
|
||||
free (bufasm);
|
||||
free (acbufasm);
|
||||
}
|
||||
// r_asm_code_free (ac);
|
||||
free (acbufasm);
|
||||
r_asm_code_free (ac);
|
||||
}
|
||||
} else {
|
||||
printf ("0x%08"PFMT64x " ", op->a_off);
|
||||
@ -270,7 +269,7 @@ static int cb(RDiff *d, void *user, RDiffOp *op) {
|
||||
printf ("\n");
|
||||
if (core) {
|
||||
int len = R_MAX (4, op->b_len);
|
||||
RAsmCode *ac = r_asm_mdisassemble (core->assembler, op->b_buf, len);
|
||||
RAsmCode *ac = r_asm_mdisassemble (core->rasm, op->b_buf, len);
|
||||
char *acbufasm = strdup (ac->assembly);
|
||||
if (quiet) {
|
||||
char *bufasm = r_str_prefix_all (acbufasm, "+ ");
|
||||
|
Loading…
Reference in New Issue
Block a user