Skip to content

Commit

Permalink
Fix logs and invalid decodes
Browse files Browse the repository at this point in the history
  • Loading branch information
Rot127 committed Nov 5, 2024
1 parent 6b924c7 commit 3d552c6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions librz/arch/isa/hexagon/hexagon_arch.c
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ RZ_API HexPkt *hex_get_pkt(RZ_BORROW HexState *state, const ut32 addr) {
}
}
}
RZ_LOG_DEBUG("Failed to get packet at 0x%" PFMT32x, addr);
RZ_LOG_DEBUG("Failed to get packet at 0x%" PFMT32x "\n", addr);
return NULL;
}

Expand Down Expand Up @@ -1152,7 +1152,7 @@ static RZ_BORROW HexInsnContainer *decode_hic(HexState *state, HexReversedOpcode
// Add to state as not yet fully decoded packet.
HexInsnContainer *hic = hex_add_hic_to_state(state, &hic_new);
if (!hic) {
RZ_LOG_ERROR("Could not add incsturction container to state.\n");
RZ_LOG_ERROR("Could not add instruction container to state.\n");
return NULL;
}
HexPkt *p = hex_get_pkt(state, hic->addr);
Expand Down
4 changes: 3 additions & 1 deletion librz/arch/p/analysis/analysis_hexagon.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ RZ_API int hexagon_v6_op(RzAnalysis *analysis, RzAnalysisOp *op, ut64 addr, cons

// Disassemble as many instructions as possible from the buffer.
HexReversedOpcode rev = { .action = HEXAGON_ANALYSIS, .ana_op = op, .asm_op = NULL, .state = NULL, .pkt_fully_decoded = false, .bytes_buf = buf, .bytes_buf_len = len };
hexagon_reverse_opcode(&rev, addr, NULL, analysis);
if (!hexagon_reverse_opcode(&rev, addr, NULL, analysis)) {
return -1;
}
if (mask & RZ_ANALYSIS_OP_MASK_IL) {
op->il_op = hex_get_il_op(addr, rev.pkt_fully_decoded, rev.state);
}
Expand Down
4 changes: 3 additions & 1 deletion librz/arch/p/asm/asm_hexagon.c
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,9 @@ static int disassemble(RzAsm *a, RzAsmOp *op, const ut8 *buf, int l) {

ut32 addr = (ut32)a->pc;
HexReversedOpcode rev = { .action = HEXAGON_DISAS, .ana_op = NULL, .asm_op = op, .state = NULL, .pkt_fully_decoded = false, .bytes_buf = buf, .bytes_buf_len = l };
hexagon_reverse_opcode(&rev, addr, a, NULL);
if (!hexagon_reverse_opcode(&rev, addr, a, NULL)) {
rz_strbuf_append(&op->buf_asm, "invalid");
}
return HEX_INSN_SIZE;
}

Expand Down

0 comments on commit 3d552c6

Please sign in to comment.