trace_data_flow
Traces C/C++ data flow from a type to a target function by analyzing call paths across translation units, using libclang to find functions by type signature and map the full call graph.
Instructions
Trace how C/C++ data of a given type flows to a target function via libclang call paths. libclang-powered: finds functions by type signature and maps call paths through the full call graph, which text-based search cannot trace across translation units.
Finds functions whose signature mentions type_name, then looks for call paths from those functions to to_symbol. Returns a data flow map — useful for understanding how a data structure travels through the system to its destination.
Works best for synchronous driver stacks (e.g. sensor read → I2C write).
Cannot follow async flows (message queues, interrupts, RS485 callbacks).
For exact call-graph queries use the find_* family;
verify specific paths with find_call_path.
Read-only. No side effects. Requires the reference index
(fw-context index — refs on by default).
Args:
type_name: Type name to trace. E.g. 'SensorData' or
'Config::SensorData'.
to_symbol: Target symbol name. E.g. 'uart_send' or
'UART_DRIVER::send'.
project_root: Project root. Auto-detected if omitted.
max_depth: Maximum call path depth (default 8).
limit: Maximum source functions to trace (default 15).
Returns:
list of dicts with a leading _summary entry:
{_summary (str), _type (str), _target (str)}, followed by source
entries each with: source_name, source_qualified_name, source_kind,
source_file, source_line, caller_count, reachable (bool), and
paths (list of call path dicts — empty when unreachable).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Maximum source functions to trace (default 15). | |
| max_depth | No | Maximum call path depth (default 8). | |
| to_symbol | Yes | Target symbol name. E.g. 'uart_send' or 'UART_DRIVER::send'. | |
| type_name | Yes | Type name to trace. E.g. 'SensorData' or 'Config::SensorData'. | |
| project_root | No | Project root. Auto-detected if omitted. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |