Add lambdas names-filter selector cases to checkSelectors: - names: ['start'] returns the matching lambda with resolved fields - names: ['missing'] returns an empty page Add a chunks no-match case: - names: ['Xyzz'] returns an empty page for an absent chunk tag Also clarify in docs/erlang-beam.md what names selects for each collection: the four-character IFF tag for chunks, the resolved function name (never null) for lambdas, and the decoded atom name string for atoms. Co-authored-by: Saiyam Jain <saiyam@example.com>
6.4 KiB
Erlang BEAM files
inspect_erlang_beam / inspect-erlang-beam answers whether one selected
local file is a FOR1/BEAM IFF container, which chunks that form stores, and
which atom, export, import, lambda, and Code-header fields those chunks carry.
It reads the file without executing bytecode and does not require an Erlang
installation or BEAM emulator.
rea inspect-erlang-beam /absolute/path/to/app.beam --json
The CLI resolves relative paths against the caller's working directory. MCP requires an absolute filesystem path and preserves that exact selection:
{
"name": "inspect_erlang_beam",
"arguments": { "path": "/artifacts/app.beam" }
}
Observations
The inline Evidence result contains the artifact path, SHA-256, and byte length.
chunks lists every IFF chunk name, file range, and payload SHA-256.
Repeated names retain separate chunk occurrences. Decoded tables and the Code
header use the last occurrence of each name, matching OTP's loader; the chunk
inventory still exposes earlier payloads and their source ranges.
The BEAM form size bounds the parsed chunks. Bytes after the declared form are
ignored by the parser but remain part of the selected artifact's byte length
and SHA-256.
When a selected AtU8 or Atom table is decoded, atoms is the 1-based name table and
module is atom 1. Both the pre-OTP 28 table and the OTP 28+ compact table
(negated count, compact-encoded name lengths) are read. exports, imports, and lambdas resolve atom indices to
those names when the table is present; unresolved indices keep function or
module null.
code reports the Code chunk instruction-set, opcode maximum, label count,
function count, and the instruction stream's file range. Missing optional
tables are null, not empty-everywhere.
A zero-byte AtU8 falls back to an available legacy Atom table, following
OTP 20.3's atom selection.
A nonempty AtU8 retains UTF-8 precedence, including an explicit zero atom
count; malformed nonempty data fails instead of falling back. An empty atom
chunk without an alternate table still fails its required count header.
Absent and zero-byte optional FunT chunks produce lambdas: null, while a
four-byte zero row count produces lambdas: []. This follows