Logo vun Xrefs

Xrefs

Organisatioun
allthingsida
xrefs

Analyze IDA cross-references. Use when asked about callers, callees, imports, data refs, call graphs, or dependency chains.

Iwwersiicht

Editeurallthingsida
Repositoryidasql-skills
Skill-Nummxrefs
Stären
50
Forks
10
Matgeliwwert Fichieren
1
Linken
  • Instruktiounen am Markdown-Format

    Eng SKILL.md-Datei, déi de Modell bei Bedarf luet, soudatt nëmmen Token ufalen, wann eng Ufro tatsächlech dozou passt.

  • Funktionéiert mat all LLM

    KI-Skills si reng Markdown, keen ubidderspezifesche Code. Dofir funktionéiert dëse Skill mat GPT, Claude, Gemini, Grok oder engem lokale Modell.

  • 1 matgeliwwert Dateien

    Skripten, Virlagen a Referenzen, déi de Modell beim Schaffe liese kann. D'Dateie kënnen nëmme gelies ginn a ginn ni ausgeféiert.

  • Open Source

    Vum allthingsida op GitHub verëffentlecht. Liest de Quelltext, ier Dir de Skill installéiert.

Installatioun

Installéiert de KI-Skill Xrefs an TypingMind, fir e mat all LLM ze benotzen, oder füügt en an en anere KI-Agent an, deen SKILL.md liest.

1

An TypingMind installéieren

TypingMind installéiert e Skill direkt aus sengem GitHub-Dossier — dobäi gëtt SKILL.md gelies, d'Ressourcedateie gi gebëndelt an d'Resultat gëtt lokal gespäichert.

  1. Maacht d'App op a gitt op Plugins → Skills.
  2. Wielt „Vun GitHub installéieren“.
  3. Pecht d'URL vum Skill-Dossier hei drënner an a bestätegt.
    https://github.com/allthingsida/idasql-skills/tree/main/plugins/idasql/skills/xrefs
  4. Aktivéiert de Skill an all Chat, an deem Dir e benotze wëllt.
Plugins → Skills → Skill afügen → Vu GitHub-URL, pecht dann d'URL vum Dossier an a klickt op Weider.
2

An engem anere KI-Agent installéieren

All KI-Agent, deen d'Format Agent Skills liest, kann dëse Skill benotzen — kopéiert den Dossier an de Skill-Verzeechnes vun deem KI-Agent.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/allthingsida/idasql-skills.git /tmp/idasql-skills
mkdir -p .claude/skills
cp -r /tmp/idasql-skills/plugins/idasql/skills/xrefs .claude/skills/xrefs
Start Claude Code nom Kopéieren nei, fir datt den neie Skill erkannt gëtt.

An TypingMind benotzen

Aktivéiert Xrefs an engem Chat vun TypingMind, an de Modell iwwerhëlt de Rescht. Den Numm an d'Beschreiwung stinn am System-Prompt. Soubal eng Ufro dozou passt, luet de Modell déi komplett Instruktioune selwer — Dir musst de Skill ni manuell opruffen, an et fale keng Token un, bis en tatsächlech benotzt gëtt.

De Modell luet Xrefs automatesch, soubal eng Ufro dozou passt.

Funktionéiert mat all KI-Modell

KI-Skills si reng Markdown-Instruktiounen amplaz vun ubidderspezifeschem Code. Dofir ass Xrefs net un de Modell gebonnen, fir deen de Skill geschriwwe gouf. Installéiert en eemol an TypingMind a benotzt e mat GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama oder engem lokale Modell, deen Dir selwer bedreift — alles mat Ären eegenen API-Keys.

  • Gëtt nëmme gelueden, wann et néideg ass

    De System-Prompt enthält nëmmen den Numm an d'Beschreiwung. D'Instruktioune gi bei der éischter passender Ufro gelueden, soudatt en onbenotzte Skill näischt kascht.

  • De Modell am lafende Chat wiesselen

    Well de Skill aus Instruktiounen amplaz vu Code besteet, funktionéiert en och no engem Modellwiessel — den nächste Modell liest déi selwecht SKILL.md-Datei.

