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

How to get a symbol size? #27

Open
RazrFalcon opened this issue Nov 15, 2018 · 9 comments
Open

How to get a symbol size? #27

RazrFalcon opened this issue Nov 15, 2018 · 9 comments
Labels

Comments

@RazrFalcon
Copy link
Contributor

No description provided.

@mstange
Copy link
Collaborator

mstange commented Dec 2, 2018

I think the following should get you fairly close:

  1. Wait for PR Add support for module private procedure symbols #26 to land
  2. Iterate over all the modules
  3. Iterate over the symbols of each module
  4. The ProcedureSymbols in each module have a len field. That's your symbol size.

@RazrFalcon
Copy link
Contributor Author

RazrFalcon commented Dec 29, 2018

I've tried the pdb_symbols example, but I've got:

error dumping PDB: The requested stream (65535) is not stored in this file

The PDB file is from building the cargo-bloat with the MSVC target.

@RazrFalcon
Copy link
Contributor Author

Also, I'm not familiar with the pdb, but what is the difference between global_symbols and symbols from debug_information? AFAIU, they can have the same symbols/functions, but global_symbols doesn't contain size.

In my case, I have to collect a list of functions (name + size) that are used in the executable.

@crlf0710
Copy link

crlf0710 commented Feb 3, 2019

Let me call a Windows expert for help here.

@retep998 Could you make some advises about above questions? Thank you!

@retep998
Copy link

retep998 commented Feb 3, 2019

I don't know anything about the PDB format, sorry.

@mstange
Copy link
Collaborator

mstange commented Feb 4, 2019

Also, I'm not familiar with the pdb, but what is the difference between global_symbols and symbols from debug_information? AFAIU, they can have the same symbols/functions, but global_symbols doesn't contain size.

I think global_symbols only lists the symbols that are exposed to the linker. And the symbols in debug_information describe all functions present in the binary, even those that are internal and not callable from the outside.

@jan-auer
Copy link
Member

global_symbols in this crate does not expose information from the "Global Symbol Stream", but instead from a "Symbol Records Stream". I wasn't able to fully understand what the exact differences are, but it looks like the latter contains a combination of the "Global Symbol Stream" and the "Public Symbol Stream", plus more additional information.

@jan-auer
Copy link
Member

@RazrFalcon is this still an issue?

@RazrFalcon
Copy link
Contributor Author

I should retest it.

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

No branches or pull requests

5 participants