Skip to content

Add MSVC demangler correctness fixes and generated test corpus#8140

Draft
plafosse wants to merge 4 commits intodevfrom
test_ms_demangler_fixes
Draft

Add MSVC demangler correctness fixes and generated test corpus#8140
plafosse wants to merge 4 commits intodevfrom
test_ms_demangler_fixes

Conversation

@plafosse
Copy link
Copy Markdown
Member

This is quite a substantial refactor of the msvc demangler which solves pretty much all known de
mangler accuracy issues.

Major changes:

  • Demangling now is backed by the DemangledTypeNode like gnu3 is. The purpose is
    to provide an abstraction layer between c++ features and binary
    ninja's type objects.
  • Substantial performance increase I think around 3x what it was before
    this is due to cutting down on extraneous string copies and type object allocations
  • Substantial accuracy fixes. The most substantial of which is accurate scoping
    of back references.
  • Lots and lots of other small fixes. This commit could have been about 100 commits but
    I didn't feel that adding all those commits would be helpful in understanding what's
    actually going on here.

Fixes:

@plafosse plafosse self-assigned this Apr 30, 2026
@plafosse plafosse force-pushed the test_ms_demangler_fixes branch from 3ee5290 to 6b58d2e Compare May 1, 2026 20:40
plafosse added 4 commits May 2, 2026 07:18
Fix demangler backrefs and type-node formatting

Fix MSVC demangler parsing for scoped backrefs, template and
local-name contexts, member pointers, enum signedness, varargs,
RTTI names, thunks, and pointer/function modifier edge cases.

Update shared demangled type-node construction and GNU3 pointer suffix
formatting so demangled types produce stable type/name strings without
encoding invalid intermediate types.

Fix MSVC member function pointer demangling

Parse P8 member function pointer types as member pointers instead of
plain function pointers, preserving the owning class in the demangled
type node. Keep finalization returning a real Type so callers retain
callable type information, even though Binary Ninja cannot represent
exact C++ member function pointer declarator placement.

Move implicit this handling into DemangledTypeNode finalization so
top-level function Types receive a synthetic this parameter, while
stringified nested/template symbols omit it.

Also tighten nested function pointer parsing so implicit this is not
added to function pointer parameter and return types.
@plafosse plafosse force-pushed the test_ms_demangler_fixes branch from 6b58d2e to 4b906ea Compare May 2, 2026 11:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant