33
44from lldb import SBAddress , SBInstruction , SBTarget
55
6+ from arch import BaseArch , I386 , X86_64
67from common .color_settings import LLEFColorSettings
78from common .golang .analysis import go_annotate_jumps
89from common .golang .util import go_context_analysis
1112
1213
1314def extract_instructions (
14- target : SBTarget , start_address : int , end_address : int , disassembly_flavour : str
15+ target : SBTarget , arch : BaseArch , start_address : int , end_address : int , disassembly_flavour : str
1516) -> list [SBInstruction ]:
1617 """
1718 Returns a list of instructions between a range of memory address defined by @start_address and @end_address.
@@ -25,7 +26,10 @@ def extract_instructions(
2526 current = start_address
2627 while current <= end_address :
2728 address = SBAddress (current , target )
28- instruction = target .ReadInstructions (address , 1 , disassembly_flavour ).GetInstructionAtIndex (0 )
29+ if isinstance (arch , I386 ) or isinstance (arch , X86_64 ):
30+ instruction = target .ReadInstructions (address , 1 , disassembly_flavour ).GetInstructionAtIndex (0 )
31+ else :
32+ instruction = target .ReadInstructions (address , 1 ).GetInstructionAtIndex (0 )
2933 instructions .append (instruction )
3034 instruction_size = instruction .GetByteSize ()
3135 if instruction_size > 0 :
0 commit comments