From 1c01b00d87e45c7ae8eb6320b20e7dcf67915d77 Mon Sep 17 00:00:00 2001 From: Mason Reed Date: Thu, 10 Jul 2025 01:32:32 -0400 Subject: Move LLIL instruction retrieval into the LLIL function where it belongs The python API was kept the same seeing as we are close to the release, will likely start deprecating some of those API's soon. --- lowlevelil.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'lowlevelil.cpp') diff --git a/lowlevelil.cpp b/lowlevelil.cpp index 33dea219..dd3989f1 100644 --- a/lowlevelil.cpp +++ b/lowlevelil.cpp @@ -96,6 +96,29 @@ size_t LowLevelILFunction::GetInstructionStart(Architecture* arch, uint64_t addr return BNLowLevelILGetInstructionStart(m_object, arch ? arch->GetObject() : nullptr, addr); } +std::set LowLevelILFunction::GetInstructionsAt(Architecture *arch, uint64_t addr) +{ + size_t count; + size_t* instructions = BNLowLevelILGetInstructionsAt(m_object, arch ? arch->GetObject() : nullptr, addr, &count); + std::set result; + for (size_t i = 0; i < count; i++) + result.insert(instructions[i]); + BNFreeILInstructionList(instructions); + return result; +} + +std::vector LowLevelILFunction::GetExitsForInstruction(size_t i) +{ + size_t count; + size_t* instructions = BNLowLevelILGetExitsForInstruction(m_object, i, &count); + std::vector result; + result.reserve(count); + for (size_t j = 0; j < count; j++) + result.push_back(instructions[j]); + BNFreeILInstructionList(instructions); + return result; +} + void LowLevelILFunction::ClearIndirectBranches() { -- cgit v1.3.1