pdb icon indicating copy to clipboard operation
pdb copied to clipboard

How to get a symbol size?

Open RazrFalcon opened this issue 6 years ago • 9 comments

RazrFalcon avatar Nov 15 '18 15:11 RazrFalcon

I think the following should get you fairly close:

  1. Wait for PR #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.

mstange avatar Dec 02 '18 05:12 mstange

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 avatar Dec 29 '18 14:12 RazrFalcon

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.

RazrFalcon avatar Dec 29 '18 14:12 RazrFalcon

Let me call a Windows expert for help here.

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

crlf0710 avatar Feb 03 '19 08:02 crlf0710

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

retep998 avatar Feb 03 '19 23:02 retep998

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.

mstange avatar Feb 04 '19 22:02 mstange

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 avatar Feb 19 '19 09:02 jan-auer

@RazrFalcon is this still an issue?

jan-auer avatar Mar 17 '20 21:03 jan-auer

I should retest it.

RazrFalcon avatar Mar 18 '20 08:03 RazrFalcon