Skip to content

Commit

Permalink
better handling of unknown arm instructions in disasm
Browse files Browse the repository at this point in the history
arm instructions are fixed 4-byte sequences, so jump over unknown instructions in word-sized steps
  • Loading branch information
vtjnash committed Jul 8, 2015
1 parent 050eedb commit 6cc4c3c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/disasm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ void jl_dump_asm_internal(uintptr_t Fptr, size_t Fsize, size_t slide,
switch (S) {
case MCDisassembler::Fail:
if (pass != 0)
#if defined(_CPU_PPC_) || defined(_CPU_PPC64_)
#if defined(_CPU_PPC_) || defined(_CPU_PPC64_) || defined(_CPU_ARM_)
stream << "\t.long " << format_hex(*(uint32_t*)(Fptr+Index), 10) << "\n";
#elif defined(_CPU_X86_) || defined(_CPU_X86_64_)
SrcMgr.PrintMessage(SMLoc::getFromPointer((const char*)(Fptr + Index)),
Expand All @@ -527,7 +527,7 @@ void jl_dump_asm_internal(uintptr_t Fptr, size_t Fsize, size_t slide,
stream << "\t.byte " << format_hex(*(uint8_t*)(Fptr+Index), 4) << "\n";
#endif
if (insSize == 0) // skip illegible bytes
#if defined(_CPU_PPC_) || defined(_CPU_PPC64_)
#if defined(_CPU_PPC_) || defined(_CPU_PPC64_) || defined(_CPU_ARM_)
insSize = 4; // instructions are always 4 bytes
#else
insSize = 1; // attempt to slide 1 byte forward
Expand Down

0 comments on commit 6cc4c3c

Please sign in to comment.