From 592c241a1d45cd0a9c3289e2ab3be6dc67f70ffa Mon Sep 17 00:00:00 2001 From: "SND\\kernelnet_cp" Date: Wed, 18 Jul 2012 07:32:51 +0000 Subject: [PATCH] [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 --- pykd/dbgclient.cpp | 6 ++++++ pykd/typeinfo.cpp | 8 ++++++++ pykd/typeinfo.h | 3 +++ test/scripts/typeinfo.py | 2 +- 4 files changed, 18 insertions(+), 1 deletion(-) 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 """