synchronize disassembly formats

This commit is contained in:
Anthony Pesch 2017-08-24 18:22:46 -04:00
parent 427e5d64f7
commit 6b77942ee4
3 changed files with 7 additions and 5 deletions

View File

@ -513,10 +513,12 @@ static void x64_backend_dump_code(struct jit_backend *base, const uint8_t *addr,
fprintf(output, "# x64\n");
fprintf(output, "#==--------------------------------------------------==#\n");
const int max_mnemonic_width = 8;
for (size_t i = 0; i < count; i++) {
cs_insn &insn = insns[i];
fprintf(output, "# 0x%" PRIx64 ":\t%s\t\t%s\n", insn.address, insn.mnemonic,
insn.op_str);
fprintf(output, "# 0x%08" PRIx64 " %-*s %s\n", insn.address,
max_mnemonic_width, insn.mnemonic, insn.op_str);
}
cs_free(insns, count);

View File

@ -138,7 +138,7 @@ void armv3_format(uint32_t addr, uint32_t instr, char *buffer,
size_t value_len;
/* copy initial formatted description */
snprintf(buffer, buffer_size, "%4x: %08x %s", addr, i.raw, def->desc);
snprintf(buffer, buffer_size, "0x%08x %s", addr, def->desc);
/* cond */
int cond = i.raw >> 28;

View File

@ -62,7 +62,7 @@ void sh4_format(uint32_t addr, union sh4_instr i, char *buffer,
struct jit_opdef *def = sh4_get_opdef(i.raw);
if (def->flags & SH4_FLAG_INVALID) {
snprintf(buffer, buffer_size, "%08x .word 0x%04x", addr, i.raw);
snprintf(buffer, buffer_size, "0x%08x .word 0x%04x", addr, i.raw);
return;
}
@ -72,7 +72,7 @@ void sh4_format(uint32_t addr, union sh4_instr i, char *buffer,
uint32_t pcmask;
/* copy initial formatted description */
snprintf(buffer, buffer_size, "%08x %s", addr, def->desc);
snprintf(buffer, buffer_size, "0x%08x %s", addr, def->desc);
/* used by mov operators with displacements */
if (strnstr(buffer, ".b", buffer_size)) {