[0.2.x] fixed : issue #12145 ( getOffset failes with SymbolException )

git-svn-id: https://pykd.svn.codeplex.com/svn@85081 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
SND\kernelnet_cp 2013-09-05 07:04:59 +00:00 committed by Mikhail I. Izmestev
parent b31456877d
commit 594ebc15a1

View File

@ -55,17 +55,40 @@ ULONG64 findModuleBySymbol( const std::string &symbolName )
HRESULT hres; HRESULT hres;
ULONG64 base; ULONG64 base;
hres = g_dbgEng->symbols->GetSymbolModule( ( std::string("!") + symbolName ).c_str(), &base ); std::string str = "!";
if ( FAILED( hres ) ) str += symbolName;
hres = g_dbgEng->symbols->GetSymbolModule( str.c_str(), &base );
if ( SUCCEEDED( hres ) )
return base;
DEBUG_VALUE debugValue = {};
ULONG remainderIndex = 0;
hres =
g_dbgEng->control->Evaluate(
symbolName.c_str(),
DEBUG_VALUE_INT64,
&debugValue,
&remainderIndex );
if ( SUCCEEDED( hres ) )
{ {
ULONG64 base;
ULONG moduleIndex;
hres = g_dbgEng->symbols->GetModuleByOffset( debugValue.I64, 0, &moduleIndex, &base );
if ( FAILED( hres ) )
throw DbgException( "IDebugSymbol::GetModuleByOffset", hres );
return base;
}
std::stringstream sstr; std::stringstream sstr;
sstr << "failed to find module for symbol: " << symbolName; sstr << "failed to find module for symbol: " << symbolName;
throw SymbolException( sstr.str() ); throw SymbolException( sstr.str() );
} }
return base;
}
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
namespace { namespace {