Files
rea/docs/guides/native/dwarf-units.md
T
Lewis WangandClaude Opus 5.5 92b082bcaf fix(macho)!: select arm64e.x1 slices of universal Mach-O files by exact subtype (#14881)
* fix(macho): select arm64e.x1 slices of universal Mach-O files by exact subtype

macOS 27 system binaries such as /bin/ls and /usr/bin/codesign hold
x86_64, arm64e and arm64e.x1 slices. The caller's architecture selector
counted arm64e.x1 as arm64e and had no value of its own for it, so
inspect_native_initializers, inspect_go_binary, inspect_rust_binary and
inspect_dwarf_units refused arm64e as matching several slices and
rejected arm64e.x1 as an argument. Neither arm64e slice could be read.

Name each arm64e subtype exactly, as lipo -thin and otool -arch do:
arm64e reads only the arm64e slice and the new arm64e.x1 value only the
arm64e.x1 slice. arm64 keeps reading its family's only slice. A refusal
and the unread-slice limitation now offer arm64e.x1 where it selects one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(macho): record the advertised schemas that accept arm64e.x1

The architecture enum of inspect_native_initializers, inspect_go_binary,
inspect_rust_binary and inspect_dwarf_units gained arm64e.x1, which
changes their advertised input schemas. Commit the regenerated summaries
so verify-advertised-schemas matches the catalog.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(macho): check the selected DWARF slice subtype and document arm64e.x1

inspect_dwarf_units accepted a report whose CPU family matched the
request, so an arm64e or arm64e.x1 request answered by the other arm64e
slice still produced Evidence. Validate the report's selected_slice with
machoSelectionAnswersArchitecture, as the initializer, Go and Rust
readers do.

The tool's architecture field, its CLI option and dwarf-units.md still
described a CPU family and listed only x86, x86_64, arm and arm64. Name
arm64e and arm64e.x1 and their exact-subtype rule there as well.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 10:56:06 -05:00

4.6 KiB

DWARF compile units

inspect_dwarf_units / inspect-dwarf-units reads compile-unit headers and the unit DIE from one selected local ELF, Mach-O, or PE image. It covers DWARF 2 through 5, including compressed ELF sections. It does not execute the image and does not require a disassembler.

rea inspect-dwarf-units /absolute/path/to/program --json

The CLI resolves relative paths against the caller's working directory. MCP requires an absolute filesystem path:

{
  "name": "inspect_dwarf_units",
  "arguments": { "path": "/artifacts/program" }
}

A universal Mach-O needs architecture (x86, x86_64, arm, arm64, arm64e, or arm64e.x1). A CPU family with one slice is selected by its family name; arm64e and arm64e.x1 each read only a slice of that subtype, as lipo -thin does. When several slices share the family, arm64 reads the arm64 (or arm64v8) slice and x86_64 the canonical x86_64 slice, and a value that matches no slice or several is refused. The same value is rejected for every other image. A .dSYM bundle is not opened. Pass the DWARF file inside the bundle.

Observations

Each call returns the artifact path, SHA-256, and byte length, the container format, and sections for .debug_info, .debug_abbrev, .debug_str, .debug_line_str, and .debug_str_offsets when those sections are file-backed. Section rows keep the stored name, file offset, stored size, and compression (none, zlib, or zstd). ELF SHF_COMPRESSED zlib and zstd payloads, and legacy GNU .zdebug_* and Mach-O __zdebug_* zlib payloads, are decompressed within max_decompressed_bytes (default 256 MiB, at most 1 GiB, CLI --max-decompressed-bytes), which budgets decompression across every compressed section of the image, charging the larger of each section's declared uncompressed size and compressed payload length (including failed attempts). A declared size or cumulative charge above it fails the call with details.limit; because sections decompress in turn, the refusal reports no required_value. Mach-O sections are read only from the __DWARF segment. omissions gives one row per section name and reason, with a count when several sections share it.

units lists the requested page. offset and limit select that page. total_units counts framed units in this file, up to the walk cap. Each unit row gives its offset inside decompressed .debug_info, DWARF version, unit type when the header has one, address size, name, comp_dir, producer, language code and DWARF 5 language name, dwo_name, stmt_list, and whether DW_AT_low_pc is present. file_offset is null when .debug_info is compressed. Per-unit decode problems are issues. The walk continues when the unit length still frames the next unit.

Coverage and limits

coverage.status is complete when every framed unit was visited. Gaps inside a visited unit stay in that unit's issues, so complete does not mean every fact resolved. partial means a later length could not frame the next unit, the walk cap was reached, a declared .debug_info could not be decoded, a further .debug_info section was not read, or attribute decoding used up its shared work allowance. Each form read and each DW_FORM_indirect hop costs one step of that allowance; units read after it runs out report decode_budget. A .dwo object is partial because its .debug_info.dwo is not read. debug_info is absent when this file declares no .debug_info, or declares one that stores no bytes; coverage is then complete with no units. That does not establish that a separate debug file is absent. For ELF and PE, the limitations then name whether .gnu_debuglink was observed. .gnu_debuglink contents and GNU build-id notes are not decoded here.

Child DIEs, types, functions, line tables, and location expressions are not read. An unknown DWARF form becomes a unit issue that names the form code. DW_AT_str_offsets_base is applied to strx indexes in the same DIE regardless of attribute order. dwo_name reads DW_AT_dwo_name and the GNU DW_AT_GNU_dwo_name.

An ET_REL image whose debug relocations are unapplied holds placeholders in its relocated fields. DW_AT_stmt_list, DW_AT_str_offsets_base, and DW_FORM_strp, DW_FORM_line_strp, DW_FORM_strx, and DW_FORM_GNU_str_index values stay unresolved. The abbreviation offset selects a table only when .debug_abbrev holds one table. Otherwise, as in ld -r output, abbrev_offset is null, the unit reports unapplied_relocation, and its DIE is not read.

The verification record lists the compiled variants compared with a DWARF dumper.