Fix #13975 - aho issue not showing bytes ##disasm

This commit is contained in:
radare 2019-05-06 18:44:53 +02:00 committed by GitHub
parent b3503ee207
commit f10da2e8ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 11 deletions

View File

@ -259,9 +259,9 @@ R_API RAnalHint *r_anal_hint_from_string(RAnal *a, ut64 addr, const char *str) {
case 'i': hint->immbase = sdb_atoi (nxt); break;
case 'j': hint->jump = sdb_atoi (nxt); break;
case 'f': hint->fail = sdb_atoi (nxt); break;
case 'p': hint->ptr = sdb_atoi (nxt); break;
case 'p': hint->ptr = sdb_atoi (nxt); break;
case 'n': hint->nword = sdb_atoi (nxt); break;
case 'r': hint->ret = sdb_atoi (nxt); break;
case 'r': hint->ret = sdb_atoi (nxt); break;
case 'b': hint->bits = sdb_atoi (nxt); break;
case 'B': hint->new_bits = sdb_atoi (nxt); break;
case 's': hint->size = sdb_atoi (nxt); break;

View File

@ -3,9 +3,7 @@
#include <r_asm.h>
R_API RAsmOp *r_asm_op_new() {
RAsmOp *op = R_NEW (RAsmOp);
r_asm_op_init (op);
return op;
return R_NEW0 (RAsmOp);
}
R_API void r_asm_op_free(RAsmOp *op) {
@ -31,7 +29,6 @@ R_API char *r_asm_op_get_hex(RAsmOp *op) {
int size = r_strbuf_length (&op->buf);
char* str = calloc (size + 1, 2);
r_return_val_if_fail (str, NULL);
r_hex_bin2str ((const ut8*) r_strbuf_get (&op->buf), size, str);
return str;
}

View File

@ -2172,7 +2172,6 @@ static int ds_disassemble(RDisasmState *ds, ut8 *buf, int len) {
if (ds->hint && ds->hint->opcode) {
free (ds->opstr);
ds->opstr = strdup (ds->hint->opcode);
return true;
}
r_asm_op_fini (&ds->asmop);
ret = r_asm_disassemble (core->assembler, &ds->asmop, buf, len);
@ -5373,8 +5372,7 @@ R_API int r_core_print_disasm_instructions(RCore *core, int nb_bytes, int nb_opc
continue;
}
// r_conf = s_printf ("0x%08"PFMT64x" ", core->offset+i);
if (ds->hint && ds->hint->size) {
if (ds->hint && ds->hint->size > 0) {
ret = ds->hint->size;
ds->oplen = ret;
ds->analop.size = ret;
@ -5593,7 +5591,7 @@ R_API int r_core_print_disasm_json(RCore *core, ut64 addr, ut8 *buf, int nb_byte
}
char opstr[256];
strcpy (opstr, r_asm_op_get_asm (&asmop));
r_str_ncpy (opstr, r_asm_op_get_asm (&asmop), sizeof (opstr) - 1);
ds->has_description = false;
r_anal_op_fini (&ds->analop);

View File

@ -186,8 +186,8 @@ R_API char* r_asm_code_get_hex(RAsmCode *acode);
/* op.c */
R_API RAsmOp *r_asm_op_new(void);
R_API void r_asm_op_free(RAsmOp *op);
R_API void r_asm_op_init(RAsmOp *op);
R_API void r_asm_op_free(RAsmOp *op);
R_API void r_asm_op_fini(RAsmOp *op);
R_API char *r_asm_op_get_hex(RAsmOp *op);
R_API char *r_asm_op_get_asm(RAsmOp *op);