Handle trailing underscores in function name
This commit is contained in:
parent
4ddceaec0e
commit
0f20b45a49
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "cwdemangle"
|
||||
version = "0.1.5"
|
||||
version = "0.1.6"
|
||||
edition = "2018"
|
||||
authors = ["Luke Street <luke@street.dev>"]
|
||||
license = "MIT OR Apache-2.0"
|
||||
|
|
10
src/lib.rs
10
src/lib.rs
|
@ -324,7 +324,11 @@ pub fn demangle(mut str: &str, options: &DemangleOptions) -> Option<String> {
|
|||
str = &str[2..];
|
||||
}
|
||||
{
|
||||
let idx = str.find("__")?;
|
||||
let mut idx = str.find("__")?;
|
||||
// Handle any trailing underscores in the function name
|
||||
while str.chars().nth(idx + 2) == Some('_') {
|
||||
idx += 1;
|
||||
}
|
||||
let (fn_name_out, mut rest) = str.split_at(idx);
|
||||
if special {
|
||||
if fn_name_out == "init" {
|
||||
|
@ -686,6 +690,10 @@ mod tests {
|
|||
),
|
||||
Some("nw4r::ut::CharStrmReader::CharStrmReader(unsigned short (nw4r::ut::CharStrmReader::*)())".to_string())
|
||||
);
|
||||
assert_eq!(
|
||||
demangle("QuerySymbolToMapFile___Q24nw4r2dbFPUcPC12OSModuleInfoUlPUcUl", &options),
|
||||
Some("nw4r::db::QuerySymbolToMapFile_(unsigned char*, const OSModuleInfo*, unsigned long, unsigned char*, unsigned long)".to_string())
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
Loading…
Reference in New Issue