[0.1.x] added : implemented typedVar class constructors

git-svn-id: https://pykd.svn.codeplex.com/svn@75068 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
SND\kernelnet_cp 2012-03-26 06:29:41 +00:00 committed by Mikhail I. Izmestev
parent 641741e0e5
commit 2d1d141a4c
2 changed files with 81 additions and 11 deletions

View File

@ -437,4 +437,83 @@ void terminateProcess()
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
static const boost::regex moduleSymMatch("^(?:([^!]*)!)?([^!]+)$");
TypedVarPtr DebugClient::getTypedVarByName( const std::string &varName )
{
boost::cmatch matchResult;
if ( !boost::regex_match( varName.c_str(), matchResult, moduleSymMatch ) )
{
std::stringstream sstr;
sstr << "invalid symbol name: " << varName;
throw SymbolException( sstr.str() );
}
std::string symName = std::string( matchResult[2].first, matchResult[2].second );
if ( matchResult[1].matched )
{
Module module = loadModuleByName( std::string( matchResult[1].first, matchResult[1].second ) );
return module.getTypedVarByName( symName );
}
HRESULT hres;
ULONG64 base;
hres = m_symbols->GetSymbolModule( ( std::string("!") + symName ).c_str(), &base );
if ( FAILED( hres ) )
{
std::stringstream sstr;
sstr << "failed to find module for symbol: " << symName;
throw SymbolException( sstr.str() );
}
Module module = loadModuleByOffset( base );
return module.getTypedVarByName( symName );
}
///////////////////////////////////////////////////////////////////////////////////
TypedVarPtr DebugClient::getTypedVarByTypeName( const std::string &typeName, ULONG64 addr )
{
boost::cmatch matchResult;
if ( !boost::regex_match( typeName.c_str(), matchResult, moduleSymMatch ) )
{
std::stringstream sstr;
sstr << "invalid symbol name: " << typeName;
throw SymbolException( sstr.str() );
}
std::string symName = std::string( matchResult[2].first, matchResult[2].second );
if ( matchResult[1].matched )
{
Module module = loadModuleByName( std::string( matchResult[1].first, matchResult[1].second ) );
return module.getTypedVarByTypeName( symName, addr );
}
HRESULT hres;
ULONG64 base;
hres = m_symbols->GetSymbolModule( ( std::string("!") + symName ).c_str(), &base );
if ( FAILED( hres ) )
{
std::stringstream sstr;
sstr << "failed to find module for symbol: " << symName;
throw SymbolException( sstr.str() );
}
Module module = loadModuleByOffset( base );
return module.getTypedVarByTypeName( symName, addr );
}
///////////////////////////////////////////////////////////////////////////////////
}; // end of namespace pykd }; // end of namespace pykd

View File

@ -325,15 +325,9 @@ public:
void removeBp(BPOINT_ID Id); void removeBp(BPOINT_ID Id);
void removeAllBp(); void removeAllBp();
TypedVarPtr getTypedVarByName( const std::string &varName ) TypedVarPtr getTypedVarByName( const std::string &varName );
{
throw DbgException( "not implemented" );
}
TypedVarPtr getTypedVarByTypeName( const std::string &typeName, ULONG64 addr ) TypedVarPtr getTypedVarByTypeName( const std::string &typeName, ULONG64 addr );
{
throw DbgException( "not implemented" );
}
TypedVarPtr getTypedVarByTypeInfo( const TypeInfoPtr &typeInfo, ULONG64 addr ) { TypedVarPtr getTypedVarByTypeInfo( const TypeInfoPtr &typeInfo, ULONG64 addr ) {
return TypedVar::getTypedVar( m_client, typeInfo, VarDataMemory::factory(m_dataSpaces, addr) ); return TypedVar::getTypedVar( m_client, typeInfo, VarDataMemory::factory(m_dataSpaces, addr) );
@ -344,9 +338,6 @@ private:
python::list python::list
loadArray( ULONG64 offset, ULONG count, bool phyAddr ); loadArray( ULONG64 offset, ULONG count, bool phyAddr );
//python::list
//loadArray( ULONG64 offset, ULONG count, bool phyAddr );
BpCallbackMap m_bpCallbacks; BpCallbackMap m_bpCallbacks;
SynSymbolsPtr m_symSymbols; // DebugClient is creator SynSymbolsPtr m_symSymbols; // DebugClient is creator