0
votes

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.

1

1 Answers

0
votes

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.