Skip to main content
Glama

get_callees

Retrieve all functions called by a specific function in IDA Pro using its address. Simplify reverse engineering by identifying callee functions efficiently.

Instructions

Get all the functions called (callees) by the function at function_address

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
function_addressYesAddress of the function to get callee functions

Implementation Reference

  • Helper function implementing logic to find all unique callees (functions called) from a given function address by scanning call instructions.
    def get_callees(addr: str) -> list[dict]:
        """Get callees for a single function address"""
        try:
            func_start = parse_address(addr)
            func = idaapi.get_func(func_start)
            if not func:
                return []
            func_end = idc.find_func_end(func_start)
            callees: list[dict[str, str]] = []
            current_ea = func_start
            while current_ea < func_end:
                insn = idaapi.insn_t()
                idaapi.decode_insn(insn, current_ea)
                if insn.itype in [idaapi.NN_call, idaapi.NN_callfi, idaapi.NN_callni]:
                    target = idc.get_operand_value(current_ea, 0)
                    target_type = idc.get_operand_type(current_ea, 0)
                    if target_type in [idaapi.o_mem, idaapi.o_near, idaapi.o_far]:
                        func_type = (
                            "internal"
                            if idaapi.get_func(target) is not None
                            else "external"
                        )
                        func_name = idc.get_name(target)
                        if func_name is not None:
                            callees.append(
                                {
                                    "addr": hex(target),
                                    "name": func_name,
                                    "type": func_type,
                                }
                            )
                current_ea = idc.next_head(current_ea, func_end)
    
            unique_callee_tuples = {tuple(callee.items()) for callee in callees}
            unique_callees = [dict(callee) for callee in unique_callee_tuples]
            return unique_callees
        except Exception:
            return []

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/mrexodia/ida-pro-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server