8315038: Capstone disassembler stops when it sees a bad instruction

Reviewed-by: jvernee, shade
This commit is contained in:
Andrew Haley 2023-09-19 09:16:57 +00:00
parent fab372d3a2
commit 670b4567cf

@ -150,6 +150,11 @@ void* decode_instructions_virtual(uintptr_t start_va, uintptr_t end_va,
Options ops = parse_options(options, printf_callback, printf_stream);
cs_option(cs_handle, CS_OPT_SYNTAX, ops.intel_syntax ? CS_OPT_SYNTAX_INTEL : CS_OPT_SYNTAX_ATT);
// Turn on SKIPDATA mode to skip broken instructions. HotSpot often
// has embedded data in method bodies, and we need disassembly to
// continue when such non-instructions are not recognized.
cs_option(cs_handle, CS_OPT_SKIPDATA, CS_OPT_ON);
cs_insn *insn;
size_t count = cs_disasm(cs_handle, buffer, length, (uintptr_t) buffer, 0 , &insn);
if (count) {