views:

157

answers:

3

Hello,

I need to get stack frame of function from any pdb (All in/out arguments and their types). I got function name and address of certain function from pdb, now I need to know all parameters(in/out) of that function from pdb file programmatically. Is there any way..??

Edit: the functions in question are written in unmanaged code.

Regards Usman

+1  A: 

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

Mark Wilkins
+1  A: 

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
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
what do you mean by parameters? values or definitions?
Andrey
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
are you using .net or native c++?
Andrey
Unmanaged Visual C++
Usman
Can this problem be solvable by using CPP reflection Open source APIs??
Usman
take a look at http://www.codeproject.com/KB/bugs/PdbParser.aspx it might be what you need
Andrey
This is PDB inspector and locating PDB just make analysis loaded modules and that's it.
Usman
what do you want then?! i can't understand anything.
Andrey
+1  A: 

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
Usman
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