Does DIA retrieve function parameter names?
-
16 aprilie 2012 03:58
I've been able to successfully iterate over the names of local variables using the DIA API using the various, exposed methods. However, I have been completely at a loss when trying to find the name of function parameters using the API (an inspection of the output from the Dia2Sample http://msdn.microsoft.com/en-us/library/b5ke49f5.aspx also yields absolutely nothing in the way of function parameter names).
Is such a thing possible?This particular thread leans on the DbgHelp API (which I'm not using). And this particular link states:
"To get the function parameters, we can call findChildren on the function type with the symbol tag SymTagFunctionArgType. From this call we can extract the parameter name, and use the expandType function to extract a string that can represent the parameter type."
...but is utter rubbish and simply does not work. My eventual goal here is to allow someone to extract the value of the parameter by name.
Help?
Toate mesajele
-
16 aprilie 2012 13:32
Go to this webpage and look and tthe same enumsymbols.cpp. The parameter list of main is different from the origianal example.
http://www.debuginfo.com/examples/dbghelpexamples.html
jdweng
- Propus ca răspuns de Mike FengMicrosoft Contingent Staff, Moderator 17 aprilie 2012 08:20
-
19 aprilie 2012 05:01Moderator
I am not sure if DIA exposes a way to get that info, however you can get it directly from the managed assembly. Try taking a look at IMetaDataImport APIs, in particular the EnumParams() method. Alternatively if your tool is written in managed code you can load the target assembly for reflection and use MethodInfo.GetParameters().
Let me know if you need more details, HTH
-Noah
- Editat de Noah Falk - MSFTMicrosoft Employee, Moderator 19 aprilie 2012 05:01
- Marcat ca răspuns de Ben Rush 19 aprilie 2012 19:58
-
19 aprilie 2012 20:00Thanks Noah, your answer was on the mark.
I am using C++ to do this, and was looking in all of the wrong places. To be frank, I find the API somewhat confusing and convoluted; I suppose with time it would make sense, but it seems strange to me that I would be able to get stack variables using the DIA API and be forced to resort to an entirely different API-set to get the parameters.
Nonetheless, your answer worked. Thanks!