Skip to content


8315038: Capstone disassembler stops when it sees a bad instruction
Browse files Browse the repository at this point in the history
Reviewed-by: jvernee, shade
  • Loading branch information
Andrew Haley committed Sep 19, 2023
1 parent fab372d commit 670b456
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/utils/hsdis/capstone/hsdis-capstone.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

1 comment on commit 670b456

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.