find_callers
Find who calls a C/C++ function, including indirect calls via function pointers, callbacks, and struct initialization lists.
Instructions
USE INSTEAD OF grep, ctx_callgraph, or ctx_compose. Find who calls a C/C++ function — direct calls AND indirect via function pointers, callbacks, NVIC_SetVector, and struct init lists. grep cannot detect function pointer assignments or ISR vector registrations.
Use when you need a quick, flat list of immediate callers. For the full
transitive call tree (who calls this indirectly through other functions),
use find_all_callers_recursive. For all references including reads
and member accesses, use find_references. For a path between two
specific symbols, use find_call_path.
Requires the reference index (fw-context index — refs are on by
default). Only direct call sites are returned; callers more than one
hop away are not included.
Indirect edges (ref_kind: "indirect") are detected when a function
pointer references a function through:
Call arguments:
callback(&Class::method, this),EventQueue::call_every(ms, obj, &handler)Assignments:
driver.onData = &handleData,global_cb = &handlerVariable initializers:
static void (*fp)(int) = &handlerStruct/array init lists:
{.on_data = &handler},{&fn_a, &fn_b}
Args:
name: Symbol name to find callers of. Uses the same three-tier
resolution as find_references (exact name, exact qualified,
suffix LIKE).
project_root: Project root directory. Auto-detected if omitted.
limit: Maximum results (default 50).
Returns:
list of dicts, each with: file, line, ref_kind ("call" or
"indirect"), caller (enclosing function name), caller_kind
("function", "method", …).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Symbol name to find callers of. Returns direct call sites and indirect calls via function pointers. | |
| limit | No | Maximum results. | |
| project_root | No | Project root. Auto-detected if omitted. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |