mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-19 19:13:22 +08:00
[0.1.x] fixed : issue #10521 ( typeInfo returns invalid type name for array's element )
git-svn-id: https://pykd.svn.codeplex.com/svn@74958 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
parent
0834a142bf
commit
d44cc55f21
@ -379,18 +379,46 @@ static const boost::regex ptrMatch("^\\*(.*)$");
|
||||
|
||||
static const boost::regex arrayMatch("^(.*)\\[(\\d+)\\]$");
|
||||
|
||||
static const boost::regex symbolMatch("^([\\*]*)([^\\(\\)\\*\\[\\]]*)([\\(\\)\\*\\[\\]\\d]*)$");
|
||||
|
||||
TypeInfoPtr TypeInfo::getComplexType( pyDia::SymbolPtr &symScope, const std::string &symName )
|
||||
{
|
||||
ULONG ptrSize = (symScope->getMachineType() == IMAGE_FILE_MACHINE_AMD64) ? 8 : 4;
|
||||
|
||||
boost::cmatch matchResult;
|
||||
|
||||
if ( !boost::regex_match( symName.c_str(), matchResult, typeMatch ) )
|
||||
throw TypeException( symName, "type name is invalid" );
|
||||
if ( !boost::regex_match( symName.c_str(), matchResult, symbolMatch ) )
|
||||
throw TypeException( symName, "symbol name is invalid" );
|
||||
|
||||
std::string innerSymName = std::string( matchResult[2].first, matchResult[2].second );
|
||||
|
||||
TypeInfoPtr basePtr = getBaseTypeInfo( innerSymName );
|
||||
if ( basePtr != 0 )
|
||||
{
|
||||
return getRecurciveComplexType( basePtr, std::string( matchResult[3].first, matchResult[3].second ), ptrSize );
|
||||
}
|
||||
|
||||
pyDia::SymbolPtr lowestSymbol = symScope->getChildByName( innerSymName );
|
||||
|
||||
if ( lowestSymbol->getSymTag() == SymTagData )
|
||||
{
|
||||
throw TypeException( symName, "symbol name can not be an expresion" );
|
||||
}
|
||||
|
||||
return getRecurciveComplexType( getTypeInfo( lowestSymbol ), std::string( matchResult[3].first, matchResult[3].second ), ptrSize );
|
||||
|
||||
|
||||
|
||||
//ULONG ptrSize = (symScope->getMachineType() == IMAGE_FILE_MACHINE_AMD64) ? 8 : 4;
|
||||
|
||||
//boost::cmatch matchResult;
|
||||
|
||||
//if ( !boost::regex_match( symName.c_str(), matchResult, typeMatch ) )
|
||||
// throw TypeException( symName, "type name is invalid" );
|
||||
|
||||
TypeInfoPtr lowestTypeInfo = getTypeInfo( symScope, std::string( matchResult[1].first, matchResult[1].second ) );
|
||||
|
||||
return getRecurciveComplexType( lowestTypeInfo, std::string( matchResult[2].first, matchResult[2].second ), ptrSize );
|
||||
//return getRecurciveComplexType( lowestTypeInfo, std::string( matchResult[2].first, matchResult[2].second ), ptrSize );
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -86,8 +86,8 @@ class TypeInfoTest( unittest.TestCase ):
|
||||
|
||||
def testVarName( self ):
|
||||
self.assertEqual( "structTest", target.module.type( "g_structTest").name() )
|
||||
self.assertEqual( "structTest", target.module.type( "g_testArray[0]").name() )
|
||||
self.assertEqual( "structTest", target.module.type( "*g_structTestPtr").name() )
|
||||
self.assertRaises( pykd.TypeException, target.module.type, "g_testArray[0]" )
|
||||
self.assertRaises( pykd.TypeException, target.module.type, "*g_structTestPtr" )
|
||||
|
||||
def testOffset( self ):
|
||||
ti1 = target.module.type( "structTest" )
|
||||
|
Loading…
Reference in New Issue
Block a user