mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-20 03:23:23 +08:00
[~] Remove trailing spaces, tabs replaced by spaces. Testing TFS
git-svn-id: https://pykd.svn.codeplex.com/svn@62137 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
parent
cbd2aa5bf0
commit
a191d81ffe
@ -11,50 +11,50 @@
|
|||||||
boost::python::object
|
boost::python::object
|
||||||
findSymbolForAddress( ULONG64 addr )
|
findSymbolForAddress( ULONG64 addr )
|
||||||
{
|
{
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
addr = addr64( addr );
|
addr = addr64( addr );
|
||||||
|
|
||||||
ULONG moduleIndex;
|
ULONG moduleIndex;
|
||||||
ULONG64 moduleBase;
|
ULONG64 moduleBase;
|
||||||
hres = dbgExt->symbols->GetModuleByOffset( addr, 0, &moduleIndex, &moduleBase );
|
hres = dbgExt->symbols->GetModuleByOffset( addr, 0, &moduleIndex, &moduleBase );
|
||||||
|
|
||||||
if ( FAILED( hres ) )
|
if ( FAILED( hres ) )
|
||||||
{
|
{
|
||||||
return boost::python::object();
|
return boost::python::object();
|
||||||
}
|
}
|
||||||
|
|
||||||
char moduleName[0x100];
|
char moduleName[0x100];
|
||||||
hres = dbgExt->symbols2->GetModuleNameString( DEBUG_MODNAME_MODULE, moduleIndex, moduleBase,
|
hres = dbgExt->symbols2->GetModuleNameString( DEBUG_MODNAME_MODULE, moduleIndex, moduleBase,
|
||||||
moduleName, sizeof( moduleName ), NULL );
|
moduleName, sizeof( moduleName ), NULL );
|
||||||
|
|
||||||
if ( FAILED( hres ) )
|
if ( FAILED( hres ) )
|
||||||
throw DbgException( "IDebugSymbol2::GetModuleNameString failed" );
|
throw DbgException( "IDebugSymbol2::GetModuleNameString failed" );
|
||||||
|
|
||||||
char symbolName[0x100];
|
char symbolName[0x100];
|
||||||
ULONG64 displace = 0;
|
ULONG64 displace = 0;
|
||||||
hres = dbgExt->symbols->GetNameByOffset( addr, symbolName, sizeof(symbolName), NULL, &displace );
|
hres = dbgExt->symbols->GetNameByOffset( addr, symbolName, sizeof(symbolName), NULL, &displace );
|
||||||
if ( FAILED( hres ) )
|
if ( FAILED( hres ) )
|
||||||
throw DbgException( "IDebugSymbol::GetNameByOffset failed" );
|
throw DbgException( "IDebugSymbol::GetNameByOffset failed" );
|
||||||
|
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
displace == 0 ? ss << symbolName : ss << symbolName << '+' << std::hex << displace;
|
displace == 0 ? ss << symbolName : ss << symbolName << '+' << std::hex << displace;
|
||||||
|
|
||||||
return boost::python::object( ss.str() );
|
return boost::python::object( ss.str() );
|
||||||
|
|
||||||
}
|
}
|
||||||
catch( std::exception &e )
|
catch( std::exception &e )
|
||||||
{
|
{
|
||||||
dbgExt->control->Output( DEBUG_OUTPUT_ERROR, "pykd error: %s\n", e.what() );
|
dbgExt->control->Output( DEBUG_OUTPUT_ERROR, "pykd error: %s\n", e.what() );
|
||||||
}
|
}
|
||||||
catch(...)
|
catch(...)
|
||||||
{
|
{
|
||||||
dbgExt->control->Output( DEBUG_OUTPUT_ERROR, "pykd unexpected error\n" );
|
dbgExt->control->Output( DEBUG_OUTPUT_ERROR, "pykd unexpected error\n" );
|
||||||
}
|
}
|
||||||
|
|
||||||
return boost::python::object();
|
return boost::python::object();
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
@ -62,29 +62,29 @@ findSymbolForAddress( ULONG64 addr )
|
|||||||
ULONG64
|
ULONG64
|
||||||
findAddressForSymbol( const std::string &moduleName, const std::string &symbolName )
|
findAddressForSymbol( const std::string &moduleName, const std::string &symbolName )
|
||||||
{
|
{
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
std::string ModuleSymName = moduleName;
|
std::string ModuleSymName = moduleName;
|
||||||
ModuleSymName += "!";
|
ModuleSymName += "!";
|
||||||
ModuleSymName += symbolName;
|
ModuleSymName += symbolName;
|
||||||
|
|
||||||
ULONG64 offset = 0ULL;
|
ULONG64 offset = 0ULL;
|
||||||
hres = dbgExt->symbols->GetOffsetByName( ModuleSymName.c_str(), &offset );
|
hres = dbgExt->symbols->GetOffsetByName( ModuleSymName.c_str(), &offset );
|
||||||
if ( SUCCEEDED( hres ) )
|
if ( SUCCEEDED( hres ) )
|
||||||
return offset;
|
return offset;
|
||||||
}
|
}
|
||||||
catch( std::exception &e )
|
catch( std::exception &e )
|
||||||
{
|
{
|
||||||
dbgExt->control->Output( DEBUG_OUTPUT_ERROR, "pykd error: %s\n", e.what() );
|
dbgExt->control->Output( DEBUG_OUTPUT_ERROR, "pykd error: %s\n", e.what() );
|
||||||
}
|
}
|
||||||
catch(...)
|
catch(...)
|
||||||
{
|
{
|
||||||
dbgExt->control->Output( DEBUG_OUTPUT_ERROR, "pykd unexpected error\n" );
|
dbgExt->control->Output( DEBUG_OUTPUT_ERROR, "pykd unexpected error\n" );
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////
|
Loading…
Reference in New Issue
Block a user