Skill-Instruktiounen

Dëst ass den Inhalt vu SKILL.md, deen de Modell luet. Liest e virun der Installatioun — e Skill besteet aus Instruktiounen, déi Äre Modell befollegt.

Links: when an answer names functions, addresses, strings or types, make them clickable on IDA 9.4 builds: [name](uri) from the deep_links table, outside code blocks (skill deep-links).


Trigger Intents

Use this skill when user asks:

  • "Who calls this?" / "What does this call?"
  • "Where is this string/import referenced?"
  • "Show call graph dependencies."

Route to:

  • grep for candidate entity lookup by name/pattern before relationship analysis
  • analysis for broader triage context
  • decompiler for semantic interpretation after graph narrowing
  • disassembly for instruction-level call-site proof

Do This First (Warm-Start Sequence)

sql
-- 1) Core relation volume
SELECT COUNT(*) AS xref_count FROM xrefs;

-- 2) Top imports (dependency hints)
SELECT module, COUNT(*) AS import_count
FROM imports
GROUP BY module
ORDER BY import_count DESC;

-- 3) Most called functions
SELECT printf('0x%X', to_addr) AS callee, COUNT(*) AS callers
FROM xrefs
WHERE is_code = 1
GROUP BY to_addr
ORDER BY callers DESC
LIMIT 20;

Interpretation guidance:

  • Use relation counts to prioritize hotspots before expensive deep analysis.
  • Prefer indexed filters (to_addr/from_addr) for fast response.

Failure and Recovery

  • Full-scan query too slow:
    • Add to_addr = X or from_addr = X constraints.
  • Target unresolved by name:
    • Resolve/verify address first through the names table or explicit EA literals.
  • Sparse results:
    • Pivot through imports, strings, or disasm_calls joins.
  • Looking for references to a struct/union FIELD:
    • Use struct_member_xrefs (filter by type_name/type_ordinal/member_id). Do NOT LIKE-scan instructions.disasm / instruction_operands.text for the field name — it is the slow, crash-adjacent pattern this table replaces.
  • Target lives inside a static struct or dispatch table:
    • In modern binaries a string/data target is often referenced from a registration or vtable, not from code. xrefs WHERE to_addr = X may then return only .rdata rows. Walk back to the table head, then re-query xrefs against the table's address.
      sql
      -- 1) find the head of the item that contains the target
      SELECT addr FROM heads
      WHERE addr <= 0x140027D50 ORDER BY addr DESC LIMIT 1;
      -- 2) xrefs into the table head (where the code consumer points)
      SELECT * FROM xrefs WHERE to_addr = <head> AND is_code = 1;

Handoff Patterns

  1. xrefs -> decompiler for top candidate function semantics.
  2. xrefs -> analysis for campaign-level synthesis.
  3. xrefs -> annotations to persist relationship findings.

xrefs

Cross-references - the most important table for understanding code relationships.

ColumnTypeDescription
from_addrINTSource address (who references)
to_addrINTTarget address (what is referenced)
typeINTXref type code (never the ordinary-flow code, see below)
is_codeINT1=code xref (call/jump), 0=data xref
from_funcINTPre-computed containing function address (NULL when not in a function; a source in a tail shared by several functions is one row per owner)
kindTEXTReadable type: call, jump, code for code xrefs; read, write, offset, text, info, data for data xrefs

Semantics: the surface exposes real references only — ordinary fall-through flow edges (fl_F: each instruction "referencing" the next) are excluded on both the full scan and the to_addr/from_addr/from_func fast paths, matching IDA's Ctrl-X view and the other xsql tools. Counts therefore reflect calls/jumps/data refs, not instruction adjacency.

Shared tails fan out: a reference from a chunk owned by several functions is one row per owning function, so a count can exceed IDA's Ctrl-X list there. callers, callees, call_graph and func_summary.callers count every owner the same way; func_summary.call_sites_in counts each call site once.

