[0.1.x] fixed : issue #10921 ( typeInfo does not work with Base types )

git-svn-id: https://pykd.svn.codeplex.com/svn@78149 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
SND\kernelnet_cp 2012-07-18 07:32:51 +00:00 committed by Mikhail I. Izmestev
parent 1c20123492
commit 592c241a1d
4 changed files with 18 additions and 1 deletions

View File

@ -502,6 +502,9 @@ ULONG64 DebugClient::getSymbolSize( const std::string &fullName )
std::string moduleName; std::string moduleName;
std::string symName; std::string symName;
if ( TypeInfo::isBaseType( fullName ) )
return TypeInfo::getBaseTypeInfo( fullName )->getSize();
splitSymName( fullName, moduleName, symName ); splitSymName( fullName, moduleName, symName );
ModulePtr module = loadModuleByName( moduleName ); ModulePtr module = loadModuleByName( moduleName );
@ -521,6 +524,9 @@ TypeInfoPtr DebugClient::getTypeInfoByName( const std::string &typeName )
std::string moduleName; std::string moduleName;
std::string symName; std::string symName;
if ( TypeInfo::isBaseType( typeName ) )
return TypeInfo::getBaseTypeInfo( typeName );
splitSymName( typeName, moduleName, symName ); splitSymName( typeName, moduleName, symName );
ModulePtr module = loadModuleByName( moduleName ); ModulePtr module = loadModuleByName( moduleName );

View File

@ -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)$" ); 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 TypeInfoPtr
TypeInfo::getBaseTypeInfo( const std::string &symName ) TypeInfo::getBaseTypeInfo( const std::string &symName )
{ {

View File

@ -36,6 +36,9 @@ public:
static static
TypeInfoPtr getBaseTypeInfo( pyDia::SymbolPtr &symbol ); TypeInfoPtr getBaseTypeInfo( pyDia::SymbolPtr &symbol );
static
bool isBaseType( const std::string &name );
public: public:
TypeInfo() : TypeInfo() :

View File

@ -13,7 +13,7 @@ class TypeInfoTest( unittest.TestCase ):
self.assertEqual( "structTest", pykd.typeInfo( target.moduleName + "!structTest" ).name() ) self.assertEqual( "structTest", pykd.typeInfo( target.moduleName + "!structTest" ).name() )
self.assertEqual( "structTest", pykd.typeInfo( "g_structTest" ).name() ) self.assertEqual( "structTest", pykd.typeInfo( "g_structTest" ).name() )
self.assertEqual( "structTest", pykd.typeInfo( target.moduleName + "!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 ): def testCreateByName( self ):
""" creating typeInfo by the type name """ """ creating typeInfo by the type name """