Skip to content
Open
Show file tree
Hide file tree
Changes from 64 commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
4d3b7a1
feat(ghidra): admit caller-selected matching dSYM companions
jimpablo Oct 12, 2026
f0eb9c4
fix(targets): partition dSYM identity and match the selected slice
jimpablo Oct 12, 2026
104601e
fix(targets): keep legacy query ids and bound companion admission
jimpablo Oct 12, 2026
c219cb9
fix(targets): bound uuid walking and carry companion provenance
jimpablo Oct 12, 2026
ab3bf42
fix(contracts): budget command spans and partition companions by path
jimpablo Oct 12, 2026
11e1002
fix(ghidra): commit companion identity in the analysis profile
jimpablo Oct 12, 2026
731f243
fix(targets): carry companion identity through split mach-o variants
jimpablo Oct 12, 2026
03f9058
fix(targets): charge traversal reads and bound staged member copies
jimpablo Oct 13, 2026
d3fe4a0
fix(ghidra): document and enforce dSYM admission resource budgets
morluto Oct 13, 2026
dbf8d2c
fix(ghidra): preserve dSYM resource refusals and staging coverage
morluto Oct 13, 2026
dea1571
fix(ghidra): stream dSYM UUID commands through their format owner
morluto Oct 13, 2026
437eb2d
fix(ghidra): retain dSYM input ownership and shared format semantics
morluto Oct 13, 2026
26effd7
fix(ghidra): preserve dSYM companion admission facts
morluto Oct 13, 2026
0ab02a0
fix(ghidra): retain failed source copy owners
morluto Oct 13, 2026
58af2fb
fix(targets): settle merged companion types and heap stub props
jimpablo Oct 14, 2026
7bafafc
fix(macho): retain dSYM admission resources
morluto Oct 13, 2026
71cee08
fix(ghidra): preserve dSYM identity and cleanup failures
morluto Oct 13, 2026
7e7d3d2
fix(targets): settle merged types, heap stub props, and split oversiz…
jimpablo Oct 14, 2026
b735fd3
fix(ghidra): rebase onto main, drop hanging copy helper, restore staging
jimpablo Oct 27, 2026
529d444
fix(targets): settle second rebase: weave dsym admission into new res…
jimpablo Oct 28, 2026
07da6f1
fix(targets): restore upstream code dropped during rebase
jimpablo Oct 28, 2026
1a2fa6a
fix(contracts): omit debug_companion from bare Mach-O summaries
jimpablo Oct 28, 2026
0b4ae16
fix(targets): address companion admission review findings
jimpablo Oct 28, 2026
aa20d1d
Merge remote-tracking branch 'upstream/main' into feat/dsym-companion…
jimpablo Nov 5, 2026
6b32456
Merge remote-tracking branch 'upstream/main' into feat/dsym-companion…
jimpablo Nov 5, 2026
4483d21
fix(ghidra): harden dSYM companion admission, staging ownership, and …
jimpablo Nov 5, 2026
a7e17e6
Merge remote-tracking branch 'upstream/main' into feat/dsym-companion…
jimpablo Nov 5, 2026
d90dcca
fix(ghidra): preserve dSYM cleanup primary causes and reuse Mach-O lo…
jimpablo Nov 5, 2026
8bec33a
Merge remote-tracking branch 'upstream/main' into feat/dsym-companion…
jimpablo Nov 5, 2026
c50d6f5
fix(ghidra): reject dsym_path in existing-project mode and enforce de…
jimpablo Nov 5, 2026
636d664
Merge remote-tracking branch 'upstream/main' into feat/dsym-companion…
jimpablo Nov 5, 2026
30e21fa
fix(macho): separate companion EOF truncation from traversal budget a…
jimpablo Nov 5, 2026
97a2e09
Merge remote-tracking branch 'upstream/main' into feat/dsym-companion…
jimpablo Nov 5, 2026
fbef489
fix(cli): reuse absoluteLocalPathStringSchema for --dsym-path option
jimpablo Nov 5, 2026
f51fb61
fix(macho): clamp initial UUID prefix reads to remaining traversal bu…
jimpablo Nov 5, 2026
2c150cb
Merge remote-tracking branch 'upstream/main' into feat/dsym-companion…
jimpablo Nov 8, 2026
417b628
fix(dsym): enforce .dSYM bundle directory naming and pin companion di…
jimpablo Nov 8, 2026
0988275
fix(dsym): preserve close cancellation, reject ambiguous FAT slices, …
jimpablo Nov 8, 2026
390918f
Merge remote-tracking branch 'upstream/main' into feat/dsym-companion…
jimpablo Nov 8, 2026
a0cac2a
fix(dsym): preserve close cancellation during directory and staging c…
jimpablo Nov 8, 2026
a84c8a8
Merge remote-tracking branch 'upstream/main' into feat/dsym-companion…
jimpablo Nov 8, 2026
6a32f35
fix(dsym): preserve member and directory refusals over final-close ca…
jimpablo Nov 8, 2026
c72fb30
docs(specs): add Mach-O dSYM companion feature specification
jimpablo Nov 8, 2026
dd33451
docs(specs): align module and checkpoint test paths in dsym plan
jimpablo Nov 8, 2026
a6f3b94
docs(specs): match symlink policy and saved-project error contract
jimpablo Nov 8, 2026
ca7d919
Merge remote-tracking branch 'upstream/main' into feat/dsym-companion…
jimpablo Nov 8, 2026
c50bf0d
fix(dsym): skip checkpoint restaging and harden companion identity
jimpablo Nov 8, 2026
2152709
test(mcp): validate session dsym_path outputs via toolContract
jimpablo Nov 8, 2026
4d3ad8f
fix(dsym): retain both companion and target cleanup owners on dual cl…
jimpablo Nov 8, 2026
57f2edc
fix(dsym): reject duplicate FAT target CPU identities before slice na…
jimpablo Nov 8, 2026
9560a44
fix(dsym): keep post-admission member read faults fatal across close …
jimpablo Nov 9, 2026
9f36e1f
fix(dsym): use tagged member failure union and guard opaque abort rea…
jimpablo Nov 9, 2026
bdd456e
Merge remote-tracking branch 'upstream/main' into feat/dsym-companion…
jimpablo Nov 10, 2026
616d5dc
chore(dsym): merge upstream/main and remove unused imports
jimpablo Nov 10, 2026
3f8c9ce
chore(dsym): restore upstream files modified by lint-staged during merge
jimpablo Nov 10, 2026
92d9d79
Merge remote-tracking branch 'upstream/main' into feat/dsym-companion…
jimpablo Nov 11, 2026
b244242
Merge remote-tracking branch 'upstream/main' into feat/dsym-companion…
jimpablo Nov 15, 2026
ea7612b
fix(contracts): preserve headerless issues alongside dsym_path and ex…
jimpablo Nov 15, 2026
03b3ff8
chore(dsym): restore upstream javascriptStaticAnalysis modified by li…
jimpablo Nov 15, 2026
4d761f9
Merge remote-tracking branch 'upstream/main' into feat/dsym-companion…
jimpablo Nov 16, 2026
858d124
Merge remote-tracking branch 'upstream/main' into feat/dsym-companion…
jimpablo Nov 16, 2026
65d40a3
Merge remote-tracking branch 'upstream/main' into feat/dsym-companion…
jimpablo Nov 17, 2026
b32d1bf
Merge remote-tracking branch 'upstream/main' into feat/dsym-companion…
jimpablo Nov 21, 2026
cbddb9d
test(target): verify dsym_path rejection on Hopper and IDA databases
jimpablo Nov 21, 2026
336d28c
fix(ghidra): preserve dSYM parse failures, refusals, and staging owne…
jimpablo Nov 21, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/.vitepress/documentation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -608,6 +608,11 @@ export const documentationSections = [
source: "providers/raw-binary.md",
route: "/raw-binary",
},
{
text: "Mach-O dSYM companion",
source: "providers/dsym.md",
route: "/dsym",
},
{
text: "IDA provider",
source: "providers/ida-provider.md",
Expand Down
1 change: 1 addition & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ The [REA website](https://rea.tools/) has worked examples and product pages.
- [RISC-V ELF analysis through Ghidra](providers/ghidra-riscv.md)
- [Windows Ghidra P0](providers/windows-ghidra-p0.md)
- [Headerless raw-binary analysis with Ghidra](providers/raw-binary.md)
- [Mach-O dSYM companion](providers/dsym.md)
- [IDA provider](providers/ida-provider.md)
- [JEB instrumentation and analysis](providers/jeb-analysis.md)
- [GameCube DOL analysis through Ghidra](ghidra-dol.md)
Expand Down
85 changes: 85 additions & 0 deletions docs/providers/dsym.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# Mach-O debug companion analysis with Ghidra
Comment thread
jimpablo marked this conversation as resolved.
Resolved

REA can admit a caller-selected `.dSYM` bundle beside a Mach-O executable so
Ghidra's DWARF analysis recovers parameter names, data types, and source-anchored
type identity that the stripped executable cannot provide. The companion is
never inferred: REA stages it only when the caller selects it, and only when it
provably belongs to the target.

## Open and inspect

```bash
rea inspect /absolute/path/to/pair --provider ghidra --dsym-path /absolute/path/to/pair.dSYM --json
rea function /absolute/path/to/pair _pair_sum --provider ghidra --dsym-path /absolute/path/to/pair.dSYM --json
```

```json
{
"name": "open_binary",
"arguments": {
"path": "/absolute/path/to/pair",
"dsym_path": "/absolute/path/to/pair.dSYM",
"provider_id": "ghidra"
}
}
```

`dsym_path` names a `.dSYM` bundle directory whose `Contents/Resources/DWARF`
member carries the target image's `LC_UUID`. Admission rejects the request as
caller input — `invalid_request` / `invalid_input` with the
`debug_companion_rejected` constraint — when the bundle is missing, is not a
`.dSYM` bundle directory, or contains no DWARF member whose UUID matches the
target. A target without any `LC_UUID` cannot be matched and is rejected
explicitly. Omitting `dsym_path` keeps today's behavior: the executable is
analyzed alone.

`dsym_path` applies only to detected Mach-O executable targets
(`mach-o` and `mach-o-universal`); pairing it with `format=raw-binary` or
`format=dos-com` is rejected. Only fresh Ghidra imports stage the companion
today: `REA_GHIDRA_PROJECT_PATH` opens a saved program with
`-process -noanalysis` and rejects `dsym_path` instead of ignoring it; other
providers leave `dsym_path` unused.

## How the companion reaches Ghidra

Ghidra's `DSymSectionProvider` locates external DWARF by strict file naming:
`<executable name>.dSYM/Contents/Resources/DWARF/<executable name>` beside the
imported binary. REA imports a private, digest-verified snapshot of the target,
so the original bundle beside the original file is never visible to the
session. Admission therefore stages the matched DWARF member inside REA's
private runtime root under the snapshot's name, with the caller's bundle
untouched. The staged member's SHA-256, the source bundle path, and the matched
UUID are retained as target-admission evidence.

On a compiled fixture (`clang -O0 -g`, linked, `dsymutil`) a function analyzed
without the companion reports `signature_source: "default"` and low return-type
confidence; with the matching companion the same function reports
`signature_source: "imported"`, a by-value `Pair` parameter with the original
parameter name, field names in pseudocode, and the DWARF type path in value
flow.

## Limitations

- UUID matching is REA-side and mandatory; Ghidra itself does not verify that a
located dSYM belongs to the imported image.
- Only the DWARF member that carries the matching UUID is staged; source file
contents referenced by DWARF are not resolved.
- The selected architecture slice of a universal target must be covered by a
matching member UUID in the bundle; per-slice selection inside the bundle is
not exposed.
Comment thread
greptile-apps[bot] marked this conversation as resolved.
Resolved
- A member UUID matches only when it is declared by a single member image or
slice with the selected target slice's own CPU type and base CPU subtype, so a
UUID repeated under another CPU (for example an `arm64e` or `x86_64h`
sibling) is never staged for the selected slice, and a universal target or
member that repeats an applicable CPU identity is rejected as ambiguous rather
than staged.
- Admission examines at most 16 DWARF directory entries, including entries
that are not regular files. The matched member may be at most 1 GiB, and at
most 1 GiB is digested across all matching members; hard links and copies
that share one file identity are digested once. These limits are fixed and
cannot be raised at runtime.
- UUID traversal incrementally reads command headers and UUID payloads with a
cached window of at most 64 KiB. Large command bodies are skipped rather than
allocated or classified as malformed solely for their size. At most 64 MiB
is read across the target and all member candidates; this is an explicit
workflow I/O budget, rather than a Mach-O format limit.
1 change: 1 addition & 0 deletions docs/user-visible-errors.csv
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ BinaryTargetError,constraint=wasm_requires_static_inspection; read permission de
BinaryTargetError,constraint=file_format_rejected,target_unavailable,unsupported_target,false
BinaryTargetError,constraint=file_format_rejected; read permission denied,access_denied,unsupported_target,false
BinaryTargetError,constraint=load_selection_rejected,invalid_request,invalid_input,false
BinaryTargetError,constraint=debug_companion_rejected,invalid_request,invalid_input,false
BinaryTargetError,constraint=bundle_type_unsupported,target_unavailable,unsupported_target,false
BinaryTargetError,constraint=bundle_type_unsupported; read permission denied,access_denied,unsupported_target,false
BinaryTargetError,constraint=bundle_info_plist_decode_budget_exceeded,target_unavailable,unavailable,false
Expand Down
2 changes: 1 addition & 1 deletion scripts/verify/advertised-schemas/tools/open_binary.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"schemas": {
"input compact": "706f1985ca397688",
"input compact": "1c85e3a7e690842d",
"output compact": "9cda19dfa1310afa"
},
"patterns": {
Expand Down
Loading
Loading