Filing this so I don't forget it. This could significantly improve compression, and actually help downstream code in understanding the "structure" of the names as the mangling includes some metadata that you have to moreso guess at from the demangled version.
Apparently it's as simple as removing all the name.demangle calls in these files:
|
fn demangle(name: &Name) -> String { |
|
let name = common::fix_symbol_name(name); |
|
if let Language::C = name.language() { |
|
return name.as_str().to_string(); |
|
} |
|
|
|
match name.demangle(DemangleOptions::complete()) { |
|
Some(demangled) => demangled, |
|
None => { |
|
let aname = name.as_str(); |
|
warn!("Didn't manage to demangle {:?}", name); |
|
aname.to_string() |
|
} |
|
} |
|
} |
|
|
|
fn demangle_str(name: &str) -> String { |
|
let lang = Name::new(name, NameMangling::Mangled, Language::Unknown).detect_language(); |
|
if lang == Language::Unknown { |
|
return name.to_string(); |
|
} |
|
|
|
let name = Name::new(name, NameMangling::Mangled, lang); |
|
let name = common::fix_symbol_name(&name); |
|
|
|
match name.demangle(DemangleOptions::complete()) { |
|
Some(demangled) => demangled, |
|
None => { |
|
warn!("Didn't manage to demangle {}", name); |
|
name.to_string() |
|
} |
|
} |
|
} |
|
match name.demangle(DemangleOptions::complete()) { |
Rough design sketch:
- Off by default, enabled by passing --keep-mangled to dump_syms
- If enabled, emit
INFO MANGLED 1 at the ~top of the file to make it unambiguous to tools that it support it whether the names are mangled or not.
That's it. All the hard work would be in all the downstream tools checking for INFO MANGLED and embedding/invoking a demangler.
Filing this so I don't forget it. This could significantly improve compression, and actually help downstream code in understanding the "structure" of the names as the mangling includes some metadata that you have to moreso guess at from the demangled version.
Apparently it's as simple as removing all the
name.demanglecalls in these files:dump_syms/src/linux/elf.rs
Lines 119 to 151 in 213bd65
dump_syms/src/windows/symbol.rs
Line 573 in eb4e203
Rough design sketch:
INFO MANGLED 1at the ~top of the file to make it unambiguous to tools that it support it whether the names are mangled or not.That's it. All the hard work would be in all the downstream tools checking for INFO MANGLED and embedding/invoking a demangler.