mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-20 03:23:23 +08:00
[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:
parent
b31456877d
commit
594ebc15a1
@ -55,15 +55,38 @@ 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 ) )
|
||||||
{
|
{
|
||||||
std::stringstream sstr;
|
ULONG64 base;
|
||||||
sstr << "failed to find module for symbol: " << symbolName;
|
ULONG moduleIndex;
|
||||||
throw SymbolException( sstr.str() );
|
|
||||||
|
hres = g_dbgEng->symbols->GetModuleByOffset( debugValue.I64, 0, &moduleIndex, &base );
|
||||||
|
if ( FAILED( hres ) )
|
||||||
|
throw DbgException( "IDebugSymbol::GetModuleByOffset", hres );
|
||||||
|
|
||||||
|
return base;
|
||||||
}
|
}
|
||||||
|
|
||||||
return base;
|
std::stringstream sstr;
|
||||||
|
sstr << "failed to find module for symbol: " << symbolName;
|
||||||
|
throw SymbolException( sstr.str() );
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
Loading…
Reference in New Issue
Block a user