diff --git a/pykd/dbgclient.cpp b/pykd/dbgclient.cpp index b3642e3..b4665ff 100644 --- a/pykd/dbgclient.cpp +++ b/pykd/dbgclient.cpp @@ -502,6 +502,9 @@ ULONG64 DebugClient::getSymbolSize( const std::string &fullName ) std::string moduleName; std::string symName; + if ( TypeInfo::isBaseType( fullName ) ) + return TypeInfo::getBaseTypeInfo( fullName )->getSize(); + splitSymName( fullName, moduleName, symName ); ModulePtr module = loadModuleByName( moduleName ); @@ -521,6 +524,9 @@ TypeInfoPtr DebugClient::getTypeInfoByName( const std::string &typeName ) std::string moduleName; std::string symName; + if ( TypeInfo::isBaseType( typeName ) ) + return TypeInfo::getBaseTypeInfo( typeName ); + splitSymName( typeName, moduleName, symName ); ModulePtr module = loadModuleByName( moduleName ); diff --git a/pykd/typeinfo.cpp b/pykd/typeinfo.cpp index afaa716..6e826f4 100644 --- a/pykd/typeinfo.cpp +++ b/pykd/typeinfo.cpp @@ -136,6 +136,14 @@ TypeInfoPtr TypeInfo::getTypeInfo( pyDia::SymbolPtr &symScope, pyDia::SymbolPtr static const boost::regex baseMatch("^(Char)|(WChar)|(Int1B)|(UInt1B)|(Int2B)|(UInt2B)|(Int4B)|(UInt4B)|(Int8B)|(UInt8B)|(Long)|(ULong)|(Float)|(Bool)|(Double)$" ); +bool +TypeInfo::isBaseType( const std::string &symName ) +{ + boost::cmatch baseMatchResult; + + return boost::regex_match( symName.c_str(), baseMatchResult, baseMatch ); +} + TypeInfoPtr TypeInfo::getBaseTypeInfo( const std::string &symName ) { diff --git a/pykd/typeinfo.h b/pykd/typeinfo.h index ecc8b7a..f0f4c70 100644 --- a/pykd/typeinfo.h +++ b/pykd/typeinfo.h @@ -36,6 +36,9 @@ public: static TypeInfoPtr getBaseTypeInfo( pyDia::SymbolPtr &symbol ); + static + bool isBaseType( const std::string &name ); + public: TypeInfo() : diff --git a/test/scripts/typeinfo.py b/test/scripts/typeinfo.py index 868a6ef..7471f6c 100644 --- a/test/scripts/typeinfo.py +++ b/test/scripts/typeinfo.py @@ -13,7 +13,7 @@ class TypeInfoTest( unittest.TestCase ): self.assertEqual( "structTest", pykd.typeInfo( target.moduleName + "!structTest" ).name() ) self.assertEqual( "structTest", pykd.typeInfo( "g_structTest" ).name() ) self.assertEqual( "structTest", pykd.typeInfo( target.moduleName + "!g_structTest" ).name() ) - self.assertEqual( "Int1B", pykd.typeInfo( "Int1B" ) ) + self.assertEqual( "Int1B", pykd.typeInfo( "Int1B" ).name() ) def testCreateByName( self ): """ creating typeInfo by the type name """