0

I need to get a stack frame of a function from any PDB (All in/out arguments and their types). I have the function name and address of a certain function from PDB, is there a way to get all of the parameters (in/out) of that function from the PDB file?

The functions are written in unmanaged code.

Regards,

Usman

Christopher Markieta
  • 5,674
  • 10
  • 43
  • 60
Usman
  • 2,742
  • 4
  • 44
  • 82

3 Answers3

2

You have a mess of concepts. PDB as any other file doesn't contain stack or stack frames, because it is something that is created during execution. .net exe/dll contains metadata for classes so you can peek at methods signature. You can get stack frames in your code (google class StackFrame/StackFrame) but still you can't all data from the stack like parameters values.

Andrey
  • 59,039
  • 12
  • 119
  • 163
  • Yeha after putting question i got write concept and thought about stack at runt time not at compile time. So how can I get all function parameters using PDB(probably using dbghelp) I have extracted all functions name and their addresses but i need parameters which they take as in/out. Can I get also those params from using PDB just like i get function names and addresses – Usman Mar 30 '10 at 13:14
  • what do you mean by parameters? values or definitions? – Andrey Mar 30 '10 at 13:30
  • Just definitions..? At compile time I need function name and its address(which I got from PDB using dbghelp) now only one thing remains how many no of arguments its taking and what TYPES of arguments these are? comma seperated – Usman Mar 30 '10 at 13:34
  • are you using .net or native c++? – Andrey Mar 30 '10 at 14:31
  • Can this problem be solvable by using CPP reflection Open source APIs?? – Usman Mar 31 '10 at 14:08
  • take a look at http://www.codeproject.com/KB/bugs/PdbParser.aspx it might be what you need – Andrey Mar 31 '10 at 15:29
  • This is PDB inspector and locating PDB just make analysis loaded modules and that's it. – Usman Apr 01 '10 at 11:46
  • what do you want then?! i can't understand anything. – Andrey Apr 01 '10 at 12:10
1

It is not possible to get a stack frame at compile time. The stack is a run time concept.

Mark Wilkins
  • 40,729
  • 5
  • 57
  • 110
1

To extract function names, address and arguments types from a dump, you can use the dia2dump program. It is available as a sample of the Debug Interface Access SDK (dia-sdk). You can find it with Visual 2008 or 2010 under C:\Program Files\Microsoft Visual Studio (your version)\DIA SDK\Samples\DIA2Dump

plodoc
  • 2,783
  • 17
  • 17
  • yeah I found this one and I got my task nearly done. Only thing remains as referenced DIA2Dump is , it actually shows everything(ALL KERNEL related symbols, Os Symbols when I give it PDB which I dont need) I only need my symbols which is defined in my DLL/EXE/PDB. like I have some DLL in which some symbols are symbol001(int x,int y) & then symbol002(int x3,int x4)... I only need these 2 not everything starting from Kernal level imports and sky is the limit. – Usman Apr 02 '10 at 12:54
  • I am using get_symbolsFileName by which I can trace symbols from where they come. But its failing and not populating me any info regarding symbol file like xyz.obj or any other file from which those symbols come. So that I can filter my symbols which I desired some how by this way. – Usman Apr 02 '10 at 13:35