[PR #1209] [MERGED] fix(cli): resolve xrefs symbol selectors after address validation #2722

Closed
opened 2026-10-17 21:09:30 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/1209
Author: @N0zoM1z0
Created: 10/9/2026
Status: ✅ Merged
Merged: 10/9/2026
Merged by: @N0zoM1z0

Base: main ← Head: fix/cli-xrefs-symbol-selection


📝 Commits (2)

  • 0c971ec fix(cli): resolve xrefs symbol selectors after address validation
  • de6f384 style(cli): format xrefs fallback call

📊 Changes

5 files changed (+417 additions, -2 deletions)

View changed files

📝 scripts/lib/real-ghidra-entry-aliases.mjs (+64 -0)
📝 src/application/DirectAnalysis.ts (+30 -1)
➕ src/application/XrefsAddressResolution.ts (+81 -0)
➕ tests/composition/directAnalysisXrefs.test.ts (+238 -0)
📝 tests/conformance/ghidra/entry-aliases.c (+4 -1)

📄 Description

Fixes #1186. A valid symbol passed to either rea xrefs selector form was rejected by Ghidra's address parser before lookup. When a provider reports only an address-format rejection, resolve the exact analyzed symbol in the same session and inspect its canonical address. Existing provider-native name resolution and hexadecimal/address-space spellings keep their behavior.

Retain the caller's selector in Evidence. Unknown names return a typed correction; multiple distinct matching addresses require explicit selection; a resolved symbol with no references returns an empty list. Procedure resolution remains available when a provider does not expose a symbol inventory. MCP xrefs keeps its existing address contract.

Validation:

  • Real latest-main reproduction: both named CLI forms fail; the canonical address returns three references.
  • Deterministic baseline: 10 failures and four passing address controls before the fix.
  • 40 focused tests pass, covering symbol/alias/data selectors, ambiguity, empty versus missing results, native name resolution, adjacent validation errors, cancellation, session cleanup, and snapshot replay.
  • npm run build:cached and npm run check:fast pass.
  • Full focused real Linux x64 Ghidra 12.1.4 / JDK 21 regression passes: both CLI forms and address controls agree with MCP for canonical functions, entry aliases, data symbols, and unreferenced symbols; missing names remain errors and source bytes are unchanged. JVM heap is limited to 512 MiB with CPU affinity 0. Verified at 0c971ec6; the only follow-up is a formatting correction to the fallback call.

Real provider coverage is Linux Ghidra. Real Hopper/IDA and native macOS Ghidra execution were not performed for this change.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/1209 **Author:** [@N0zoM1z0](https://github.com/N0zoM1z0) **Created:** 10/9/2026 **Status:** ✅ Merged **Merged:** 10/9/2026 **Merged by:** [@N0zoM1z0](https://github.com/N0zoM1z0) **Base:** `main` ← **Head:** `fix/cli-xrefs-symbol-selection` --- ### 📝 Commits (2) - [`0c971ec`](https://github.com/morluto/rea/commit/0c971ec6eecfd9547f1e946b1dec6c4097479761) fix(cli): resolve xrefs symbol selectors after address validation - [`de6f384`](https://github.com/morluto/rea/commit/de6f3843c8a0dc22c40dc6028e589561f4973b97) style(cli): format xrefs fallback call ### 📊 Changes **5 files changed** (+417 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `scripts/lib/real-ghidra-entry-aliases.mjs` (+64 -0) 📝 `src/application/DirectAnalysis.ts` (+30 -1) ➕ `src/application/XrefsAddressResolution.ts` (+81 -0) ➕ `tests/composition/directAnalysisXrefs.test.ts` (+238 -0) 📝 `tests/conformance/ghidra/entry-aliases.c` (+4 -1) </details> ### 📄 Description Fixes #1186. A valid symbol passed to either `rea xrefs` selector form was rejected by Ghidra's address parser before lookup. When a provider reports only an address-format rejection, resolve the exact analyzed symbol in the same session and inspect its canonical address. Existing provider-native name resolution and hexadecimal/address-space spellings keep their behavior. Retain the caller's selector in Evidence. Unknown names return a typed correction; multiple distinct matching addresses require explicit selection; a resolved symbol with no references returns an empty list. Procedure resolution remains available when a provider does not expose a symbol inventory. MCP `xrefs` keeps its existing address contract. Validation: - Real latest-main reproduction: both named CLI forms fail; the canonical address returns three references. - Deterministic baseline: 10 failures and four passing address controls before the fix. - 40 focused tests pass, covering symbol/alias/data selectors, ambiguity, empty versus missing results, native name resolution, adjacent validation errors, cancellation, session cleanup, and snapshot replay. - `npm run build:cached` and `npm run check:fast` pass. - Full focused real Linux x64 Ghidra 12.1.4 / JDK 21 regression passes: both CLI forms and address controls agree with MCP for canonical functions, entry aliases, data symbols, and unreferenced symbols; missing names remain errors and source bytes are unchanged. JVM heap is limited to 512 MiB with CPU affinity 0. Verified at `0c971ec6`; the only follow-up is a formatting correction to the fallback call. Real provider coverage is Linux Ghidra. Real Hopper/IDA and native macOS Ghidra execution were not performed for this change. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-17 21:09:30 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#2722
No description provided.