Repository navigation
[AUTOMATED] fix(cli): take the C spelling of a Mach-O name, and stop calling every miss stripped - #701
Merged
Conversation
…calling every miss stripped Mach-O stores a C identifier with a leading underscore, so `int main(void)` is `_main` in the symbol table and the name a caller reads in the source selected nothing. Name lookup now tries the name as given first and retries it decorated only on a miss, scoped to the container that decorates, so an image carrying both spellings still answers the one it was asked. The miss itself advised `--addr` "for a stripped binary" whatever the image held. `EntryLookupError::NotFound` now carries the near spelling and how many entries carry a name the image supplied; the stripped-binary advice is what the CLI says when that count is zero. Closes #666. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_015ocFS1B6rT3wfWcQsuwE6B
mahaloz
force-pushed
the
fix/macho-name-lookup
branch
from
September 21, 2026 17:17
f798e42 to
ea0aec4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The problem
Mach-O stores a C identifier with a leading underscore, so the name a caller
reads in the source selects nothing — and the miss advises
--addr"for astripped binary" on an image whose symbols are all present.
The fix
underscore only on a miss, so an image that carries both
mainand_mainstill answers
mainwithmain. The decoration is a property of thecontainer, read off its magic at load, so ELF/PE/COFF gain no underscore they
never had. The reverse direction (
_mainagainst an image spelling itmain)is not added — that name is already one the image carries.
EntryLookupError::NotFoundnow carries the near spelling and how manyentries carry a name the image supplied. The stripped-binary advice is what
the CLI says when that count is zero; otherwise the miss names the near
spelling, or says how many names the image does have.
The tests
Four cases in
verify_entry_selectors.rsand four inname_miss_cli.rs: theMach-O C spelling resolves, an ELF
startstays a miss and names_start, anamed image is not reported as stripped, and a placeholder-only one still is.
Each fails on the unpatched tree. A
tests/cli/probe pins the Mach-Oresolution. 675/675 datatests, stages PARITY OK, workspace suite green,
make test-cli215/215.🤖 Generated with Claude Code
https://claude.ai/code/session_015ocFS1B6rT3wfWcQsuwE6B