mirror of
https://github.com/radareorg/radare2.git
synced 2025-01-24 14:54:54 +00:00
add ?d. command
This commit is contained in:
parent
1ad95fd468
commit
41a3532f94
@ -1,5 +1,7 @@
|
||||
/* radare - LGPL - Copyright 2009-2014 - pancake */
|
||||
|
||||
#include "r_util.h"
|
||||
|
||||
static void find_refs(RCore *core, const char *glob) {
|
||||
char cmd[128];
|
||||
ut64 curseek = core->offset;
|
||||
@ -266,14 +268,23 @@ static void core_anal_bytes (RCore *core, const ut8 *buf, int len, int nops, int
|
||||
r_asm_set_pc (core->assembler, addr);
|
||||
ret = r_asm_disassemble (core->assembler, &asmop, buf+idx, len-idx);
|
||||
ret = r_anal_op (core->anal, &op, core->offset+idx, buf + idx, len-idx);
|
||||
if (ret<1) {
|
||||
if (ret<1 && fmt!='d') {
|
||||
eprintf ("Oops at 0x%08"PFMT64x" (%02x %02x %02x ...)\n",
|
||||
core->offset+idx, buf[idx],
|
||||
buf[idx+1], buf[idx+2]);
|
||||
break;
|
||||
}
|
||||
size = (hint&&hint->size)? hint->size: op.size;
|
||||
if (fmt =='j') {
|
||||
if (fmt=='d') {
|
||||
char *opname = strdup (asmop.buf_asm);
|
||||
r_str_split (opname, ' ');
|
||||
char *d = r_asm_describe (core->assembler, opname);
|
||||
if (d && *d) {
|
||||
r_cons_printf ("%s: %s\n", opname, d);
|
||||
free (d);
|
||||
} else r_cons_printf ("Unknown opcode\n");
|
||||
free(opname);
|
||||
} else if (fmt=='j') {
|
||||
r_cons_printf ("{\"opcode\": \"%s\",", asmop.buf_asm);
|
||||
if (hint && hint->opcode)
|
||||
r_cons_printf ("\"ophint\": \"%s\",", hint->opcode);
|
||||
|
@ -120,13 +120,16 @@ static int cmd_help(void *data, const char *input) {
|
||||
r_list_free (tmp);
|
||||
break;
|
||||
case 'd':
|
||||
if (input[1]==' '){
|
||||
if (input[1]=='.'){
|
||||
int cur = R_MAX(core->print->cur, 0);
|
||||
core_anal_bytes(core, core->block + cur, core->blocksize, 1, 'd');
|
||||
} else if (input[1]==' '){
|
||||
char *d = r_asm_describe (core->assembler, input+2);
|
||||
if (d && *d) {
|
||||
r_cons_printf ("%s\n", d);
|
||||
free (d);
|
||||
} else eprintf ("Unknown opcode\n");
|
||||
} else eprintf ("Use: ?d [opcode] to get the description of the opcode\n");
|
||||
} else eprintf ("Use: ?d[.] [opcode] to get the description of the opcode\n");
|
||||
break;
|
||||
case 'h':
|
||||
if (input[1]==' ') {
|
||||
@ -494,7 +497,7 @@ static int cmd_help(void *data, const char *input) {
|
||||
"?_", " hudfile", "load hud menu with given file",
|
||||
"?b", " [num]", "show binary value of number",
|
||||
"?b64[-]", " [str]", "encode/decode in base64",
|
||||
"?d", " opcode", "describe opcode for asm.arch",
|
||||
"?d[.]", " opcode", "describe opcode for asm.arch",
|
||||
"?e", " string", "echo string",
|
||||
"?f", " [num] [str]", "map each bit of the number as flag string index",
|
||||
"?h", " [str]", "calculate hash for given string",
|
||||
|
Loading…
x
Reference in New Issue
Block a user