Skip to main content
The SearchCodeResult object represents the result of searching for a code pattern in the binary. It is returned by the ProjectHandle:search_code method and provides information about the matched code region and its instructions.

Fields

FieldDescriptionType
function_addressAddress of the function containing the matched codeAddressValue
start_addressStart address of the matched codeAddressValue
end_addressEnd address of the matched codeAddressValue
insnsTable of matched instructionsInstruction[]

Reference

function_address

The address of the function that contains the matched code region.

start_address

The start address of the matched code region.

end_address

The end address of the matched code region.

insns

A table of Instruction objects representing the instructions in the matched code region.

Example

local result = project:search_code("554889e5................")
if result then
  print("Matched code in function at address:", result.function_address)
  print("Start address:", result.start_address)
  print("End address:", result.end_address)
  for _, insn in ipairs(result.insns) do
    print("Instruction:", insn.mnemonic, "at", insn.address)
  end
end