mips: Add C++ symbol demangling (CW & modern GCC)

This commit is contained in:
Luke Street 2025-03-14 09:44:15 -06:00
parent 809e2ffddc
commit 9358d8ec60
2 changed files with 9 additions and 0 deletions

View File

@ -81,6 +81,8 @@ std = [
] ]
mips = [ mips = [
"any-arch", "any-arch",
"dep:cpp_demangle",
"dep:cwdemangle",
"dep:rabbitizer", "dep:rabbitizer",
] ]
ppc = [ ppc = [

View File

@ -286,6 +286,13 @@ impl Arch for ArchMips {
}) })
} }
fn demangle(&self, name: &str) -> Option<String> {
cpp_demangle::Symbol::new(name)
.ok()
.and_then(|s| s.demangle(&cpp_demangle::DemangleOptions::default()).ok())
.or_else(|| cwdemangle::demangle(name, &cwdemangle::DemangleOptions::default()))
}
fn reloc_name(&self, flags: RelocationFlags) -> Option<&'static str> { fn reloc_name(&self, flags: RelocationFlags) -> Option<&'static str> {
match flags { match flags {
RelocationFlags::Elf(r_type) => match r_type { RelocationFlags::Elf(r_type) => match r_type {