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

Handle mangled and decorated names #6

Open
coolkingcole opened this issue Dec 18, 2023 · 2 comments
Open

Handle mangled and decorated names #6

coolkingcole opened this issue Dec 18, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@coolkingcole
Copy link

It seems like it could be a nice feature to demangle/de-decorate names from pdbs. For example in this pdb:

https://msdl.microsoft.com/download/symbols/ntkrnlmp.pdb/00625D7D36754CBEBA4533BA9A0F3FE22/ntkrnlmp.pdb

Query:

{'name': 'ntkrnlmp.pdb', 'guid': '00625D7D36754CBEBA4533BA9A0F3FE2', 'age': 2, 'query': ['ExAllocatePoolWithTag']}

Result:

'{"ExAllocatePoolWithTag":-1}'

But this query resolves:

{'name': 'ntkrnlmp.pdb', 'guid': '00625D7D36754CBEBA4533BA9A0F3FE2', 'age': 2, 'query': ['_ExAllocatePoolWithTag@12']}

Result:

'{"_ExAllocatePoolWithTag@12":1146886}'

This could be a nice feature/enhancement. Could be a change in this repo or MolecularMatters/raw_pdb

@zouxianyu zouxianyu added the enhancement New feature or request label Dec 20, 2023
@zouxianyu
Copy link
Owner

Thank you so much for the issue. _ExAllocatePoolWithTag@12 is the decorated name of the stdcall function ExAllocatePoolWithTag. In addition to stdcall, C++ adds name decoration for function overloading. Therefore, to implement this functionality, it is necessary to add a new interface for converting function signatures to decorated names.

@coolkingcole
Copy link
Author

For the simple decorated names I just remove the underscore and everything after the @ symbol. You could use an existing library for more complicated symbols that start with a '?' like these:
https://github.com/mstange/msvc-demangler-rust/tree/master
https://github.com/ianlancetaylor/demangle

I'm sure there is a better way, but I just wrapped the rust library in a extern call so the name wouldn't be mangled and could be called from this project.
https://github.com/coolkingcole/demangle_lib

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

No branches or pull requests

2 participants