implement LLDB disasm func, pwndbg fallback there when capstone is not available (#2693)

pull/2694/head
patryk4815 11 months ago committed by GitHub
parent 53bc84fe86
commit 8493f9ce3b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -1603,6 +1603,22 @@ class LLDBProcess(pwndbg.dbg_mod.Process):
return sp
@override
def disasm(self, address: int) -> pwndbg.dbg_mod.DisassembledInstruction | None:
instructions = self.target.ReadInstructions(lldb.SBAddress(address, self.target), 1)
if not instructions.IsValid() or instructions.GetSize() == 0:
return None
instr: lldb.SBInstruction = instructions.GetInstructionAtIndex(0)
mnemonic = instr.GetMnemonic(self.target)
operands = instr.GetOperands(self.target)
return {
"addr": instr.GetAddress().GetLoadAddress(self.target),
"asm": f"{mnemonic} {operands}",
"length": instr.GetByteSize(),
}
@override
def is_linux(self) -> bool:
# LLDB will at most tell us if this is a SysV ABI process.

Loading…
Cancel
Save