Command Palette

Search for a command to run...

Назад к скиллам
скилл № 84321

xrefs

Analyze radare2 cross-references via r2xsql — callers, callees, data references, jump targets. Use when asked who calls a function, what a function calls, or…

БесплатноБез исполняемых скриптов
radareorgот radareorg★ 23 звезды на GitHub

Установить xrefs в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Об этом скилле

When to use

Pick this skill when the question involves edges in the code graph:

  • "who calls function X?"
  • "what does function X call into?"
  • "where is string Y used?"
  • "which functions reach this import?"

For inspecting a function's own code, use disassembly. For finding string/import name patterns, use data.

Tables

table source columns
xrefs host's global in-process xref store from_addr, to_addr, type, from_func, is_code, is_data, kind

Unfiltered scans read r_anal_refs_get with UT64_MAX, including references whose source is outside every analyzed function. Each reference appears once, even with overlapping functions. to_addr and from_addr predicates select from that same store. WHERE from_func = X scopes outgoing references to a real function start address; its from_func value is the owning function's address, or NULL when the source is outside all functions.

Start with the views

Three views answer most cross-reference questions directly, with names already resolved, and they carry the same columns in every tool of this family — so a query written here works against idasql/bnsql/ghidrasql unchanged.

view one row per columns
callers edge into a function func_addr, caller_addr, caller_name, caller_func_addr
callees edge out of a function func_addr, func_name, callee_addr, callee_name
string_refs code→string reference string_addr, string_value, string_length, ref_addr, func_addr, func_name
-- who calls this function, by name
SELECT caller_name, caller_addr FROM callers WHERE func_addr = 0x401000;

-- what this function calls, imports included
SELECT callee_name, callee_addr FROM callees WHERE func_addr = 0x401000;

-- which function reads which string
SELECT func_name, string_value FROM string_refs WHERE string_value LIKE '%license%';

An edge is a code reference whose target is a function or an import (a tail call compiles to a jump, so CODE/JUMP count, and in radare2 an import is not a function — calls into imports would be missed by a functions-only rule). caller_name/func_name/callee_name never come back NULL; an unresolvable name falls back to sub_<ADDR>. References belonging to no function are excluded — see the from_func caveat below.

Drop to the xrefs table itself when you need data references, a specific type, or an edge whose target is neither a function nor an import.

from_func is an address

from_func is the address of the function the reference originates in — not a name — so it joins directly against funcs.addr, and the whole call graph can be walked in address space. It is NULL when the source lies outside every analyzed function, so use LEFT JOIN (or WHERE from_func IS NOT NULL) when that case matters.

-- name the caller
SELECT f.name AS caller, x.from_addr, x.type
FROM xrefs x LEFT JOIN funcs f ON f.addr = x.from_func
WHERE x.to_addr = 0x401000;

is_code / is_data

Two 0/1 columns derived from type, so you never have to spell out radare2's strings: is_code = 1 for CALL/CODE/JUMP/ICOD, is_data = 1 for DATA/STRN. A UNKN/NULL ref is neither — no row is ever both, so the pair partitions the classified refs cleanly.

kind — r2xsql's own small vocabulary, not a family standard

Deviation, not a family standard — read this before assuming portability. kind is a free normalization of type (no new radare2 command — it's computed from the value already fetched for that column) into a smaller, human-facing set: call / jump / code / data / unknown. It is r2xsql's OWN classification, a deliberate, owner-approved deviation — no vocabulary has been agreed across the tool family yet for xrefs (see entities.kind in the grep skill for the same kind of deviation on a different table). Never assume a sibling tool's kind spelling matches these values.

type kind why
CALL call the single most common query shape ("who calls X") keeps its own bucket
JUMP jump a distinct control-flow shape from a call (no return expected)
CODE, ICOD code ICOD (indirect code) carries no more specific call/jump shape than CODE, so it groups with it
DATA, STRN data a string ref is a data ref to a specific kind of memory; kind stays coarse and drops that subtype
UNKN, NULL, absent unknown mirrors is_code/is_data already treating these as neither
-- every call edge, without n
Полный SKILL.md на GitHub

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

  1. 01Bash
  2. 02Read

FAQ

Что делает скилл xrefs?

Analyze radare2 cross-references via r2xsql — callers, callees, data references, jump targets. Use when asked who calls a function, what a function calls, or what code touches a string/import.

Как установить скилл xrefs?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл xrefs запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить xrefs с