Repository navigation
Conversation
[AUTOMATED] C++ backends report one spelling of a method and print another: angr reports the mangled symbol but prints ns::Class::method, and Fission prints an escaped identifier. Replacing only the reported name left the definition unrenamed, so its decompiled CFG never matched the DWARF source CFG. Also rename the declarator of the first top-level definition. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This branch has not been deployed
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.
Problem
_relabel_to_dwarfrenames a decompiled function by substituting the name its backend reported (fd.name) with the DWARF name. For C++ methods the backends report one spelling and print another:fd.name_ZN6snappy22UncheckedByteArraySink15GetAppendBufferEmPcsnappy::UncheckedByteArraySink::GetAppendBuffer(...)snappy::Sink::GetAppendBuffer(unsigned long, char*)fission_symbol_snappy_x3A__x3A_Sink_x3A__x3A_GetAppendBuffer(...)snappy::Sink::GetAppendBuffersnappy::Sink::GetAppendBuffer(...)Only Kuna's substitution applies. Elsewhere, the decompiled CFG is keyed by the printed spelling and never matches the DWARF-named source CFG, so GED drops the function.
Change
After the existing substitution, find the declarator of the first top-level definition in the decompiled code and rename that spelling to the DWARF name as well. Comments, prototypes and typedefs before the definition are skipped. A DWARF name that is not a C identifier (
~Sink,operator==) is left alone, because substituting it would turn valid decompiled C into invalid C.Evidence
Local C++ corpus: ninja, double-conversion and snappy built for aarch64 at O0, O2 and O2-noinline, decompiled from stripped binaries. On snappy O0, decompiled functions whose name has a matching decompiled CFG:
Across the whole local corpus, scored GED rows with a non-strict parser rose from 3,814 to 4,192, mostly from angr and Fission. This is a local measurement, not an official ranking.
Testing
tests/test_relabel_definition_names.py(13 cases) covers the printed spellings of angr, Fission, Kuna and Ghidra, prototypes before the definition, and a destructor.Not measured
The published C corpus was not re-run. For C functions the printed and DWARF names normally agree after the existing substitution, so the new step is expected to be a no-op there. A maintainer re-run of the GED overlay would confirm it.
🤖 Generated with Claude Code