mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-19 19:13:22 +08:00
[0.1.x] added : getProcessorMode routine
[0.1.x] added : getProcessorType routine git-svn-id: https://pykd.svn.codeplex.com/svn@72357 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
parent
e44a8c41f1
commit
8b43bd9e8e
@ -97,6 +97,10 @@ public:
|
||||
|
||||
std::string getPdbFile( ULONG64 moduleBase );
|
||||
|
||||
std::string getProcessorMode();
|
||||
|
||||
std::string getProcessorType();
|
||||
|
||||
template<ULONG status>
|
||||
void changeDebuggerStatus();
|
||||
|
||||
|
@ -166,6 +166,10 @@ BOOST_PYTHON_MODULE( pykd )
|
||||
"Return traget virtual address for specified symbol" )
|
||||
.def( "getPdbFile", &DebugClient::getPdbFile,
|
||||
"Return full path to PDB (Program DataBase, debug information) file" )
|
||||
.def( "getProcessorMode", &DebugClient::getProcessorMode,
|
||||
"Return current processor mode as string: X86, ARM, IA64 or X64" )
|
||||
.def( "getProcessorType", &DebugClient::getProcessorType,
|
||||
"Return type of physical processor: X86, ARM, IA64 or X64" )
|
||||
.def( "go", &DebugClient::changeDebuggerStatus<DEBUG_STATUS_GO>,
|
||||
"Change debugger status to DEBUG_STATUS_GO" )
|
||||
.def( "is64bitSystem", &DebugClient::is64bitSystem,
|
||||
@ -293,6 +297,10 @@ BOOST_PYTHON_MODULE( pykd )
|
||||
"Return full path to PDB (Program DataBase, debug information) file" );
|
||||
python::def( "go", &changeDebuggerStatus<DEBUG_STATUS_GO>,
|
||||
"Change debugger status to DEBUG_STATUS_GO" );
|
||||
python::def( "getProcessorMode", &getProcessorMode,
|
||||
"Return current processor mode as string: X86, ARM, IA64 or X64" );
|
||||
python::def( "getProcessorType", &getProcessorType,
|
||||
"Return type of physical processor: X86, ARM, IA64 or X64" );
|
||||
python::def( "is64bitSystem", &is64bitSystem,
|
||||
"Check if target system has 64 address space" );
|
||||
python::def( "isDumpAnalyzing", &isDumpAnalyzing,
|
||||
|
@ -78,4 +78,64 @@ getCurrentStack()
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static std::string processorToStr(ULONG processorMode)
|
||||
{
|
||||
switch( processorMode )
|
||||
{
|
||||
case IMAGE_FILE_MACHINE_I386:
|
||||
return "X86";
|
||||
|
||||
case IMAGE_FILE_MACHINE_ARM:
|
||||
return "ARM";
|
||||
|
||||
case IMAGE_FILE_MACHINE_IA64:
|
||||
return "IA64";
|
||||
|
||||
case IMAGE_FILE_MACHINE_AMD64:
|
||||
return "X64";
|
||||
}
|
||||
|
||||
throw DbgException( "Unknown CPU type" );
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
std::string DebugClient::getProcessorMode()
|
||||
{
|
||||
HRESULT hres;
|
||||
ULONG processorMode;
|
||||
|
||||
hres = m_control->GetEffectiveProcessorType( &processorMode );
|
||||
if ( FAILED( hres ) )
|
||||
throw DbgException( "IDebugControl::GetEffectiveProcessorType failed" );
|
||||
|
||||
return processorToStr(processorMode);
|
||||
}
|
||||
|
||||
std::string getProcessorMode()
|
||||
{
|
||||
return g_dbgClient->getProcessorMode();
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
std::string DebugClient::getProcessorType()
|
||||
{
|
||||
HRESULT hres;
|
||||
ULONG processorMode;
|
||||
|
||||
hres = m_control->GetActualProcessorType( &processorMode );
|
||||
if ( FAILED( hres ) )
|
||||
throw DbgException( "IDebugControl::GetActualProcessorType failed" );
|
||||
|
||||
return processorToStr(processorMode);
|
||||
}
|
||||
|
||||
std::string getProcessorType()
|
||||
{
|
||||
return g_dbgClient->getProcessorType();
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}
|
@ -10,6 +10,10 @@ ULONG64 getImplicitThread();
|
||||
|
||||
python::list getCurrentStack();
|
||||
|
||||
std::string getProcessorMode();
|
||||
|
||||
std::string getProcessorType();
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}
|
||||
|
@ -24,9 +24,7 @@ class DbgClientTest( unittest.TestCase ):
|
||||
|
||||
def testPdbFile( self ):
|
||||
self.assertNotEqual( '', target.module )
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def testProcessorMode( self ):
|
||||
self.assertNotEqual( '', pykd.getProcessorMode() )
|
||||
self.assertNotEqual( '', pykd.getProcessorType() )
|
||||
|
Loading…
Reference in New Issue
Block a user