From 7a184cb8592761c6985fbfb3e20b375d13353d32 Mon Sep 17 00:00:00 2001 From: stephen-f0 <116006802+stephen-f0@users.noreply.github.com> Date: Mon, 29 Dec 2025 16:07:09 +0000 Subject: [PATCH 1/3] Fix disassembly flavour warnings on non- x86 targets --- common/context_handler.py | 6 ++++-- common/instruction_util.py | 8 ++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/common/context_handler.py b/common/context_handler.py index f92901b..c5b6404 100644 --- a/common/context_handler.py +++ b/common/context_handler.py @@ -364,7 +364,9 @@ def display_code(self) -> None: output_line(f"{filename}'{function_name}:") - pre_instructions = extract_instructions(self.target, function_start, pc - 1, self.state.disassembly_syntax)[-3:] + pre_instructions = extract_instructions( + self.target, self.arch, function_start, pc - 1, self.state.disassembly_syntax + )[-3:] print_instructions( self.target, pre_instructions, @@ -381,7 +383,7 @@ def display_code(self) -> None: disassembly_end_address = min(frame_end_address, max_disassembly_end_address) post_instructions = extract_instructions( - self.target, pc, disassembly_end_address, self.state.disassembly_syntax + self.target, self.arch, pc, disassembly_end_address, self.state.disassembly_syntax ) if len(post_instructions) > 0: diff --git a/common/instruction_util.py b/common/instruction_util.py index 2404707..02cc17a 100644 --- a/common/instruction_util.py +++ b/common/instruction_util.py @@ -3,6 +3,7 @@ from lldb import SBAddress, SBInstruction, SBTarget +from arch import BaseArch, I386, X86_64 from common.color_settings import LLEFColorSettings from common.golang.analysis import go_annotate_jumps from common.golang.util import go_context_analysis @@ -11,7 +12,7 @@ def extract_instructions( - target: SBTarget, start_address: int, end_address: int, disassembly_flavour: str + target: SBTarget, arch: BaseArch, start_address: int, end_address: int, disassembly_flavour: str ) -> list[SBInstruction]: """ 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( current = start_address while current <= end_address: address = SBAddress(current, target) - instruction = target.ReadInstructions(address, 1, disassembly_flavour).GetInstructionAtIndex(0) + if isinstance(arch, I386) or isinstance(arch, X86_64): + instruction = target.ReadInstructions(address, 1, disassembly_flavour).GetInstructionAtIndex(0) + else: + instruction = target.ReadInstructions(address, 1).GetInstructionAtIndex(0) instructions.append(instruction) instruction_size = instruction.GetByteSize() if instruction_size > 0: From 6d885569f464579266a9d73e7ff44ed6ebd390dc Mon Sep 17 00:00:00 2001 From: stephen-f0 <116006802+stephen-f0@users.noreply.github.com> Date: Mon, 29 Dec 2025 16:17:04 +0000 Subject: [PATCH 2/3] Sort imports --- common/instruction_util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/instruction_util.py b/common/instruction_util.py index 02cc17a..29c4fc9 100644 --- a/common/instruction_util.py +++ b/common/instruction_util.py @@ -3,7 +3,7 @@ from lldb import SBAddress, SBInstruction, SBTarget -from arch import BaseArch, I386, X86_64 +from arch import I386, X86_64, BaseArch from common.color_settings import LLEFColorSettings from common.golang.analysis import go_annotate_jumps from common.golang.util import go_context_analysis From 2ea01e3e93cd24a4598e79ef89dffd175f03b0f6 Mon Sep 17 00:00:00 2001 From: stephen-f0 <116006802+stephen-f0@users.noreply.github.com> Date: Mon, 29 Dec 2025 16:56:10 +0000 Subject: [PATCH 3/3] arch is not a class instance --- common/instruction_util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/instruction_util.py b/common/instruction_util.py index 29c4fc9..b668c66 100644 --- a/common/instruction_util.py +++ b/common/instruction_util.py @@ -26,7 +26,7 @@ def extract_instructions( current = start_address while current <= end_address: address = SBAddress(current, target) - if isinstance(arch, I386) or isinstance(arch, X86_64): + if arch is I386 or arch is X86_64: instruction = target.ReadInstructions(address, 1, disassembly_flavour).GetInstructionAtIndex(0) else: instruction = target.ReadInstructions(address, 1).GetInstructionAtIndex(0)