DIA SDK SymTagEnum 值
我目前正在将使用 DIA SDK 检索的 PDB 文件中的大量信息转储到 XML 文件,以便我可以使用该信息来显示有关项目结构等的内容。
为了命名 XML 节点,我有一个简单的函数,它将枚举的值转换为字符串,然后用于节点:
string symTagTypeToString(DWORD type) {
string symTagTypename = "";
switch(type) {
case SymTagNull:
symTagTypename = "null";
break;
case SymTagExe:
symTagTypename = "exe";
break;
case SymTagCompiland:
symTagTypename = "compiland";
break;
case SymTagCompilandDetails:
symTagTypename = "compilandDetails";
break;
case SymTagCompilandEnv:
symTagTypename = "compilandEnvironmentVar";
break;
case SymTagFunction:
symTagTypename = "function";
break;
case SymTagBlock:
symTagTypename = "block";
break;
case SymTagData:
symTagTypename = "data";
break;
case SymTagAnnotation:
symTagTypename = "annotation";
break;
case SymTagLabel:
symTagTypename = "label";
break;
case SymTagPublicSymbol:
symTagTypename = "publicSymbol";
break;
case SymTagUDT:
symTagTypename = "userDefinedType";
break;
case SymTagEnum:
symTagTypename = "enumerator";
break;
case SymTagFunctionType:
symTagTypename = "functionType";
break;
case SymTagPointerType:
symTagTypename = "pointer";
break;
case SymTagArrayType:
symTagTypename = "array";
break;
case SymTagBaseType:
symTagTypename = "baseType";
break;
case SymTagTypedef:
symTagTypename = "typedef";
break;
case SymTagBaseClass:
symTagTypename = "baseClass";
break;
case SymTagFriend:
symTagTypename = "friend";
break;
case SymTagFunctionArgType:
symTagTypename = "functionArgumentType";
break;
case SymTagFuncDebugStart:
symTagTypename = "funcDebugStart";
break;
case SymTagFuncDebugEnd:
symTagTypename = "funcDebugEnd";
break;
case SymTagUsingNamespace:
symTagTypename = "usingNamespace";
break;
case SymTagVTableShape:
symTagTypename = "vTableShape";
break;
case SymTagVTable:
symTagTypename = "vTable";
break;
case SymTagCustom:
symTagTypename = "custom";
break;
case SymTagThunk:
symTagTypename = "thunk";
break;
case SymTagCustomType:
symTagTypename = "customType";
break;
case SymTagManagedType:
symTagTypename = "managedType";
break;
case SymTagDimension:
symTagTypename = "dimension";
break;
default:
ostringstream s;
s << "other" << type;
symTagTypename = s.str();
break;
}
return symTagTypename;
}
该函数包含此处列出的所有值:http://msdn.microsoft.com/de-de/library/bkedss5f.aspx
现在,为了转储 DIA 信息,我基本上只是递归使用 pGlobal->findChildren(SymTagUDT, NULL, nsCaseSensitive,&pIDiaEnumSymbols)。令人好奇的部分是,生成的 XML 包含很多如下所示的内容:
<function name="consumer::main">
<funcDebugStart name="unknown">
</funcDebugStart>
<funcDebugEnd name="unknown">
</funcDebugEnd>
<data name="">
</data>
<data name="">
</data>
<data name="">
</data>
<data name="this">
</data>
<data name="c">
</data>
<other31 name="unknown">
</other31>
<other31 name="unknown">
</other31>
<other31 name="unknown">
</other31>
<other31 name="unknown">
</other31>
<other31 name="unknown">
</other31>
<other31 name="unknown">
</other31>
<other31 name="unknown">
</other31>
<other31 name="unknown">
</other31>
</function>
现在,不用担心空名称信息和内容,到目前为止,这一切都还没有完成。我真的很想知道 symTag 为 31 的符号是什么类型。枚举数似乎包含 31 个元素,因此 0 到 30 之间的值应该有效。有人知道这个 31 是什么吗?有问题的函数如下所示:
void main()
{
char c;
cout << endl << endl;
while (true) {
in->read(c);
cout << c << flush;
if (in->num_available() == 1)
cout << "<1>" << flush;
if (in->num_available() == 9)
cout << "<9>" << flush;
}
}
它是 SystemC fifo 示例项目的一部分。真的,没什么太花哨的。
I'm currently dumping a lot of information from a PDB file I retrieve using the DIA SDK to an XML file so that I can then use that information to display stuff about the structure of the project etc.
For naming the XML nodes, I have a trivial function that translates the value of the enum to a string which is then used for the node:
string symTagTypeToString(DWORD type) {
string symTagTypename = "";
switch(type) {
case SymTagNull:
symTagTypename = "null";
break;
case SymTagExe:
symTagTypename = "exe";
break;
case SymTagCompiland:
symTagTypename = "compiland";
break;
case SymTagCompilandDetails:
symTagTypename = "compilandDetails";
break;
case SymTagCompilandEnv:
symTagTypename = "compilandEnvironmentVar";
break;
case SymTagFunction:
symTagTypename = "function";
break;
case SymTagBlock:
symTagTypename = "block";
break;
case SymTagData:
symTagTypename = "data";
break;
case SymTagAnnotation:
symTagTypename = "annotation";
break;
case SymTagLabel:
symTagTypename = "label";
break;
case SymTagPublicSymbol:
symTagTypename = "publicSymbol";
break;
case SymTagUDT:
symTagTypename = "userDefinedType";
break;
case SymTagEnum:
symTagTypename = "enumerator";
break;
case SymTagFunctionType:
symTagTypename = "functionType";
break;
case SymTagPointerType:
symTagTypename = "pointer";
break;
case SymTagArrayType:
symTagTypename = "array";
break;
case SymTagBaseType:
symTagTypename = "baseType";
break;
case SymTagTypedef:
symTagTypename = "typedef";
break;
case SymTagBaseClass:
symTagTypename = "baseClass";
break;
case SymTagFriend:
symTagTypename = "friend";
break;
case SymTagFunctionArgType:
symTagTypename = "functionArgumentType";
break;
case SymTagFuncDebugStart:
symTagTypename = "funcDebugStart";
break;
case SymTagFuncDebugEnd:
symTagTypename = "funcDebugEnd";
break;
case SymTagUsingNamespace:
symTagTypename = "usingNamespace";
break;
case SymTagVTableShape:
symTagTypename = "vTableShape";
break;
case SymTagVTable:
symTagTypename = "vTable";
break;
case SymTagCustom:
symTagTypename = "custom";
break;
case SymTagThunk:
symTagTypename = "thunk";
break;
case SymTagCustomType:
symTagTypename = "customType";
break;
case SymTagManagedType:
symTagTypename = "managedType";
break;
case SymTagDimension:
symTagTypename = "dimension";
break;
default:
ostringstream s;
s << "other" << type;
symTagTypename = s.str();
break;
}
return symTagTypename;
}
This function encompasses all values listed here: http://msdn.microsoft.com/de-de/library/bkedss5f.aspx
Now, for dumping the DIA information, I basically just recurse down the children of all symbols I get using pGlobal->findChildren(SymTagUDT, NULL, nsCaseSensitive, &pIDiaEnumSymbols)
. The curious part is that the resulting XML contains a lot of stuff that looks like this:
<function name="consumer::main">
<funcDebugStart name="unknown">
</funcDebugStart>
<funcDebugEnd name="unknown">
</funcDebugEnd>
<data name="">
</data>
<data name="">
</data>
<data name="">
</data>
<data name="this">
</data>
<data name="c">
</data>
<other31 name="unknown">
</other31>
<other31 name="unknown">
</other31>
<other31 name="unknown">
</other31>
<other31 name="unknown">
</other31>
<other31 name="unknown">
</other31>
<other31 name="unknown">
</other31>
<other31 name="unknown">
</other31>
<other31 name="unknown">
</other31>
</function>
Now, nevermind the empty name information and stuff, that's all pretty unfinished so far. I'd just really like to know what kind of symbol has a symTag of 31. The enumerator seems to contain 31 elements, so values from 0 to 30 should be valid. Does anybody have any idea what this 31 could be? The function in question looks like this:
void main()
{
char c;
cout << endl << endl;
while (true) {
in->read(c);
cout << c << flush;
if (in->num_available() == 1)
cout << "<1>" << flush;
if (in->num_available() == 9)
cout << "<9>" << flush;
}
}
It's part of the SystemC fifo example project. Nothing too fancy, really.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在VS2010附带的DIA SDK版本中,添加了两个SymTagEnum值SymTagCallSite和SymTagMax(尽管它们尚未包含在文档中)。尽管我仍然对这些值代表的语义还没有真正的了解,但这绝对解释了我得到的值。
In the DIA SDK version that's shipped with VS2010, the two SymTagEnum values SymTagCallSite and SymTagMax have been added (although they have not been included in the documentation yet). Although I still haven't got really an idea about the semantics those values stand for, this definitely explains the values I'm getting.