Home

demangling

Demangling is the process of converting a mangled symbol name produced by a compiler into a human-readable form. Name mangling encodes information such as namespaces, classes, overloads, and function signatures into a single symbol in the object file. This enables languages with features like overloading or templates to generate unique linker symbols, but makes raw symbols difficult to read. Demangling is used in error messages, stack traces, debuggers, and profiling tools to present comprehensible identifiers.

Most C++ implementations use an ABI-specific mangling scheme, such as the Itanium C++ ABI. For example, the

Limitations of demangling include its language- and ABI-specific nature; a demangled name is accurate only within

mangled
symbol
_ZN3foo3barEv
corresponds
to
the
function
foo::bar().
Demangling
is
performed
by
language-
or
ABI-specific
utilities
that
implement
the
same
encoding
rules
the
compiler
uses.
Common
tools
include
c++filt
(from
GNU
binutils)
and
the
C++
ABI
demangler
abi::__cxa_demangle
in
libstdc++,
or
clang’s
demangling
facilities.
Other
languages
have
their
own
schemes
and
dedicated
demanglers,
such
as
rustfilt
for
Rust
and
various
Swift
demanglers,
often
available
as
part
of
debugging
toolchains.
the
context
of
the
same
encoding
rules.
Demangled
output
usually
conveys
the
high-level
signature
but
may
not
restore
full
debugging
information
such
as
parameter
names
or
template
parameter
details
beyond
what
the
symbol
encodes.
In
stripped
or
heavily
optimized
binaries,
information
may
be
incomplete,
but
demangling
remains
a
standard
aid
for
interpreting
linker
symbols
and
runtime
traces.