diff --git a/pykd/typeinfo.cpp b/pykd/typeinfo.cpp index 0c6f102..4bb341e 100644 --- a/pykd/typeinfo.cpp +++ b/pykd/typeinfo.cpp @@ -78,9 +78,28 @@ ULONG64 TypeInfo::getSymbolSize( const std::string &fullName ) TypeInfoPtr TypeInfo::getTypeInfo( SymbolPtr &typeSym ) { - const ULONG symTag = typeSym->getSymTag(); + ULONG symTag = typeSym->getSymTag(); + switch( symTag ) { + case SymTagData: + + if ( typeSym->getLocType() == LocIsBitField ) + { + return TypeInfoPtr( new BitFieldTypeInfo(typeSym) ); + } + + if ( typeSym->getDataKind() == DataIsConstant ) + { + BaseTypeVariant constVal; + typeSym->getValue( constVal ); + TypeInfoPtr ptr = getTypeInfo( typeSym->getType() ); + ptr->setConstant( constVal ); + return ptr; + } + + return getTypeInfo( typeSym->getType() ); + case SymTagBaseType: return getBaseTypeInfo( typeSym ); @@ -129,7 +148,28 @@ TypeInfoPtr TypeInfo::getTypeInfo( SymbolPtr &symScope, const std::string &symN if ( basePtr != 0 ) return basePtr; - return getTypeInfo( symScope, symScope->getChildByName( symName ) ); + SymbolPtr symType = symScope->getChildByName( symName ); + + if ( symType->getSymTag() == SymTagData ) + { + if ( symType->getLocType() == LocIsBitField ) + { + return TypeInfoPtr( new BitFieldTypeInfo(symType) ); + } + + if ( symType->getDataKind() == DataIsConstant ) + { + BaseTypeVariant constVal; + symType->getValue( constVal ); + TypeInfoPtr ptr = getTypeInfo( symType->getType() ); + ptr->setConstant( constVal ); + return ptr; + } + + symType = symType->getType(); + } + + return getTypeInfo( symType ); } return getComplexType( symScope, symName ); @@ -137,34 +177,6 @@ TypeInfoPtr TypeInfo::getTypeInfo( SymbolPtr &symScope, const std::string &symN ///////////////////////////////////////////////////////////////////////////////////// -TypeInfoPtr TypeInfo::getTypeInfo( SymbolPtr &symScope, SymbolPtr &symChild ) -{ - SymbolPtr symType = symChild; - - if ( symType->getSymTag() == SymTagData ) - { - if ( symType->getLocType() == LocIsBitField ) - { - return TypeInfoPtr( new BitFieldTypeInfo(symType) ); - } - - if ( symType->getDataKind() == DataIsConstant ) - { - BaseTypeVariant constVal; - symType->getValue( constVal ); - TypeInfoPtr ptr = getTypeInfo( symType->getType() ); - ptr->setConstant( constVal ); - return ptr; - } - - symType = symType->getType(); - } - - return getTypeInfo( symType ); -} - -///////////////////////////////////////////////////////////////////////////////////// - static const boost::regex baseMatch("^(Char)|(WChar)|(Int1B)|(UInt1B)|(Int2B)|(UInt2B)|(Int4B)|(UInt4B)|(Int8B)|(UInt8B)|(Long)|(ULong)|(Float)|(Bool)|(Double)$" ); bool @@ -558,7 +570,7 @@ void UdtTypeInfo::getFields( else if ( symTag == SymTagData ) { - TypeInfoPtr ti = TypeInfo::getTypeInfo( rootSym, childSym ); + TypeInfoPtr ti = TypeInfo::getTypeInfo( childSym ); ULONG fieldOffset = 0; switch ( childSym->getDataKind() ) @@ -587,7 +599,7 @@ void UdtTypeInfo::getFields( else if ( symTag == SymTagVTable ) { - TypeInfoPtr ti = TypeInfo::getTypeInfo( rootSym, childSym ); + TypeInfoPtr ti = TypeInfo::getTypeInfo( childSym ); if ( baseVirtualSym ) { diff --git a/pykd/typeinfo.h b/pykd/typeinfo.h index 4fa7e48..b59318b 100644 --- a/pykd/typeinfo.h +++ b/pykd/typeinfo.h @@ -23,7 +23,7 @@ class TypeInfo : boost::noncopyable, public intBase, public boost::enable_shared public: static - TypeInfoPtr getTypeInfoByName( const std::string &symName ); + TypeInfoPtr getTypeInfoByName( const std::string &symName ); static ULONG64 getSymbolSize( const std::string &symName ); @@ -31,9 +31,6 @@ public: static TypeInfoPtr getTypeInfo( SymbolPtr &symScope, const std::string &symName ); - static - TypeInfoPtr getTypeInfo( SymbolPtr &symScope, SymbolPtr &symChild ); - static TypeInfoPtr getTypeInfo( SymbolPtr &symbol );