Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

demangle not working on my symbols #66

Open
mwlon opened this issue Nov 19, 2023 · 3 comments
Open

demangle not working on my symbols #66

mwlon opened this issue Nov 19, 2023 · 3 comments

Comments

@mwlon
Copy link

mwlon commented Nov 19, 2023

Maybe I'm doing something wrong, but here's an example of a symbol I can't seem to demangle:

__ZN3pco25latent_batch_decompressor32LatentBatchDecompressor$LT$U$GT$18decompress_offsets17h254da28dd89d69cbE

I just get this back:

__ZN3pco25latent_batch_decompressor32LatentBatchDecompressordecompress_offsets17h254da28dd89d69cbE

I know this function was compiled with a const generic, and I'd like to know what the value of that generic was. I produced this symbol by running cargo build --release -- --emit=asm and reading the .s file.

target: darwin aarch64
version: 0.1.23

@dtolnay
Copy link
Member

dtolnay commented Nov 19, 2023

The const generic value is not recoverable from the symbol in the default mangling scheme. You'd need to build with RUSTFLAGS='-C symbol-mangling-version=v0' to get more information in the symbols.

@mwlon
Copy link
Author

mwlon commented Nov 19, 2023

That's good to know, but shouldn't the rest of the symbol demangle? How come it still starts with __Z...?

@dtolnay
Copy link
Member

dtolnay commented Nov 20, 2023

On my machine, that works as I would expect.

fn main() {
    let mangled = "__ZN3pco25latent_batch_decompressor32LatentBatchDecompressor$LT$U$GT$18decompress_offsets17h254da28dd89d69cbE";
    let expected = "pco::latent_batch_decompressor::LatentBatchDecompressor<U>::decompress_offsets::h254da28dd89d69cb";
    assert_eq!(rustc_demangle::demangle(mangled).to_string(), expected);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants