Improve pdR results in a quick and dirty way

This commit is contained in:
pancake 2018-03-09 02:01:05 +01:00
parent cd719d120b
commit e553927a41
2 changed files with 32 additions and 3 deletions

View File

@ -34,11 +34,10 @@ static char *entitlements(RBinFile *bf, bool json) {
static void * load_bytes(RBinFile *bf, const ut8 *buf, ut64 sz, ut64 loadaddr, Sdb *sdb){
struct MACH0_(obj_t) *res = NULL;
RBuffer *tbuf = NULL;
if (!buf || !sz || sz == UT64_MAX) {
return NULL;
}
tbuf = r_buf_new ();
RBuffer *tbuf = r_buf_new ();
r_buf_set_bytes (tbuf, buf, sz);
res = MACH0_(new_buf) (tbuf, bf->rbin->verbose);
if (res) {

View File

@ -2864,7 +2864,7 @@ dsmap {
#endif
#define P(x) (core->cons && core->cons->pal.x)? core->cons->pal.x
static void disasm_recursive(RCore *core, ut64 addr, char type_print) {
static void disasm_recursive_old(RCore *core, ut64 addr, char type_print) {
bool push[512];
int pushes = 0;
RAnalOp aop = {0};
@ -2875,6 +2875,7 @@ static void disasm_recursive(RCore *core, ut64 addr, char type_print) {
}
ut8 *raw = calloc (core->blocksize, 1); // instruction coverage
if (!raw) {
free (buf);
return;
}
int count = 64;
@ -2978,6 +2979,35 @@ r_cons_printf ("base:\n");
}
#endif
}
static void disasm_recursive(RCore *core, ut64 addr, char type_print) {
bool push[512];
RAnalOp aop = {0};
int i, j, ret;
ut8 buf[128];
int count = 64; // must be user-defined
int base = 0;
while (count-- > 0) {
r_io_read_at (core->io, addr, buf, sizeof (buf));
r_anal_op_fini (&aop);
ret = r_anal_op (core->anal, &aop, addr, buf, sizeof (buf));
if (ret < 0 || aop.size < 1) {
addr++;
continue;
}
buf[i] = 1;
r_core_cmdf (core, "pD %d @ 0x%08"PFMT64x, aop.size, addr);
// r_core_cmdf (core, "pd 1 @ 0x%08"PFMT64x, addr);
switch (aop.type) {
case R_ANAL_OP_TYPE_JMP:
addr = aop.jump;
continue;
break;
case R_ANAL_OP_TYPE_UCJMP:
break;
}
addr += aop.size;
}
}
#if 0
static void _disasm_recursive(RCore *core, ut64 addr, char type_print) {