IDiaSymbol SymTagFunction ctor或dtor? [英] IDiaSymbol SymTagFunction ctor or dtor?

查看:125
本文介绍了IDiaSymbol SymTagFunction ctor或dtor?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

循环遍历PDB的所有函数时,如何检查函数是构造函数还是析构函数?


 IDiaEnumSymbols * pFunctions = NULL; 
pCompiland-> findChildren(SymTagFunction,NULL,nsNone,& pFunctions);
IDiaSymbol * pFunc = NULL;
pFunctions-> Next(1,& pFunc,& ulFetched);
if(??? / * pFunc是ctor或dtor * /){...}
else {...}



解决方案

嗨StepanM,


据我所知,类只有构造函数和析构函数。当类是构造函数/析构函数时,此类中的所有成员将同时构造函数/析构函数。


所以我担心我们无法检查函数是构造函数还是析构函数。请检查类构造函数或析构函数以替换检查函数构造函数和析构函数。


请尝试使用以下代码枚举所有类成员。如果enum_class_members'的计数为0,则表示该类不是构造函数,并且此类中的函数都不是构造函数。

 IDiaSymbol dia_class_symbol = m_DiaSymbolMap [cls]; 
IDiaEnumSymbols enum_class_members;
dia_class_symbol.findChildren(SymTagEnum.SymTagNull,null,0,out enum_class_members);


最好的问候,

Weiwei



When looping through the all functions of PDB, how to check if the function is constructor or destructor?

IDiaEnumSymbols* pFunctions = NULL;
pCompiland->findChildren(SymTagFunction, NULL, nsNone, &pFunctions);
IDiaSymbol* pFunc = NULL;
pFunctions->Next(1, &pFunc, &ulFetched);
if ( ??? /*pFunc is ctor or dtor*/) { ... }
else { ... }


解决方案

Hi StepanM,

As far as I know, there only constructor function and destructor function for class. When the class is constructor/destructor, all members in this class will constructor/destructor at the same time.

So I'm afraid that we could not to check whether the function is constructor or destructor. Please check class constructor or destructor to replace check the function constructor and destructor.

Please try use following code to enumerate all class members. If the enum_class_members' count is 0, it means the class is not constructor and the functions in this class are all not constructor.

IDiaSymbol dia_class_symbol = m_DiaSymbolMap[cls]; 
IDiaEnumSymbols enum_class_members; 
dia_class_symbol.findChildren(SymTagEnum.SymTagNull, null, 0, out enum_class_members); 

Best Regards,
Weiwei


这篇关于IDiaSymbol SymTagFunction ctor或dtor?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