Skip to content

Commit 9358d8e

Browse files
committed
mips: Add C++ symbol demangling (CW & modern GCC)
1 parent 809e2ff commit 9358d8e

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

objdiff-core/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ std = [
8181
]
8282
mips = [
8383
"any-arch",
84+
"dep:cpp_demangle",
85+
"dep:cwdemangle",
8486
"dep:rabbitizer",
8587
]
8688
ppc = [

objdiff-core/src/arch/mips.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,13 @@ impl Arch for ArchMips {
286286
})
287287
}
288288

289+
fn demangle(&self, name: &str) -> Option<String> {
290+
cpp_demangle::Symbol::new(name)
291+
.ok()
292+
.and_then(|s| s.demangle(&cpp_demangle::DemangleOptions::default()).ok())
293+
.or_else(|| cwdemangle::demangle(name, &cwdemangle::DemangleOptions::default()))
294+
}
295+
289296
fn reloc_name(&self, flags: RelocationFlags) -> Option<&'static str> {
290297
match flags {
291298
RelocationFlags::Elf(r_type) => match r_type {

0 commit comments

Comments
 (0)