4 releases (breaking)

new 0.4.0 Nov 9, 2025
0.3.0 Oct 12, 2025
0.2.0 Sep 28, 2025
0.1.0 Sep 18, 2025

#281 in Debugging

Download history 263/week @ 2025-09-17 286/week @ 2025-09-24 63/week @ 2025-10-01 311/week @ 2025-10-08 81/week @ 2025-10-15 22/week @ 2025-10-22 69/week @ 2025-10-29 81/week @ 2025-11-05

277 downloads per month
Used in g2dem

MIT/Apache

3MB
2K SLoC

gnuv2_demangle

Build Status Latest Version Crates.io MSRV Api Rustdoc

A GNU V2 C++ symbol demangler.

Important note

This crate demangles symbols for the outdated and no-longer-used V2 ABI mangling scheme of GNU g++. It is very unlikely this is actually the thing you are looking for, since this stuff is ancient.

Only use this crate if you are sure you want to use the g++ mangling scheme used in gcc 2.9 and older.

It is more likely you are looking for crates like cpp_demangle, symbolic-demangle or cplus_demangle.

Features

  • Pure Rust implementation.
  • No dependencies.
  • Tries to mimic as closely as possible GNU's c++filt, including certain bugs. This behavior can be configured to avoid some inconsistencies and bugs from the original c++filt implementation.
  • Compatible with no_std by default.
    • It still requires access to alloc.

Installation

Add the following to your Cargo.toml:

[dependencies]
gnuv2_demangle = "0.3"

For a cli program, refer to g2dem.

Example

use gnuv2_demangle::{demangle, DemangleConfig};

let config = DemangleConfig::new();
let demangled = demangle("do_thing__C6StupidRC6StupidT1", &config);
assert_eq!(
    demangled.as_deref(),
    Ok("Stupid::do_thing(Stupid const &, Stupid const &) const"),
);

Implementation notes

I implemented this crate by throwing a lot of symbols at an old version of c++filt (2.9 ish), looking the output and trying to make sense of the demangling process.

Because of this, you can expect some inconsistencies, mismangled symbols and other issues while using this crate. If you find any problem feel free to reach out via Github issues or a PR.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Versioning and changelog

This library follows Semantic Versioning. We try to always keep backwards compatibility, so no breaking changes should happen until a major release (i.e. jumping from 1.X.X to 2.0.0).

To see what changed on each release visit either the CHANGELOG.md file or check the releases page on Github. You can also use this link to check the latest release.

No runtime deps