sql
-- Who calls function at 0x401000?
SELECT printf('0x%X', from_addr) as caller FROM xrefs WHERE to_addr = 0x401000 AND is_code = 1;

-- What does function at 0x401000 reference?
SELECT printf('0x%X', to_addr) as target FROM xrefs WHERE from_addr >= 0x401000 AND from_addr < 0x401100;

struct_member_xrefs

Cross-references to a specific struct/union member (Issue 11). Resolves the member's IDA tid and enumerates xrefs directly — use this instead of LIKE scans over instructions.disasm / instruction_operands.text. Requires a filter on type_ordinal, type_name, or member_id (an unfiltered query errors). Embedded members are expanded recursively with a dotted member_path.

ColumnTypeDescription
type_ordinal / type_nameINT/TEXTQueried (top-level) type
member_indexINTLeaf index within its immediate parent type
member_name / member_pathTEXTLeaf name / dotted path (payload.leaf.data)
member_offset / member_offset_bitsINTCumulative offset within the queried type
member_idINTMember tid (also a filter key)
xref_fromINTReferencing address
xref_toINTMember tid (== member_id)
xref_typeINTRaw IDA xref type code
xref_kindTEXTread / write / offset / call / jump / flow
function_addr / function_nameINT/TEXTContaining function (NULL if none)
operand_indexINTThe operand that lands on the member: a struct-offset expression, or a stack variable of the structure's type ([ebp+entry.balance]); NULL when no operand does
instruction_textTEXTDisasm line at xref_from (NULL if not an instruction)
access_offsetINTByte offset of the access inside the member (0 for a direct field access)
access_sizeINTAccess width in bytes (NULL when the instruction takes the member's address: an offset-of immediate or an lea)
access_root_typeTEXTThe structure the access starts from (the struct-offset root, or the stack variable's type)

A nested member's rows list every xref to the embedded type's member, including accesses made through other containers. access_root_type = type_name keeps the accesses made through the queried container.

sql
-- Who writes _EH3_EXCEPTION_REGISTRATION.TryLevel?
SELECT member_path, xref_kind, function_name, instruction_text
FROM struct_member_xrefs
WHERE type_name = '_EH3_EXCEPTION_REGISTRATION' AND member_name = 'TryLevel';

-- All member references for a type (incl. nested), grouped by member
SELECT member_path, count(*) AS refs FROM struct_member_xrefs
WHERE type_ordinal = (SELECT ordinal FROM types WHERE name = 'db_entry_t')
GROUP BY member_path;

-- Only accesses made through the queried container, not other embeddings
SELECT member_path, function_name, instruction_text FROM struct_member_xrefs
WHERE type_name = 'CPPEH_RECORD' AND access_root_type = type_name;

imports

Imported functions from external libraries.

ColumnTypeDescription
addrINTImport address (IAT entry)
nameTEXTImport name
moduleTEXTModule/DLL name
ordinalINTImport ordinal
folder_pathTEXTWritable import folder path
full_pathTEXTFull import dirtree path
sql
-- Imports from kernel32.dll
SELECT name FROM imports WHERE module LIKE '%kernel32%';

-- Organize network-related imports
UPDATE imports
SET folder_path = 'idasql/imports/network'
WHERE name LIKE '%socket%' OR name LIKE '%connect%' OR name LIKE '%send%';

Convenience Views

callers

Who calls each function. Caller names are resolved by the view from the funcs and names tables.

ColumnTypeDescription
func_addrINTTarget function address
caller_addrINTXref source address
caller_nameTEXTCalling function name
caller_func_addrINTCalling function start (from from_func)

Underlying query:

sql
SELECT x.to_addr as func_addr, x.from_addr as caller_addr,
       COALESCE(f.name, n.name, printf('sub_%X', x.from_func)) as caller_name,
       x.from_func as caller_func_addr
FROM xrefs x
LEFT JOIN funcs f ON f.addr = x.from_func
LEFT JOIN names n ON n.addr = x.from_func
WHERE x.is_code = 1 AND x.from_func IS NOT NULL
  AND x.to_addr IN (SELECT addr FROM funcs)
sql
-- Who calls function at 0x401000?
SELECT caller_name, printf('0x%X', caller_addr) as from_addr
FROM callers WHERE func_addr = 0x401000;

-- Most called functions
SELECT printf('0x%X', func_addr) as addr, COUNT(*) as callers
FROM callers GROUP BY func_addr ORDER BY callers DESC LIMIT 10;

callees

What each function calls. Inverse of callers view. Uses from_func for efficient function-level grouping.

ColumnTypeDescription
func_addrINTCalling function address (from from_func)
func_nameTEXTCalling function name
callee_addrINTCalled address
callee_nameTEXTCalled function/symbol name
sql
-- What does main call?
SELECT callee_name, printf('0x%X', callee_addr) as addr
FROM callees WHERE func_name LIKE '%main%';

-- Functions making most calls
SELECT func_name, COUNT(*) as call_count
FROM callees GROUP BY func_addr ORDER BY call_count DESC LIMIT 10;

string_refs

Pre-joined view of string cross-references with containing function info.

ColumnTypeDescription
string_addrINTAddress of the string
string_valueTEXTString content
string_lengthINTString length
ref_addrINTAddress of the referencing instruction
func_addrINTContaining function address
func_nameTEXTContaining function name
sql
-- Strings referenced by a specific function
SELECT string_value, func_name FROM string_refs WHERE func_addr = 0x401000;

-- Find functions referencing password-related strings
SELECT string_value, func_name FROM string_refs WHERE string_value LIKE '%password%';

-- Most referenced strings
SELECT string_value, COUNT(*) as ref_count
FROM string_refs GROUP BY string_addr ORDER BY ref_count DESC LIMIT 10;

data_refs

Cached table of data (non-code) cross-references with containing function info, from every head of each function body (inline data such as jump and pointer tables included, so it agrees with xrefs where from_func is set). Whole-program aggregates are supported.

ColumnTypeDescription
from_addrINTSource address of the reference
to_addrINTTarget data address
from_func_addrINTContaining function address
from_func_nameTEXTContaining function name
ref_typeINTXref type code
kindTEXTReadable ref_type: read, write, offset, text, info or data
sql
-- Data references from a specific function
SELECT * FROM data_refs WHERE from_func_addr = 0x401000;

-- Globals a function writes
SELECT DISTINCT printf('0x%X', to_addr) AS target FROM data_refs
WHERE from_func_addr = 0x401000 AND kind = 'write';

-- Functions with most data references
SELECT from_func_name, COUNT(*) as data_ref_count
FROM data_refs GROUP BY from_func_addr ORDER BY data_ref_count DESC LIMIT 10;

call_graph

Table-valued function for BFS call graph traversal. Uses HIDDEN parameters for traversal control.

ColumnTypeDescription
func_addrINTFunction address in the graph
func_nameTEXTFunction name
depthINTBFS depth from start
parent_addrINTParent function address in the traversal
startINTHIDDEN — Starting function address
directionTEXTHIDDEN — 'down' (callees), 'up' (callers), or 'both'
max_depthINTHIDDEN — Maximum traversal depth

Always provide WHERE constraints for all 3 hidden parameters.

sql
-- Forward call tree from main
SELECT func_name, depth FROM call_graph
WHERE start = (SELECT addr FROM funcs WHERE name = 'main')
  AND direction = 'down' AND max_depth = 5;

-- All transitive callers
SELECT func_name, depth FROM call_graph
WHERE start = 0x405000 AND direction = 'up' AND max_depth = 10;

-- Bidirectional exploration
SELECT func_name, depth FROM call_graph
WHERE start = 0x401000 AND direction = 'both' AND max_depth = 3;

-- Join with string_refs to find strings reachable from a function
SELECT DISTINCT sr.string_value, sr.func_name
FROM call_graph cg
JOIN string_refs sr ON sr.func_addr = cg.func_addr
WHERE cg.start = 0x401000 AND cg.direction = 'down' AND cg.max_depth = 3;

-- Imported APIs reachable from a function's call tree
SELECT DISTINCT i.module, i.name as api
FROM call_graph cg
JOIN disasm_calls dc ON dc.func_addr = cg.func_addr
JOIN imports i ON dc.callee_addr = i.addr
WHERE cg.start = 0x401000 AND cg.direction = 'down' AND cg.max_depth = 5
ORDER BY i.module, i.name;

Performance: BFS with visited set. O(reachable functions). Always constrain hidden params. Use this pattern when the destination is an import.


shortest_path

Table-valued function for finding the shortest call path between two functions. Uses bidirectional BFS.

ColumnTypeDescription
stepINTStep number in the path (0 = source)
func_addrINTFunction address at this step
func_nameTEXTFunction name at this step
from_addrINTHIDDEN — Source function address
to_addrINTHIDDEN — Destination function address
max_depthINTHIDDEN — Maximum search depth

Always provide WHERE constraints for all 3 hidden parameters. Both endpoints must resolve to functions. Imported API addresses from imports are not valid shortest_path endpoints.

sql
-- Find shortest call path between two functions
SELECT step, func_name FROM shortest_path
WHERE from_addr = (SELECT addr FROM funcs WHERE name = 'main')
  AND to_addr = (SELECT addr FROM funcs WHERE name = 'target_func')
  AND max_depth = 20;

-- Check reachability between two functions
SELECT COUNT(*) > 0 as reachable FROM shortest_path
WHERE from_addr = 0x401000 AND to_addr = 0x405000 AND max_depth = 20;

-- Annotate path steps with call count and string refs
SELECT sp.step, sp.func_name,
       (SELECT COUNT(*) FROM disasm_calls dc WHERE dc.func_addr = sp.func_addr) as calls_made,
       (SELECT COUNT(*) FROM string_refs sr WHERE sr.func_addr = sp.func_addr) as strings_used
FROM shortest_path sp
WHERE sp.from_addr = 0x401000 AND sp.to_addr = 0x405000 AND sp.max_depth = 20
ORDER BY sp.step;

Performance: Bidirectional BFS. O(b^(d/2)) where b is branching factor and d is path length. Returns empty result set if no path exists within max_depth.


Table-First Cross-Reference Queries

sql
-- Incoming references to an address
SELECT from_addr, to_addr, type, is_code, from_func
FROM xrefs
WHERE to_addr = 0x401000;

-- Exact outgoing references from an item address
SELECT from_addr, to_addr, type, is_code, from_func
FROM xrefs
WHERE from_addr = 0x401000;

-- Outgoing references from anywhere inside a function
SELECT from_addr, to_addr, type, is_code, from_func
FROM xrefs
WHERE from_func = 0x401000;

grep

Use grep to resolve internal symbols, types, and members before doing relationship analysis. Use imports when the callee may exist only as an imported API. Canonical usage lives in ../grep/SKILL.md. For canonical schema and owner mapping, see ../connect/references/schema-catalog.md (grep).

sql
-- Resolve internal functions with grep
SELECT name, kind, addr
FROM grep
WHERE pattern = 'main%' AND kind = 'function'
ORDER BY name;

-- Resolve imported APIs with imports
SELECT module, name, addr
FROM imports
WHERE name LIKE 'CreateFile%'
ORDER BY module, name;

-- Then pivot into callers/callees/xrefs
SELECT caller_name, printf('0x%X', caller_addr) AS from_addr
FROM callers
WHERE func_addr = (
    SELECT addr
    FROM imports
    WHERE name = 'CreateFileW'
    ORDER BY name
    LIMIT 1
);

Performance Rules

Constraint Pushdown

The xrefs table has optimized filters using efficient IDA SDK APIs:

FilterCostBehavior
to_addr = X0.5O(xrefs to X) — fast, uses IDA's xref index
from_addr = X0.5O(xrefs from X) — fast, uses IDA's xref index
from_func = X1.0O(callees of X) — uses XrefsFromFuncIterator
No equality filter on to_addr / from_addr / from_func—Full scan: every xref in the database, built once per query — complete, but heavy on a large database

Always filter xrefs by to_addr, from_addr, or from_func. Avoid unconstrained scans.

sql
-- FAST: xrefs to a specific target
SELECT * FROM xrefs WHERE to_addr = 0x401000;

-- FAST: xrefs from a specific source
SELECT * FROM xrefs WHERE from_addr = 0x401000;

-- FAST: all xrefs originating from a function
SELECT * FROM xrefs WHERE from_func = 0x401000;

-- INCOMPLETE/avoid: unconstrained scan falls back to a function-entry cache
SELECT * FROM xrefs WHERE is_code = 1;

Common Xref Patterns

Find Most Called Functions

sql
SELECT f.name, COUNT(*) as caller_count
FROM funcs f
JOIN xrefs x ON f.addr = x.to_addr
WHERE x.is_code = 1
GROUP BY f.addr
ORDER BY caller_count DESC
LIMIT 10;

Find Functions Calling a Specific API

sql
SELECT DISTINCT (SELECT name FROM func_at(from_addr) LIMIT 1) as caller
FROM xrefs
WHERE to_addr = (SELECT addr FROM imports WHERE name = 'CreateFileW');

String Cross-Reference Analysis

sql
SELECT s.content, (SELECT name FROM func_at(x.from_addr) LIMIT 1) as used_by
FROM strings s
JOIN xrefs x ON s.addr = x.to_addr
WHERE s.content LIKE '%password%';

Import Dependency Map

sql
-- Which modules does each function depend on?
SELECT f.name as func_name, i.module, COUNT(*) as api_count
FROM funcs f
JOIN disasm_calls dc ON dc.func_addr = f.addr
JOIN imports i ON dc.callee_addr = i.addr
GROUP BY f.addr, i.module
ORDER BY f.name, api_count DESC;

Data Section References

sql
-- Functions referencing data sections
SELECT
    f.name,
    s.name as segment,
    COUNT(*) as data_refs
FROM funcs f
JOIN xrefs x ON x.from_func = f.addr
JOIN segments s ON x.to_addr BETWEEN s.start_addr AND s.end_addr
WHERE s.class = 'DATA' AND x.is_code = 0
GROUP BY f.addr, s.name
ORDER BY data_refs DESC
LIMIT 20;

Advanced Xref Patterns (CTEs and Recursive Queries)

Prefer call_graph over manual CTEs. The call_graph table uses C++ BFS with a visited set — correct BFS depths, no duplicate expansion on diamond-shaped call graphs, and early termination.

Before (recursive CTE — no visited tracking, exponential on diamond graphs):

sql
WITH RECURSIVE call_chain(root, current_func, depth) AS (
    SELECT 0x401000, callee_addr, 1
    FROM disasm_calls WHERE func_addr = 0x401000
    UNION ALL
    SELECT cc.root, dc.callee_addr, cc.depth + 1
    FROM call_chain cc
    JOIN disasm_calls dc ON dc.func_addr = cc.current_func
    WHERE cc.depth < 10
)
SELECT DISTINCT current_func, MIN(depth) FROM call_chain GROUP BY current_func;

After (call_graph table — C++ BFS with visited set, correct depths):

sql
SELECT func_addr, func_name, depth FROM call_graph
WHERE start = 0x401000 AND direction = 'down' AND max_depth = 10;

Recursive Call Graph — Forward Traversal

Note: For targeted traversal, prefer the call_graph table which uses C++ BFS with visited tracking. Use recursive CTEs only when you need custom join logic (e.g., filtering by callee properties at each step).

Find all functions reachable from a starting function (up to depth 5):

sql
-- Preferred: use call_graph table
SELECT func_name, depth FROM call_graph
WHERE start = (SELECT addr FROM funcs WHERE name = 'main')
  AND direction = 'down' AND max_depth = 5;

-- Manual CTE (when custom filtering is needed at each step):
WITH RECURSIVE cg AS (
    SELECT addr as func_addr, name, 0 as depth
    FROM funcs WHERE name = 'main'

    UNION ALL

    SELECT f.addr, f.name, cg.depth + 1
    FROM cg
    JOIN disasm_calls dc ON dc.func_addr = cg.func_addr
    JOIN funcs f ON f.addr = dc.callee_addr
    WHERE cg.depth < 5
      AND dc.callee_addr != 0
)
SELECT DISTINCT func_addr, name, MIN(depth) as min_depth
FROM cg
GROUP BY func_addr
ORDER BY min_depth, name;

Recursive Call Graph — Reverse (Who Calls This?)

Note: For targeted traversal, prefer the call_graph table with direction = 'up'. Use recursive CTEs only when you need custom join logic.

Trace callers transitively up to depth 5:

sql
-- Preferred: use call_graph table
SELECT func_name, depth FROM call_graph
WHERE start = 0x401000 AND direction = 'up' AND max_depth = 5;

-- Manual CTE (when custom filtering is needed at each step):
WITH RECURSIVE callers_cte AS (
    SELECT DISTINCT dc.func_addr, 1 as depth
    FROM disasm_calls dc
    WHERE dc.callee_addr = 0x401000

    UNION ALL

    SELECT DISTINCT dc.func_addr, c.depth + 1
    FROM callers_cte c
    JOIN disasm_calls dc ON dc.callee_addr = c.func_addr
    WHERE c.depth < 5
)
SELECT (SELECT name FROM funcs WHERE addr = func_addr) as caller, MIN(depth) as distance
FROM callers_cte
GROUP BY func_addr
ORDER BY distance, caller;

CTE: Functions That Both Call malloc AND Check NULL

sql
WITH malloc_callers AS (
    SELECT DISTINCT func_addr
    FROM disasm_calls
    WHERE callee_name LIKE '%malloc%'
),
null_checkers AS (
    SELECT DISTINCT func_addr
    FROM ctree_v_comparisons
    WHERE rhs_num = 0 AND op_name = 'cot_eq'
)
SELECT f.name
FROM funcs f
JOIN malloc_callers m ON f.addr = m.func_addr
JOIN null_checkers n ON f.addr = n.func_addr;

CTE: Memory Allocation Without Free (Potential Leaks)

sql
WITH allocators AS (
    SELECT func_addr, COUNT(*) as alloc_count
    FROM disasm_calls
    WHERE callee_name LIKE '%alloc%' OR callee_name LIKE '%malloc%'
    GROUP BY func_addr
),
freers AS (
    SELECT func_addr, COUNT(*) as free_count
    FROM disasm_calls
    WHERE callee_name LIKE '%free%'
    GROUP BY func_addr
)
SELECT f.name,
       COALESCE(a.alloc_count, 0) as allocations,
       COALESCE(r.free_count, 0) as frees
FROM funcs f
LEFT JOIN allocators a ON f.addr = a.func_addr
LEFT JOIN freers r ON f.addr = r.func_addr
WHERE a.alloc_count > 0 AND COALESCE(r.free_count, 0) = 0
ORDER BY allocations DESC;

EXISTS: Functions With at Least One String Reference

More efficient than JOIN + DISTINCT for existence checks:

sql
SELECT f.name
FROM funcs f
WHERE EXISTS (
    SELECT 1 FROM xrefs x
    JOIN strings s ON x.to_addr = s.addr
    WHERE x.from_func = f.addr
);

EXISTS: Leaf Functions (No Outgoing Calls)

sql
SELECT f.name, f.size
FROM funcs f
WHERE NOT EXISTS (
    SELECT 1 FROM disasm_calls dc
    WHERE dc.func_addr = f.addr
)
ORDER BY f.size DESC;

See Also

  • disassembly — call-site context (disasm_at, disasm_calls, operand-level reads).
  • data — string/data targets behind a to_addr; the canonical pivot when xrefs returns .rdata-only rows.
  • decompiler — calling-code logic and indirect-call resolution via callee types.

Matgeliwwert Fichieren

De Modell liest dës Dateie bei Bedarf, wärend de Skill gelueden ass. Si ginn als liesbar Dateie bereetgestallt a ginn ni ausgeféiert.

Heefeg gestallte Froen

Wat mécht de KI-Skill Xrefs?

Analyze IDA cross-references. Use when asked about callers, callees, imports, data refs, call graphs, or dependency chains.

Firwat Xrefs op TypingMind benotzen?

Well Dir en eemol installéiert a mat all Modell benotze kënnt. Xrefs besteet aus einfachem Markdown amplaz vun ubidderspezifeschem Code. Dee selwechte Skill funktionéiert also mat GPT-5, Claude, Gemini, Grok oder engem lokale Modell – an Dir kënnt de Modell matzen am Chat wiesselen, ouni datt de Skill ophält ze funktionéieren. TypingMind benotzt Är eegen API-Schlësselen, sou datt Dir d'Ubidder direkt bezuelt amplaz vun engem Abonnement pro Benotzerplaz. Är Skills a Chats bleiwen an Ärem eegene Späicher.

Wéi installéieren ech Xrefs an TypingMind?

Maacht an TypingMind Plugins → Skills → Vu GitHub installéieren op a setzt https://github.com/allthingsida/idasql-skills/tree/main/plugins/idasql/skills/xrefs an. TypingMind liest d'Datei SKILL.md, bündelt déi zougehéiereg Dateien an installéiert dat Ganzt als Skill, deen Dir pro Chat aktivéiere kënnt.

Wéi eng KI-Modeller kënnen Xrefs benotzen?

All Modell, deen Dir an TypingMind verbënnt. KI-Skills sinn einfach Markdown-Instruktiounen an net ubidderspezifesche Code. Dofir kënne GPT, Claude, Gemini, Grok a lokal Modeller dëse Skill lueden, wann eng Ufro dozou passt.

Wéi vill KI-Modeller kann ech mat Xrefs benotzen?

Esou vill Dir wëllt. Soulaang e Modell Skills ënnerstëtzt, kënnt Dir Xrefs domat benotzen – GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama a méi – alles op TypingMind mat Ären eegenen API-Schlësselen.

Ass de KI-Skill Xrefs gratis?

De Skill gëtt vum allthingsida op GitHub publizéiert. Kuckt am Repository no de Lizenzbedéngungen. Dir bezuelt nëmmen Ären eegene KI-Ubidder fir d'Token, déi Dir benotzt.

Wat si KI-Skills?

E KI-Skill ass e weiderverwendbaart Pak vun Instruktiounen, dat engem KI-Modell bäibréngt, wéi en eng bestëmmt Aufgab erfëllt. E follegt dem oppenen Agent Skills-Format: eng Datei SKILL.md mat engem Numm an enger Beschreiwung, plus all Scripten, Virlagen oder Referenzdateien, déi de Modell eventuell brauch. De Modell liest d'Instruktiounen eréischt, wann Är Ufro zum Skill passt. En installéierte Skill kascht also näischt, bis e benotzt gëtt.

Wéi ënnerscheede sech KI-Skills vu Plugins oder MCP-Serveren?

E Plugin oder MCP-Server gëtt engem Modell nei Tools, déi en opruffe kann – Code, deen iergendwou leeft an e Resultat zeréckgëtt. E KI-Skill gëtt dem Modell dogéint Wëssen an eng Virgoensweis: wéi en eng Aufgab ugeet, wéi eng Schrëtt en nokënnt a wéi eng gutt Ausgab ausgesäit. Skills bestinn aus einfachem Markdown, brauche kee Server, keen API-Schlëssel a keng Lafzäitëmfeld a funktionéiere mat all Modell.

All weisen

Elo Ären eegene KI-Workspace ariichten

Abonnéiert Iech op eisen Newsletter, fir iwwer nei Funktiounen an zukünfteg Gewënnspiller informéiert ze ginn 👇