Schema version: v9 (readers also support v7 and v8)
Export creates secondary indexes after bulk insertion, within the same transaction and before publishing the database. Primary keys and uniqueness constraints remain active during insertion. The complete schema is assembled from the same table and index definitions.
See also the README for CLI flags that control what is exported.
analysis_run.schema_version identifies an additive compatibility
family, not a fixed set of capabilities. New tables, indexes, and nullable
or defaulted columns may extend a family while preserving existing columns and their
meaning. Incompatible layouts or meanings require a version bump. This retains
compatibility with earlier v7 exports without forcing re-analysis for readers
that use only the unchanged call-graph data.
Version 8 changes repeated-text storage to a shared dictionary and compatibility views, described in Compact text storage. The query columns and values are unchanged. Current readers support v7 tables and v8 views; consumers must accept either relation type. Older readers that require table objects for these relations must be updated for v8 exports. Re-analysis produces the smaller format; existing databases are not rewritten automatically.
Version 9 preserves these column layouts but makes the public graph lambda-free
and retains the complete graph in raw_* relations. See the authoritative
projection contract for ownership, provenance,
and merge semantics. Readers accept v7, v8 and v9.
Consumers must check the tables or views and columns needed by their query, and account
for database origin and export mode. A version number or an empty table alone
cannot establish that a producer supplied a capability. Source-level inspection
checks its required structures and rejects analysis_run.options_json.stage = "merge"; an ordinary analysis with an empty flow_origins table remains valid.
Optional metadata has explicit fallback behavior below. Re-analysis supplies
new metadata and query indexes; there is no automatic migration from v6.
Call sequencing is such a capability: the cfg_* tables
exist in every v8 export but are filled only by trace analyze --sequencing,
and analysis_run.options_json.call_sequencing (true / false, or
"partial" in a trace-merge output) records which. A reader asks the marker, not the row count: a run with the flag whose
code has no function body also leaves the tables empty. Exports written before
the marker existed lack the key and have no sequencing.
New analyses populate optional linking metadata in minimal and full exports.
linking_facts has one row (id = 1) and a format version. Version 1 stores
all trace_ir::LinkingFacts as JSON in data; readers retain support for it.
Version 2 stores only {"complete": true/false} in data and uses the following
relational tables. Version 3 adds provider views and guessed parameter tags;
new analysis and merge outputs write version 3. No payload is compressed.
| Table | Stored information |
|---|---|
link_class_facts |
ordinal, class name_id, definition/final flag bits 0/1 |
link_alias_facts |
ordinal, alias name_id, JSON type-shape type_id |
link_base_facts |
ordinal, derived/base name IDs |
link_template_facts, link_idl_facts |
ordinal and an interned JSON fact ID |
link_method_facts |
existing fn_id, ordinal, nullable JSON parameter-shape ID, virtual/final/static/variadic flag bits 0–3 |
link_method_origins |
fn_id, origin ordinal, interned defining-analysis origin ID |
link_method_guesses (v3) |
fn_id, interned guessed parameter-tag name; source uncertainty, including nested pointer/array/function shapes |
link_views (v3) |
view ID and interned original analysis-origin ID |
link_view_classes (v3) |
view ID, class name ID, class-final flag |
link_view_methods (v3) |
view ID, fn_id, method-final flag in that source view |
link_dispatch_queries |
shared query ID, member name_id, receiver name ID, nullable selected callee_fn_id, receiver-declared/exact/implicit flag bits 0–2, origin ID |
link_member_calls |
existing call_site_id, ordinal, shared query ID, nullable source_site_id (NULL means the call itself) |
link_ipc_senders |
existing sending fn_id |
All text/type-shape/fact/origin IDs reference the existing strings dictionary.
Method names and definition status come from functions; caller identities
come from call_sites. They are not copied into the linking tables. Calls
with equal dispatch facts share one query even when they occur at different
positions. A source-site reference groups one invocation's overload/CHA
alternatives. Ordinals preserve fact traversal order; merged call facts use
ascending remapped call-site ID order. New facts qualify unresolved arrow/field
member names with their recorded receiver class; legacy names remain readable.
Sites omitted by normal
call-site export have no linking row; version-1 facts for such sites were
already discarded during merge remapping. Definition origins preserve which
analyses already supplied a body, avoiding redundant expansion on later merges.
Initial analysis exports use root paths as origins. A first-time merger input
qualifies each origin with the input's database content identity; merged outputs
store opaque analysis:<SHA-256 hex> tokens and preserve inherited origins on
later merges. Identical root paths alone do not identify the same snapshot.
Legacy merged inputs keep their existing path-only origins. Aliases, template
bases and IDL interfaces are sorted and deduplicated in merged outputs;
conflicting alias targets remain separate records in canonical order. See the
linking rules for recovery limits.
This is declaration/dispatch metadata, not a saved PAG. trace-merge remaps
identities and retains the facts in its output for later merges; see
linking rules. The header's complete
field remains false when an input lacks facts or was already a partial merge.
An absent header table/row is supported with a MissingLinkingFacts diagnostic.
Unsupported versions, malformed payloads, or missing normalized references are
rejected before replacing output. Mixed version-1, version-2 and version-3
inputs are supported. Older facts infer provider membership from retained body
origins and keep unattributable class-final boundaries open. Undeclared
parameter tags in those older payloads are conservatively treated as guesses;
re-analysis supplies exact source-view and parameter-uncertainty metadata. Core schema v8 and ordinary query views retain their meanings.
Merge metadata records ipc_bridges_added and member_calls_added counts.
No variable bindings, points-to sets, or parcel/value flow are reconstructed.
trace-merge accepts v7, v8 and v9 and structurally validates the exact columns it reads
in files, link_targets, target_sources, target_dependencies, functions,
call_sites, call_edges, diagnostics, and execution_contexts and the
cfg_* tables when present before creating or replacing output.
Earlier v7 databases without newer flow tables or call_sites.callee_var /
return_dst can therefore still be merged. A nominal v7 database missing a
required call-graph column is rejected with a re-analysis diagnostic.
The output uses the shared v8 DDL and records options_json.stage = "merge".
It preserves/remaps those call-graph tables and diagnostics, including call-site
spelling and expansion coordinates, and reconstructs external call edges.
It supports function/call lookup, call graphs, call chains, and editor call
hierarchy.
execution_contexts is optional on input: an input without the table (an
earlier v7 export) still merges and contributes no rows, and the merge records
an info diagnostic with stage = 'merge' naming it
(MissingExecutionContexts); an input that has the table must have every
column the merger reads (kind, entry_fn_id, call_site_id, api_fn_id,
param_index, model, multi_instance, self_concurrent) or it is rejected
like a missing call-graph column. The output carries the rows of the inputs
that have the table, with function and call-site ids remapped, each input's own
multi-instance evidence and receiver_var_id NULL (no variable is carried); a merge-stage diagnostic of that kind marks an output
whose table lists only some inputs' contexts. How rows are combined:
Invariants and linking rules.
The cfg_* tables are read only from an input
whose options_json.call_sequencing is true or "partial"; such an input
must have every column the merger reads in all seven tables or it is rejected
like a missing call-graph column. Their rows carry over with function,
call-site and file ids remapped and row ids renumbered in input order, read
by the same code as trace inspect sequence and written by the same code as
trace analyze's export. The output's
options_json.call_sequencing is true when every input is sequenced,
false when none is (the tables stay empty and no kind strings are added),
and "partial" otherwise; each input without graphs is then named in an
info diagnostic with stage = 'merge' (MissingSequencing). Which graph a
shared header body keeps, and how an event whose sites were not carried is
spliced out: Call sequencing, Merge.
It does not populate variables, types, locations,
points_to, arg_flow_edges, or any flow_* tables. call_sites.callee_var
and return_dst remain NULL because input variable IDs are not remapped.
Creating these structures through shared DDL does not supply their capabilities.
PAG and provenance merging is outside the merger's call-graph contract.
For dataflow inspection, use an original trace analyze database, or analyze
an appropriate combined source tree to produce a database with flow facts.
Neither the CLI source-level view nor the C API raw PAG query can recover
omitted flow data from merger output.
| Table | Minimal (default) | --full-export |
--debug-points-to |
|---|---|---|---|
analysis_run |
✓ | ✓ | ✓ |
files |
✓ | ✓ | ✓ |
link_targets |
✓ | ✓ | ✓ |
target_sources |
✓ | ✓ | ✓ |
target_dependencies |
✓ | ✓ | ✓ |
functions |
✓ | ✓ | ✓ |
call_sites |
filtered | filtered | filtered |
call_edges |
✓ | ✓ | ✓ |
arg_flow_edges |
✓ | ✓ | ✓ |
execution_contexts |
✓ | ✓ | ✓ |
variables |
PAG-referenced | all | PAG-referenced |
flow_nodes |
✓ | ✓ | ✓ |
flow_edges |
✓ | ✓ | ✓ |
flow_memory_access |
✓ | ✓ | ✓ |
types |
✓ | ||
locations |
✓ | ✓ | |
points_to |
✓ | ||
diagnostics |
✓ | ✓ | ✓ |
cfg_* (call sequencing) |
with --sequencing |
with --sequencing |
with --sequencing |
The flow-graph tables (flow_nodes, flow_edges) and the variables they
reference are always exported because trace inspect dataflow and
trace inspect slice work purely off the database.
A row is written to call_sites when any of:
- the site has ≥1 row in
call_edges - the site has ≥1 row in
arg_flow_edges is_direct = 0(indirect / fn-ptr syntax, including unresolved)- a
cfg_event_sitesrow names the site (--sequencingonly), so every call-order event resolves to its call sites in both export modes
Unresolved indirect calls therefore appear in call_sites with zero call_edges.
inspect callgraph displays these sites as unresolved leaves during downward
traversal. A direct site with zero call_edges (a static_cast<T>(x) the
lowering records as a call) is in call_sites only when a call-order event
names it, so the leaves are the indirect sites alone and the call graph reads
the same with and without --sequencing. Their negative IDs exist only in the query result; they are not
function IDs or new rows in call_edges.
Copies with the same caller, callee text and full spelling path/line/column
share one leaf, including shared-header sites copied from multiple merge
inputs. The lowest call-site ID supplies that leaf's query-local ID.
Version 9 makes the existing public relations the lambda-free consumer
interface. It preserves the master column names, order, types, nullability,
keys, and table/view kinds for analysis_run, files, functions, strings,
linking_facts, flow_field_access, execution_contexts, link_*, call_*,
flow_*, and variables. Function IDs, variable IDs, flow-node IDs, source
positions, and string IDs are retained. The meanings change as described
below, so this requires a schema version bump rather than an additive v8
capability. Existing databases are immutable; re-analyze or re-merge to obtain
this interface.
functions excludes generated lambda functions. call_edges contracts each
recorded path from a visible caller through one or more lambdas to the next
visible callee. It stops at visible functions and does not infer invocation
from lexical ownership: an uninvoked lambda creates no call edge. An
immediately invoked lambda is entered by a direct edge from a site whose
public callee_text is <lambda>; raw_call_sites keeps its generated name.
A lambda that reaches no visible callee leaves that site without a public edge.
Nested and
shared lambdas and cycles are supported. A contracted edge retains the first
edge's call site and resolution, expressing reachability without implying
synchronous execution.
Ordinary edges retain their IDs. Contracted edge IDs are deterministic
hashes of the original entering-edge ID and visible target identity; merged
targets use their inherited stable function identities, so adding unrelated
inputs does not renumber unchanged contracted edges. A hash collision rejects
publication instead of assigning an order-dependent ID. Public edges are
deduplicated on (caller_fn_id, callee_fn_id, call_site_id, resolution);
lambda_call_provenance(edge_id, entry_edge_id) maps every public edge to its
original raw_call_edges.id entering edges. One entering edge can have
multiple projected leaves, and a public edge reached via multiple entering
edges links to each one. SQL row order is unspecified; use ORDER BY.
lambda_owners(lambda_fn_id, owner_fn_id) records the enclosing non-lambda
function in the same file and link image. File-scope lambdas have a NULL owner.
Variables and flow nodes retain their IDs and edges; lambda-owned variables
and variable-node ownership are attributed to that enclosing function (or
file scope). Lambda parameters become locals, since they are not parameters
of the enclosing function. Lambda signature bindings in flow_parameters
and lambda-callee return provenance in flow_return_calls remain only in
the raw interface; the underlying value-flow edges are retained. Callable
locations and callback actuals retain their value-flow nodes, but their
lambda function references become NULL rather than falsely referring to the
lexical parent. flow_field_access retains its original nodes and fields.
Body sites in call_sites use the lexical owner while keeping their source
positions. A file-scope lambda's sites use a recorded visible caller when one
exists; otherwise those sites and site-only provenance remain raw-only.
This ownership is descriptive and does not establish call reachability: a site
in a lambda nothing invokes has a row under the enclosing function and no edge.
Whether a function makes a call is a question for call_edges. Each reader of
these rows treats them as follows:
| Reader | What a lifted site means there |
|---|---|
inspect dataflow (text and JSON) |
Lexical: a step's scope is the function the call is written in. Value flow does not imply reachability, as for a function nothing calls. |
inspect calls, callgraph, callchain; the LSP call hierarchy |
Edges only, so an uninvoked lambda adds no call. callgraph's unresolved leaves come from lambda_unresolved_calls. |
inspect sequence |
Absent: lambda graphs and their event sites stay in raw_cfg_*. |
inspect slice, trace-merge, --show-lambdas |
The complete graph: the site keeps its lambda caller, through temporary aliases for every raw_* relation (raw_locations included). |
Generated ::$lambda<line>:<col> name segments are removed from public
dictionary text and from locations.desc; raw strings retain the original text
under the same IDs, and raw_locations keeps the original descriptions. A
lambda's Function or Bound location reads anonymous callable. The
corresponding flow_nodes label uses the same text and its function ID is
null because the callable has no public function entry. A
StringLit location and its string: flow-node label keep their text, which is
the program's own.
Source-level lambda expressions are not removed from source expressions.
execution_contexts projects a lambda entry to each next visible callee,
retaining the scheduling model, entry site, receiver and concurrency evidence.
An entry with no visible leaf remains raw-only. A lambda CFG cannot be spliced
into its lexical parent's control flow, so lambda CFGs remain in raw_cfg_*.
Public linking metadata excludes lambda function identities and retains
visible ownership; full linking always uses the raw facts.
Every original relation has a raw_ counterpart, for example
raw_functions, raw_call_edges, raw_variables, raw_flow_nodes,
raw_execution_contexts, and raw_link_method_facts. These expose the complete
analysis, including original lambda ownership, text, and provenance.
Publication keeps only what the projection changes. A
raw_preimage_<table> table holds the original of each row that was rewritten
or removed, with the source table's secondary indexes, and the keys of rows that
exist only in the public graph (preimage_added = 1). A table the projection
can change has a raw_ view over its untouched public rows plus those
pre-images; other raw relations alias the public table directly. Query raw_*
rather than raw_preimage_*, which holds only part of a relation. Like every
raw_ name, these hold the original lambda names.
Tables publication rewrites without removing rows (strings, locations,
variables_data, flow_nodes_data, link_dispatch_queries) use a single-table raw_ view that
overlays the rewritten columns. The other changed relations are UNION ALL
views. SQLite copies such a view whole when it is on the right of a LEFT JOIN,
when the outer query is aggregate or DISTINCT, or when an ORDER BY term is
not selected, so a complete-graph read should select its ordering columns and
reach those relations by key rather than LEFT JOIN them.
Minimal/full exports and merged outputs share the same publication step.
Foreign keys are verified after publication, and trace-merge also verifies
them before it. References to types are exempt when that table is empty, as
in a default export. A tree with no lambda is not verified, because publication
rewrites nothing there. The check's cost is
measured.
trace-merge reads raw relations when present, including when re-merging a
merged output, so projection never changes linking inputs.
lambda_unresolved_calls stores unresolved-path provenance before lexical
ownership is lifted. Its columns are call_site_id, caller_fn_id,
callee_text, file_id, line, and col. Thus an uninvoked lambda's
unresolved site does not become an unresolved call in its parent. Shared
lambdas may expose an unresolved site under multiple callers. Direct sites
without edges are not unresolved leaves. The working tables and triggers of
the projection are temporary and removed before publication; they are not
public relations.
The CLI uses the public graph by default on v9 snapshots, so
ScheduleAbilityTransaction → HandleAbilityTransaction takes one visible hop
without an option. Both callgraph and callchain accept --show-lambdas to
inspect the complete graph in either direction and every output format.
Existing v7/v8 databases retain their stored graph; re-export or re-merge
to obtain the lambda-free public interface. The Rust helper use_raw_relations
selects the complete relations on a read connection using temporary aliases;
it does not modify the stored
snapshot.
Detailed value slicing reads the complete graph within a temporary scope, so lambda return bindings and asynchronous execution boundaries remain accurate. Its result can name lambda functions; subsequent SQL queries still see the public projection. This does not change the stored public tables or views.
Projection closure is computed once at export time. An edge with a lambda
endpoint is replaced by its contracted paths, and edges that agree on
(caller_fn_id, callee_fn_id, call_site_id, resolution) collapse to the lowest
ID. Every other public edge keeps its row. A snapshot with no lambdas is not
deduplicated. Corpus timings and sizes are in
Compact lambda-free publication.
SELECT caller.name, callee.name, e.resolution, e.call_site_id
FROM call_edges e
JOIN functions caller ON caller.id = e.caller_fn_id
JOIN functions callee ON callee.id = e.callee_fn_id
ORDER BY e.caller_fn_id, e.callee_fn_id, e.id;analysis_run
link_targets ─┬─ target_sources → files
└─ target_dependencies → link_targets
files ─┬─ functions ─┬─ call_sites ─ arg_flow_edges → variables
│ │ (functions.target_id → link_targets)
│ ├─ call_edges → functions (caller and callee)
│ └─ execution_contexts → functions (entry, modelled
│ callee), call_sites (start; NULL for an entry no
│ call site starts), variables (receiver)
├─ variables ─ flow_nodes ─ flow_edges → flow_nodes
└─ variables (type_id → types when exported,
target_id → link_targets)
types
locations (full export or debug)
points_to (debug)
diagnostics
| Column | Type | Description |
|---|---|---|
id |
INTEGER PK | Run id |
trace_version |
TEXT | Full binary identity: package version, source revision, dirty state, and build date |
schema_version |
INTEGER | Compatibility family (currently 7; see contract) |
target_root |
TEXT | Analyzed directory |
created_at |
TEXT | Unix timestamp (seconds) |
options_json |
TEXT | JSON: test_partition, include_paths, defines, dep_roots, ignored_macros, include_points_to, full_detail, model_files, explore, call_sequencing, explore_budget, variants_merged, solver_partial, solver_pops, solve_budget_pops, solve_budget_secs |
test_partition is an object with enabled (boolean) and directories
(array of strings), recording the effective configured name list. Disabled runs
store false and an empty array. Defaults, validation, and precedence are defined in
Declaring-header eligibility.
explore and explore_budget record what the run requested; variants_merged
records how many variant units it actually merged. They come apart: a run can ask
for exploration and find no feasible variant, or be given a zero budget. A
consumer asking whether a database contains cross-variant facts must read
variants_merged, not explore. Compilation databases (#62) can contribute
additional commands for a source without exploration; those additional units
also count. include_paths is the union of paths observed across configurations,
while defines records user overrides, not every per-command macro environment.
solver_partial (false / true), solver_pops, solve_budget_pops (null =
unlimited) and solve_budget_secs (null = no time limit) describe how the
solver run ended. solver_partial: true means the run stopped on its work
budget before reaching the fixpoint; every table then answers a monotone
prefix of the fixpoint — every recorded edge and flow is real, but flows that
had not propagated when the budget hit are absent, so a may-analysis query can
under-report ("no path found" when the true fixpoint has one). The same fact is
recorded as an analyze-stage warning diagnostic (see diagnostics).
Databases exported before this feature have none of the four keys.
| Column | Type | Description |
|---|---|---|
id |
INTEGER PK | File id |
path |
TEXT UNIQUE | Absolute/normalized path |
sha256 |
TEXT | Hash placeholder (may be empty) |
is_dep |
INTEGER | 1 if file resides under a dependency root (--dep), 0 otherwise |
GN inference uses these same tables; origin and precedence rules are defined in Link targets and weak symbols.
Link metadata is exported in every detail mode. Without link-target metadata,
these tables are empty and symbol target_id values are NULL. Incomplete GN
inference exports every target it read as an observation, complete or not,
while symbols keep target_id = NULL: resolution stays whole-tree. A
non-NULL target_id therefore means scoped resolution, and a populated
link_targets alone does not.
| Table | Columns | Meaning |
|---|---|---|
link_targets |
id INTEGER PK, name TEXT, output TEXT |
Link target and its output path |
target_sources |
target_id FK → link_targets, file_id FK → files |
Source membership; the pair is the primary key |
target_dependencies |
target_id FK → link_targets, dependency_id FK → link_targets |
Direct link dependencies; the pair is the primary key |
Indexes: target_sources(file_id), target_dependencies(dependency_id),
and partial indexes on functions(target_id) / variables(target_id) covering
only non-NULL rows, so a run without link metadata builds and stores nothing
for them.
Weak flags and target associations accompany functions in all export modes, and variables whenever those variables are included in the export. These tables and columns are what v5 adds over v4; regenerate an older database to query them.
| Column | Type | Description |
|---|---|---|
id |
INTEGER PK | Function id |
name |
TEXT | Linkage-visible name |
file_id |
INTEGER FK → files |
Defining file (original header if include-originated). For a synthesized external (line_start = 0, is_defined = 0) this is only a resolver scope fallback — an arbitrary call-site file, not a declaration — so file filters must gate on line_start > 0 |
line_start |
INTEGER | Start line (always original-file coordinates via LineMap); 0 iff the function was synthesized (never declared in-tree) |
line_end |
INTEGER | End line of the definition body; equals line_start for prototypes and synthesized externals (both 0 for a synthesized external) |
linkage |
TEXT | external, internal, none |
signature |
TEXT | Normalized function signature with parameter types (e.g. name(int, char*)). Decays top-level array parameters to pointers (int[] -> int*); drops qualifiers (const, volatile) and signedness, representing function pointers as fn_ptr. Used for best-effort C++ overload disambiguation during cross-repository linking |
is_defined |
INTEGER | 1 if a body exists under the analyzed root. 0 rows include prototype-only declarations, synthesized externals (libc/logging backends never declared in-tree), and dependency declarations |
is_dep |
INTEGER | 1 if function originates from a dependency root (--dep), 0 otherwise |
is_weak |
INTEGER | 1 for a weak symbol, 0 otherwise; recorded only for external linkage — a static has none to weaken. |
target_id |
INTEGER FK → link_targets |
Owning link target; NULL when no target is known. |
Index: functions(name)
Header-defined functions are deduplicated across TUs within their link target
at merge time (later copies redirect), so they appear once per origin and target.
For database merging, definitions retain separate image ownership while
shared declarations can have target_id = NULL when their copies belong to
different targets; see Database merger header copies.
| Column | Type | Description |
|---|---|---|
id |
INTEGER PK | Call site id |
caller_fn_id |
INTEGER FK → functions |
Containing function |
file_id |
INTEGER FK → files |
Call spelling file; for a macro-body call, the macro definition file |
line |
INTEGER | Spelling line (original-file coordinates via LineMap) |
col |
INTEGER | Spelling column |
expansion_file_id |
INTEGER FK → files, nullable |
Outermost macro invocation file for a macro-body call |
expansion_line |
INTEGER, nullable | Outermost invocation line |
expansion_col |
INTEGER, nullable | Outermost invocation column |
callee_text |
TEXT | Surface syntax (foo, p->handler, …) |
is_direct |
INTEGER | 1 direct by name; 0 indirect |
callee_var |
INTEGER, nullable | IR VarId used as the indirect callee, when recorded; NULL for calls without one |
return_dst |
INTEGER, nullable | IR VarId receiving the result, when recorded; NULL when no result destination is recorded |
callee_var and return_dst are recorded in both minimal and full exports.
They are IR identities without foreign keys to the minimal export's filtered
variables table. The partial index
call_sites(callee_var, return_dst) covers rows with both values present;
indirect-return provenance uses it to find matching sites, then joins
call_edges through its call_site_id index. These two indexes are built after
call-site/edge insertion and before provenance export; remaining secondary
indexes are deferred. Callees are deduplicated and ordered by FnId, preserving
the provenance association between each return source and its root callee.
Synthetic call edges have a NULL call-site ID and cannot match this join.
These bindings are part of the v7 layout; older exports may omit them.
Call sites inside header-defined functions are deduplicated by
(spelling file, line, col, expansion file, line, col, callee) across TUs. Under --explore, variant calls
at that same location retain distinct IDs when their arguments, receiver, callee
binding, or return destination differ. Identical call facts are deduplicated.
Consequently, raw call_edges counts can increase without adding a distinct
source-location/target pair; group by caller, callee, spelling and expansion
file/line/column, and resolution when comparing invocation-level coverage.
| Column | Type | Description |
|---|---|---|
id |
INTEGER PK | Edge id; stable across adding/reordering unchanged merge inputs in current trace-merge output (see identity contract) |
call_site_id |
INTEGER FK → call_sites |
Call site; NULL for synthetic edges (see below) |
caller_fn_id |
INTEGER FK → functions |
Resolved caller function |
callee_fn_id |
INTEGER FK → functions |
Resolved target |
resolution |
TEXT | direct, indirect, ambiguous, external (callee statically resolved but bodyless under the analyzed root — see functions.is_defined), ipc (synthetic proxy→stub bridge edge) |
Multiple rows per call site are allowed (may-analysis indirect targets).
Synthetic edges (IPC bridges): edges injected for a proxy→stub bridge
carry call_site_id = NULL and resolution = 'ipc' (there is no single
source-level call site — the proxy body only has the opaque SendRequest
call). Their caller is given by caller_fn_id (the proxy method); consumers
must use ce.caller_fn_id, not cs.caller_fn_id, and treat NULL as a
synthetic/bridge edge with no source location. IPC detection is enabled by
default and disabled with the --no-ipc analyze flag.
Indexes: call_edges(caller_fn_id), call_edges(callee_fn_id),
call_edges(call_site_id)
Current analysis and merge exports store one row in database_identity, an
additive table in the v8 compatibility family. This identifies the immutable
analysis snapshot independently of its SQLite filename or location.
| Column | Type | Meaning |
|---|---|---|
id |
INTEGER PK, CHECK = 1 | Singleton metadata row |
algorithm |
TEXT NOT NULL | sha256-logical-v1 |
digest |
BLOB NOT NULL, exactly 32 bytes | SHA-256 of the exported database contents |
Read its printable form with
SELECT algorithm, lower(hex(digest)) FROM database_identity.
The digest covers all non-internal stored tables, their column names and
typed row values, including analysis configuration and results. It excludes
database_identity itself and analysis_run.created_at. Views, indexes,
SQLite internal tables and physical page layout do not participate. Thus
copies, renames, index creation and VACUUM retain the same identity.
A repository commit alone would not distinguish analyses of the same revision
with different configurations or uncommitted source changes.
The version-1 encoding starts with a length-prefixed UTF-8 algorithm name.
Tables sort by name with SQLite's binary collation. Each table starts with
byte 0x10, its length-prefixed name, an unsigned 64-bit column count and
length-prefixed column names in schema order (omitting created_at only for
analysis_run). Rows sort by the primary-key columns in key order, or all
projected columns when no primary key exists, using binary collation. Each
row starts with byte 0x20. Value tags are NULL = 0, INTEGER = 1, REAL = 2,
TEXT = 3 and BLOB = 4. Integers use signed 64-bit encoding; reals use IEEE-754
64-bit bits; text and blobs use length-prefixed bytes. Each table ends with
byte 0x30. Integers and byte lengths use big-endian encoding; lengths are
unsigned 64-bit. Duplicate rows are retained. Hashing streams rows; no complete
database dump is held in memory.
Computing the digest reads every stored table: hashing and read I/O cost O(database size). SQLite may also sort rows and use temporary storage when the required row order is not covered by an index. Each export pays this cost once, after writing its rows and before building secondary indexes; each merge pays it for every legacy input without a stored identity. Reading a valid stored identity only reads the singleton metadata row.
Exports record the identity after writing and publishing every analysis
and projection row, before persisting the output file. Published databases
are immutable: a tool deliberately changing their analysis rows must call
trace_db::record_database_identity afterward.
The merger trusts a valid stored identity, rejects unsupported algorithms or
malformed digests, and computes the same digest read-only for older databases
without the table or row. Its input duplicate detection uses this identity,
so copies at different paths contribute once. It continues checking filesystem
paths to prevent overwriting an input.
Current merger output adds three tables to v8; ordinary analysis exports and
older merged databases do not have them. analysis_run.options_json records
call_edge_identity_version = 1. The existing call_edges.id INTEGER column
is the consumer-facing identifier; consumers do not need additional keys.
IDs are no longer sequential and may occupy the full nonnegative signed
64-bit range. The identity contract
defines their scope and encoding.
A collision between distinct edge identities in the 63-bit ID aborts the merge before publication, preserving any existing output database.
| Table | Primary key / foreign key | Other column |
|---|---|---|
merge_target_identities |
target_id INTEGER → link_targets(id) |
identity BLOB NOT NULL, exactly 32 bytes |
merge_function_identities |
function_id INTEGER → functions(id) |
identity BLOB NOT NULL, exactly 32 bytes |
merge_call_site_identities |
call_site_id INTEGER → call_sites_data(id) |
identity BLOB NOT NULL, exactly 32 bytes |
Every output target, function and call site has one identity row. These tables let later merges retain original identity despite row remapping. Repeated identities in overlapping inputs coalesce before their references and edges are written; see the identity contract. Function and call-site tables must occur together; a marked input missing either, a missing identity row in a present identity table or an invalid blob is rejected before publication. The target table is optional on input for earlier stable-ID outputs, whose target identities use the input namespace fallback. A target identity table without function/site tables is rejected. Unsupported identity versions are rejected. Inputs with neither the marker nor the tables use the legacy namespace fallback described in the identity contract.
| Column | Type | Description |
|---|---|---|
id |
INTEGER PK | Edge id |
call_site_id |
INTEGER FK → call_sites |
Call site |
arg_index |
INTEGER | 0-based argument position at the call site. A member or constructor can record its receiver at position 0. A stored bind argument uses the position of its destination formal |
actual_var_id |
INTEGER FK → variables |
Actual variable (NULL if actual is a function) |
actual_fn_id |
INTEGER FK → functions |
Actual function for fn-ptr args (NULL if actual is a variable) |
formal_var_id |
INTEGER FK → variables |
Callee parameter var |
Exactly one of actual_var_id or actual_fn_id is set per row. A function name with several internal-linkage C++ overloads (static or in an anonymous namespace) is passed as each of them: one row per overload at the same call_site_id, arg_index and formal_var_id.
Index: arg_flow_edges(call_site_id)
Places where code starts running on a thread, a task queue or the IPC worker
pool. Semantics, evidence rules and row order:
Execution contexts. An additive v7 table: a
v7 export written before it existed has no execution_contexts table, so a
reader checks for the table (and the columns it reads) instead of the schema
version; in an ordinary analysis an empty table means no context was found. A
callable only wrapped (std::bind, std::packaged_task) starts nothing and
has no row. A packaged-task wrapper model uses context = "none".
| Column | Type | Description |
|---|---|---|
id |
INTEGER PK | Context id |
kind |
TEXT | thread, pool_task, serial_task, ipc_handler or unknown |
entry_fn_id |
INTEGER FK → functions |
Function the context starts running |
call_site_id |
INTEGER FK → call_sites, nullable |
Submitting call site (pthread_create(...)); NULL for an entry no call site starts (an entry model's override, an IPC stub handler) |
api_fn_id |
INTEGER FK → functions, nullable |
Modelled callee that runs the callback (pthread_create, std::thread::thread, AppExecFwk::EventHandler::PostTask); NULL without a call site |
param_index |
INTEGER, nullable | Callee parameter the callback is passed in, counting explicit arguments (no this); NULL without a call site |
receiver_var_id |
INTEGER FK → variables, nullable |
Variable the modelled member was called on (q in q.submit(f)); NULL when the receiver is not a named variable, without a call site, and in a trace-merge output |
model |
TEXT, nullable | Name of the invoke or entry model that states the context (may differ from the api_fn_id name); NULL for an IPC stub handler |
multi_instance |
TEXT | Multi-instance evidence: loop, cycle, parent or unknown |
self_concurrent |
INTEGER | 1 when two instances may run at the same time; 0 means no evidence, not single execution |
The same starts stay in call_edges as indirect (start site to entry) and
ipc (proxy to handler) edges, so the functions a context reaches are a walk
over call_edges from entry_fn_id. Not indexed: the table is small (sizes
in EVAL_REPORT.md).
Per-function call-order control-flow graphs, written by trace analyze --sequencing in every export mode and empty otherwise (see the
capability marker). What an event, an
edge, an order pair and a gap mean, and what "before" may be concluded from
them: Call sequencing.
Additive to v8. Kind and coverage columns are strings ids (JOIN strings s ON s.id = kind_id). Row ids count up from 1 in function id, then variant
order; a graph's blocks and events take consecutive ids in ordinal order, so
an export is reproducible row for row. Storage is linear in blocks, edges,
events and sites.
cfg_functions: one row per graph.
| Column | Type | Description |
|---|---|---|
id |
INTEGER PK | Graph id |
fn_id |
INTEGER FK → functions |
Function whose body this is |
tu_file_id |
INTEGER FK → files, nullable |
Translation unit the body was lowered in |
variant |
INTEGER | Configuration variant, from 0; several rows for one fn_id are alternatives, never one body |
entry_block, exit_block |
INTEGER FK → cfg_blocks |
Entry and normal exit |
exceptional_exit_block |
INTEGER FK → cfg_blocks, nullable |
Where uncaught exceptions leave; NULL when the graph has none |
coverage_id |
INTEGER FK → strings |
complete, or partial when the graph has a cfg_gaps row |
cfg_blocks: id, cfg_id → cfg_functions, ordinal (from 0 within the
graph), kind_id (entry, exit, exceptional_exit, ordinary,
landing), and the nullable source position file_id, line, col (loop
heads, case labels, labels, try bodies and handlers).
cfg_edges: src_block, dst_block → cfg_blocks and kind_id
(fallthrough, branch_true, branch_false, switch_case, back_edge,
return, exception, unsupported, sequenced; a sequenced edge joins
two halves of one block's local order, see
Representation). Primary key (src_block, dst_block, kind_id), WITHOUT ROWID.
cfg_events: one row per invocation.
| Column | Type | Description |
|---|---|---|
id |
INTEGER PK | Event id |
cfg_id |
INTEGER FK → cfg_functions |
Graph |
block_id |
INTEGER FK → cfg_blocks |
Block the event runs in |
ordinal |
INTEGER | Position in the block's evaluation order, from 0; not an order guarantee (see cfg_event_order) |
kind_id |
INTEGER FK → strings |
call, construct, destroy or delete |
file_id, line, col |
INTEGER | Request position, as in call_sites |
expansion_file_id, expansion_line, expansion_col |
INTEGER, nullable | Outermost macro invocation, as in call_sites |
cfg_event_sites: event_id → cfg_events, call_site_id → call_sites,
ordinal (the site's position among its event's, from 0; primary key
(event_id, call_site_id), WITHOUT ROWID); the alternative-target records
of one invocation (several rows for one event are alternatives, not a
sequence), the record the call was bound to first, then the alternatives
added for it (virtual overrides) in the order they were found. Read them by
ordinal, not by call_site_id. One site may belong to several events (a
destructor at each scope exit). Every named site is exported (see the
call site export filter).
cfg_event_order: event_id is immediately sequenced before next_event_id;
both are events of one block. Two events of a block without a path through
these rows are unordered. No transitive pairs are stored.
cfg_gaps: id, cfg_id, kind_id (parse_error, depth_exceeded,
unsupported_construct, unresolved_goto, unordered_branch,
initializer_order, omitted_sites, unevaluated), the nullable source position
file_id, line, col, and the nullable inclusive event range
first_event, last_event → cfg_events. A gap is uncertainty, never
evidence for an order.
Indexes: cfg_functions(fn_id), cfg_blocks(cfg_id),
cfg_edges(dst_block), cfg_events(block_id), cfg_events(file_id, line),
cfg_events(expansion_file_id, expansion_line),
cfg_event_sites(call_site_id), cfg_gaps(cfg_id). inspect sequence
resolves a position by the ids of the files matching it, then one lookup by
spelling and one by expansion position; a database exported before the
expansion index existed answers the same, scanning cfg_events for the
expansion half.
| Column | Type | Description |
|---|---|---|
id |
INTEGER PK | Variable id |
name |
TEXT | Source or synthetic name |
kind |
TEXT | global, file_static, fn_static, param, local |
fn_id |
INTEGER FK → functions |
Enclosing function (nullable) |
type_id |
INTEGER FK → types |
Type id |
file_id |
INTEGER FK → files |
Declaration file |
line |
INTEGER | Declaration line |
col |
INTEGER | Declaration column (start of the declarator) |
is_weak |
INTEGER | 1 for a weak symbol, 0 otherwise; recorded only for globals — a file-scope static, a local or a parameter has no linkage to weaken. |
target_id |
INTEGER FK → link_targets |
Owning link target; NULL when no target is known. |
In minimal export, variables are limited to every global and static (with
or without a flow node) and the locals and parameters the flow graph /
arg-flow edges reference; use --full-export for every variable. A global no
fact names is listed so trace inspect finds it by its own declaration;
inspect dataflow then reports it has no flow node.
variables.is_synthetic (INTEGER, default 0) marks lowering-created
intermediate values. Source selection filters this metadata, never name prefixes.
PAG value-flow nodes (trace inspect dataflow). Always exported. A global
or static that no flow, return or call site names has no node (see
Program Assignment Graph).
| Column | Type | Description |
|---|---|---|
id |
INTEGER PK | PAG node id (same id space as points_to.var_node_id) |
kind |
TEXT | var, loc, constant (immutable value with no abstract location), field_address (intermediate member address for a getter model), call_target (indirect-call site node), or terminator (function-model clears event) |
label |
TEXT | Human-readable label (empty for var nodes where label is read from variables.name; loc:…, fn:…, "memset_s clears arg0") |
detail |
TEXT | Extra context (empty for var nodes where detail is derived from variables.kind, variables.line, and functions.name; location kind for loc, call site for call_target/terminator) |
var_id |
INTEGER FK → variables |
Variable this node belongs to (NULL for function locations) |
fn_id |
INTEGER FK → functions |
Enclosing function, when known (call targets record the caller; function locations record the function value) |
call_site_id |
INTEGER FK → call_sites |
Call occurrence for call-target/clearing nodes; otherwise NULL |
Explicit C++ nullptr uses kind='constant', label='nullptr', and
detail='null_pointer', with no variable or function owner. Its outgoing copy
edges retain value-flow connectivity; it is not a locations row and seeds no
points-to facts. This uses the existing v7 columns without a layout change.
Index: flow_nodes(var_id)
A convenience view over flow_nodes joining variables and functions to reconstruct label and detail for var nodes (where flow_nodes stores empty strings to save database space, while preserving non-empty labels/details if already present). Direct queries seeking formatted node text can query this view instead of flow_nodes.
| Column | Type | Description |
|---|---|---|
id |
INTEGER PK | PAG node id |
kind |
TEXT | Node kind |
label |
TEXT | Reconstructed label for empty var (variables.name), or stored label when present |
detail |
TEXT | Reconstructed detail for empty var ("{kind} @{line} in {fn}"), or stored detail when present |
var_id |
INTEGER FK → variables |
Variable ID |
fn_id |
INTEGER FK → functions |
Function ID |
Directed value-flow edges between PAG nodes. Always exported.
| Column | Type | Description |
|---|---|---|
id |
INTEGER PK | Edge id |
src_node |
INTEGER FK → flow_nodes |
Source node |
dst_node |
INTEGER FK → flow_nodes |
Destination node (value flows src → dst) |
kind |
TEXT | see below |
Edge kinds:
copy,addr_of,load,store,gep,dlsym— direct translations of the IR flow constraints that survived solving (including param copies wired by the solver).dlsymis the symbol-lookup model: string constants in the name argument become function locations on the return destination.unwrap— a smart pointer's overloaded->/*(sp->field) or modeled owning-pointerget(): the wrapper value flows into a pointee-typed receiver or raw-pointer result. Only pointee-compatible locations cross it; see Smart-pointer unwrap.points_to— implicit var → storage-location edge derived from the final var→location map.call_arg— actual-to-formal argument passing fromarg_flow_edges, exported when no stronger constraint already connects the pair. The source is the value passed: for an&xargument that is the temporary holding&x(reached fromx's location throughaddr_of), even though thearg_flow_edgesrow namesx.terminates— terminator visibility edge from a function-modelclearseffect (e.g.memset_s(dst, …)): the actual-argument node flows into a syntheticterminatornode recording the call site. No points-to value is produced; the edge documents where a buffer's prior contents stop.
Which memory cells a load reads and a store writes is not an edge here:
see flow_memory_access.
Edges have no position columns. Where the statement behind an edge is written
is recorded once, in flow_origins,
keyed by the same (src_node, dst_node, kind); edges with no statement of their
own have no origin rows. Rules:
Where a value moves; query:
Source sites of a value move.
Indexes: flow_edges(src_node), flow_edges(dst_node)
The memory cells each load reads and each store writes, read off the
converged points-to sets. Always exported by analysis; additive to v7.
| Column | Type | Description |
|---|---|---|
edge_id |
INTEGER FK → flow_edges |
The load or store edge of the access |
cell_node |
INTEGER FK → flow_nodes, nullable |
A cell (loc node) it reads or writes; NULL: its cells are not recorded |
An access with recorded cells has one row per cell; one whose cells are not
recorded (past the fan-out cap, or a pointer that points at no memory) has one
row with cell_node NULL, so "not recorded" is never inferred from a missing
row. The access's sites are its load's or store's flow_origins rows (join
flow_edges on id, then flow_origins on (src_node, dst_node, kind)); none
are repeated for it. Read as edges, a load's row is a mem_read from the cell
into the load's destination and a store's a mem_write from the stored value
into the cell; inspect slice follows them, inspect dataflow and the C API
do not. Rules: Memory access edges.
Detect it with the table and its two columns: an earlier v7 export lacks the
table, and trace-merge output (analysis_run.options_json.stage = "merge")
has it empty, like its other flow tables.
Indexes: flow_memory_access(edge_id), flow_memory_access(cell_node)
Exported with --full-export only.
| Column | Type | Description |
|---|---|---|
id |
INTEGER PK | Type id |
kind |
TEXT | void, int, short, long, long long, bool, float, double, struct, ptr, fnptr, array, func, unknown, …; ptr includes C++ member pointers, whose names retain their owner (data-member pointers use T C::*; member-function-pointer variables and parameters use fn_ptr C::**, including their IR storage-pointer layer, while fields use fn_ptr C::*) |
name |
TEXT | Display name |
size |
INTEGER | Layout size |
layout_json |
TEXT | JSON field layout |
Member-pointer descriptors retained in linking facts carry an optional
owner_dependent boolean. It distinguishes a template owner from a declared
class with the same spelling. Absent values in earlier exports default to false;
false values are omitted when writing descriptors. Display names retain the
original owner spelling.
Function-member descriptors also retain optional qualifiers metadata
(is_const, ref_qualifier); absence in older linking facts leaves selection
conservative. Callable parameter lists distinguish a declared Ellipsis tail
from Unknown parameters and coarse signatures. A standalone interned tail
marker exports as type kind ellipsis and display name ....
PAG abstract locations (--full-export or --debug-points-to).
| Column | Type | Description |
|---|---|---|
id |
INTEGER PK | Location id |
kind |
TEXT | Global, FileStatic, FnStatic, Local, Heap, Field, FieldSummary, ArraySummary, Function, StringLit, Bound |
desc |
TEXT | Description |
type_id |
INTEGER FK → types |
Optional |
Modeled container element cells use ArraySummary and describe their owners
as elements:<function>::<variable> for locals, elements:<variable> for
globals, or elements:<class>.<field> for members. See
Container elements.
PAG node → location sets (--debug-points-to).
| Column | Type | Description |
|---|---|---|
var_node_id |
INTEGER | PAG node id |
loc_id |
INTEGER FK → locations |
Target location |
PK: (var_node_id, loc_id)
| Column | Type | Description |
|---|---|---|
id |
INTEGER PK | Diagnostic id |
severity |
TEXT | error, warning, info |
file_id |
INTEGER FK → files |
Optional |
line |
INTEGER | Line |
message |
TEXT | Text |
stage |
TEXT | preprocess, parse, analyze, explore, compile_commands, link_commands, merge |
preprocess rows are the preprocessor's own diagnostics (missing includes, unknown directives,
unterminated #if, mid-file stops), attributed to the file and line where the condition
occurred — a nested header, not the including translation unit — and deduplicated on
(file_id, line, message) across translation units. parse rows are per unit (parse errors in <path>, file_id NULL). compile_commands and link_commands rows report unreadable or
inconsistent build databases. See docs/PREPROCESSOR.md, "Error recovery".
analyze rows carry whole-run solver results and always have file_id NULL and line 0.
The only current one is the budget-truncation warning (solver_partial in
analysis_run.options_json is the same fact in machine-readable form).
merge rows report cross-repository collision warnings (multiple strong definitions with identical signatures),
unresolved external function dependencies, or weak symbol overrides generated by trace-merge.
SELECT callee.name, ce.resolution, cs.line, cs.callee_text
FROM call_edges ce
LEFT JOIN call_sites cs ON cs.id = ce.call_site_id
JOIN functions caller ON caller.id = ce.caller_fn_id
JOIN functions callee ON callee.id = ce.callee_fn_id
WHERE caller.name = 'HdfSbufReadBuffer';SELECT caller.name, cs.line, cs.callee_text
FROM call_sites cs
JOIN functions caller ON caller.id = cs.caller_fn_id
LEFT JOIN call_edges ce ON ce.call_site_id = cs.id
WHERE cs.is_direct = 0 AND ce.id IS NULL
ORDER BY caller.name, cs.line;SELECT caller.name, callee.name, cs.callee_text, cs.line
FROM call_edges ce
JOIN call_sites cs ON cs.id = ce.call_site_id
JOIN functions caller ON caller.id = ce.caller_fn_id
JOIN functions callee ON callee.id = ce.callee_fn_id
WHERE ce.resolution = 'indirect';SELECT caller.name, ce.resolution, cs.line
FROM call_edges ce
LEFT JOIN call_sites cs ON cs.id = ce.call_site_id
JOIN functions caller ON caller.id = ce.caller_fn_id
JOIN functions callee ON callee.id = ce.callee_fn_id
WHERE callee.name = 'LiteNetSetIpAddr';SELECT cs.line, af.arg_index, av.name AS actual, fv.name AS formal
FROM arg_flow_edges af
JOIN call_sites cs ON cs.id = af.call_site_id
JOIN variables av ON av.id = af.actual_var_id
JOIN variables fv ON fv.id = af.formal_var_id
WHERE af.actual_var_id IS NOT NULL;SELECT cs.line, af.arg_index, f.name AS actual_fn, fv.name AS formal
FROM arg_flow_edges af
JOIN call_sites cs ON cs.id = af.call_site_id
JOIN functions f ON f.id = af.actual_fn_id
JOIN variables fv ON fv.id = af.formal_var_id
WHERE af.actual_fn_id IS NOT NULL;Every statement that moves b's value or storage into pp, with the enclosing
function by the edge-scope rule: when
several definitions hold the line, the innermost one if the line is strictly
inside it (not its first or last line); a line held by a single definition is
that definition's, its first and last lines included; otherwise NULL:
SELECT o.kind, o.operation, p.path, o.line, o.col, o.expression,
(SELECT CASE WHEN COUNT(DISTINCT f.id) = 1 THEN MIN(f.name) END
FROM functions f
WHERE f.file_id = o.file_id AND f.is_defined = 1
AND o.line BETWEEN f.line_start AND f.line_end
AND NOT EXISTS (
SELECT 1 FROM functions g
WHERE g.file_id = o.file_id AND g.is_defined = 1 AND g.id <> f.id
AND o.line BETWEEN g.line_start AND g.line_end
AND NOT (g.line_start <= f.line_start AND f.line_end <= g.line_end
AND o.line > f.line_start AND o.line < f.line_end)))
AS function
FROM flow_origins o
JOIN files p ON p.id = o.file_id
JOIN flow_nodes s ON s.id = o.src_node
JOIN flow_nodes d ON d.id = o.dst_node
JOIN variables sv ON sv.id = s.var_id
JOIN variables dv ON dv.id = d.var_id
WHERE sv.name = 'b' AND dv.name = 'pp'
ORDER BY p.path, o.line, o.col;flow_origins rows join a flow_edges row on (src_node, dst_node, kind).
An addr_of origin's source is a storage-location node: a variable's carries
that variable's var_id, a function's carries its fn_id instead.
trace inspect graph.db calls [--from FN] [--to FN] [--file SUBSTR] [--exclude-deps]
trace inspect graph.db callgraph --file SUBSTR --line N [--depth N] [--direction down|up]
trace inspect graph.db dataflow --file SUBSTR --line N --col C [--depth N] [--direction down|up]
trace inspect graph.db sequence (--function FN | --file SUBSTR --line N [--col C] [--callee NAME]) [--to-file SUBSTR --to-line N ...]-
callslists rows fromcall_edgesjoined withfunctionsand left-joined withcall_sites(synthetic IPC edges have no call site).--from/--tomatch an exactfunctions.nameor a C++ suffix (%::FNwith_/%inFNescaped so they are notLIKEwildcards).--filematches ordinary edges by call-site or callee file. For synthetic edges it matches the caller or callee definition file.--exclude-depshides edges whose caller or callee comes from a dependency root (is_dep = 1); a database older than v4 has no such column and reports an actionable re-analysis message. Unresolved indirect sites require SQL (query above). -
callgraphfinds the function whose[line_start, line_end]contains the given line and prints its transitive callees (down) or callers (up), bounded by--depth. Edge labels distinguishdirect,indirect,external, andambiguousresolution. -
dataflowresolves the variable declared nearest the given position (exact identifier hit preferred, using a half-open character-column interval; declarations only — use sites are not recorded) and presents source-level value flow forward (down: where the value flows) or backward (up: where it came from). Depth counts visible transitions after technical PAG nodes collapse; see the authoritative source-level contract. Parameters duplicated across TUs (header prototype vs definition copies) are reconciled automatically when the queried copy carries no edges. -
sequencefirst readsanalysis_run.options_json.call_sequencingand fails with a message namingtrace analyze --sequencingunless it istrueor"partial"(the latter adds a notice). It resolves a position againstcfg_eventsthroughcfg_event_sites→call_sites(spelling or expansion position), then loads only the graphs it reaches: the call sequencing tables of each function, the callees fromcall_edges,execution_contextsstarts andipcedges as boundaries. Semantics: Call sequencing, Query.
Both graph commands print a forest with (truncated at --depth …) markers
when the frontier was cut off.
In v8, strings(id INTEGER PRIMARY KEY, text TEXT NOT NULL) stores each
distinct name, expression, graph label, type spelling, and graph tag once
across the relations below. The exporter copies only distinct strings into
its lookup map and assigns IDs in first-occurrence order after reserving small
IDs for common graph tags. It never iterates the map. Analysis and merger
exports use the same TextPool; no second SQLite text index is stored.
Each logical relation has a physical backing table named <relation>_data.
Its column order and all unlisted columns retain the v7 definitions; the
following text columns become integer <column>_id foreign keys to strings:
| Logical relation | Interned columns |
|---|---|
variables |
name |
call_sites |
callee_text |
call_edges |
resolution |
flow_nodes |
kind, label, detail |
flow_edges |
kind |
flow_parameters |
name, type_name |
flow_origins |
kind, expression, operation |
flow_call_origins |
expression |
flow_call_expressions |
expression |
The call-sequencing tables have no _data/view
pair: they did not exist in v7, so their kind columns are strings ids under
their own *_id names; join strings to read them.
These logical relations are read-only views. They expose the same columns,
text, entity IDs, row counts, and duplicate rows as v7's tables. Named columns
and SELECT * queries retain their results; implicit rowid is not part of
the view contract. Foreign keys and indexes refer to physical backing tables,
not views. The empty string has dictionary ID 1, the default for a node's
optional label and detail. Variable storage kind remains inline so the
parameter-twin partial index can retain its kind='param' predicate; that
index keys (fn_id, name_id). Inspection compares the backing table's
name_id values directly, using both index keys without decoding candidate
names. On v7 it compares the inline names through (fn_id, name) instead.
flow_parameters_data, flow_field_access, target_sources,
target_dependencies, and points_to use WITHOUT ROWID: their existing
composite primary key is their storage key, avoiding a duplicate rowid table
and primary-key index. Use explicit keys for these relations; their rows have
no implicit rowid. Other backing tables retain rowids, including operation
origins used when an insertion-order storage identifier is needed.
Each view uses scalar dictionary lookups so SQLite can flatten it inside a
left join; a joined view could materialize the entire relation. Indexed
endpoint and call-site queries fetch selected rows and dictionary entries.
Source-position lookup guards multiline-expression checks with a file-matching
CASE so dictionary text is fetched only for matching files during the scan.
The storage is shared by minimal, full, and points-to exports. Merger output
populates the call-site and call-edge backing tables and their strings, and
leaves the variable and flow backing tables empty, following its existing
call-graph-only contract.
Always exported by analysis in minimal and full modes, independently of points-to retention:
flow_origins(src_node, dst_node, kind, file_id, line, col, expression, operation)records original source operation sites for constraint endpoint pairs.kindmatches the raw constraint (copy,load,store, etc.);operationmay additionally distinguishreturn valueandwrite field. Multiple sites per pair are allowed. Coordinates are recorded via LineMap, not declarations.flow_parameters(fn_id, arg_index, var_id, name, type_name)records the canonical function parameter list for text headers in both minimal and full exports.arg_indexis zero-based and follows the solver's parameter list (including implicit receivers). Names, IDs, and display types are retained even for parameters without graph nodes.var_idis an IR identity, without a foreign key to the minimal export's filteredvariablestable. This header metadata does not alter the dataflow JSON contract.flow_field_locations(node_id, parent_node, field_name)records concrete field-location parents from the PAG.node_idis unique; full parent chains distinguish nested abstract storage sharing a root variable and field label.flow_field_access(base_node, dst_node, field_name)records named PAG field accesses with a unique key over all three columns. It reconstructs aggregate initializer destinations without changing raw graph labels or operation text.flow_call_origins(call_site_id, file_id, line, col, expression)is additive optional v7 metadata, keyed by call ID. It records the closest source operation for each return-assigning call before equivalent constraints are unioned, preserving distinct assignments within one macro invocation. Older v7 databases remain readable using endpoint/source-position fallback; re-analysis supplies exact occurrence attribution. Both export modes use the same writer.flow_call_expressions(call_site_id, expression)is additive optional v7 metadata, keyed by call ID. It stores the full call expression for argument operation presentation, separately from return-assignment provenance. Locations and macro invocation/spelling coordinates still come fromcall_sites. Both export modes use the same writer. Older databases without this table remain readable with empty argument expressions; re-analysis supplies recorded call text.flow_return_calls(src_node, dst_node, call_site_id, callee_fn_id)records existing return wiring by the recorded call return destination and resolved callee, including calls with no parameters. Each source is associated only with root callees whose transitive return facts contain it, including for multi-candidate indirect calls. It does not add analysis edges.flow_calls(src_node, dst_node, call_site_id, arg_index)records each actual/formal occurrence, including pairs already wired as rawcopy. Sources name the passed value (the address temporary for&x), following the same export policy as rawcall_arg. Call metadata and macro locations come fromcall_sites; parameter/owner identities come fromvariables.
Inspection indexes cover both endpoints of flow_origins, flow_calls, and
flow_return_calls, the destination of flow_field_access, and parameter
copies by (fn_id, name) under kind='param'. Function ownership lookup uses
idx_functions_file_range on functions(file_id, is_defined, line_start, line_end)
to read the definitions of each operation's file once, instead of scanning all
functions. These indexes are exported in
minimal and full modes and built after bulk export,
preserve the query columns and support selective source-level inspection.
Older v7 exports may lack these additive indexes; re-analysis supplies them.
Raw tables keep their existing meaning under the version and capability contract. Inspect checks required structures for older exports; the source-level view requires its presentation metadata and an analysis origin. The CLI JSON and raw API compatibility rules are defined in Source-level dataflow presentation.