mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-21 21:03:23 +08:00
[0.2.x] added : getProcessorMode routine
git-svn-id: https://pykd.svn.codeplex.com/svn@78889 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
parent
2decf9abc7
commit
b91bb8ca38
@ -42,6 +42,10 @@ ULONG64 loadMSR( ULONG msr );
|
|||||||
|
|
||||||
void setMSR( ULONG msr, ULONG64 value);
|
void setMSR( ULONG msr, ULONG64 value);
|
||||||
|
|
||||||
|
std::string getProcessorMode();
|
||||||
|
|
||||||
|
std::string getProcessorType();
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
}; // end pykd namespace
|
}; // end pykd namespace
|
||||||
|
@ -192,6 +192,11 @@ BOOST_PYTHON_MODULE( pykd )
|
|||||||
"Return MSR value" );
|
"Return MSR value" );
|
||||||
python::def( "wrmsr", &setMSR,
|
python::def( "wrmsr", &setMSR,
|
||||||
"Set MSR value" );
|
"Set MSR value" );
|
||||||
|
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" );
|
||||||
|
|
||||||
|
|
||||||
// stack and local variables
|
// stack and local variables
|
||||||
python::def( "getCurrentStack", &getCurrentStack,
|
python::def( "getCurrentStack", &getCurrentStack,
|
||||||
|
@ -645,6 +645,60 @@ void getStackTrace( STACK_FRAME_DESC* frames, ULONG frameCount, ULONG* frameRetu
|
|||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
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 getProcessorMode()
|
||||||
|
{
|
||||||
|
PyThread_StateRestore pyThreadRestore( g_dbgEng->pystate );
|
||||||
|
|
||||||
|
HRESULT hres;
|
||||||
|
ULONG processorMode;
|
||||||
|
|
||||||
|
hres = g_dbgEng->control->GetEffectiveProcessorType( &processorMode );
|
||||||
|
if ( FAILED( hres ) )
|
||||||
|
throw DbgException( "IDebugControl::GetEffectiveProcessorType failed" );
|
||||||
|
|
||||||
|
return processorToStr(processorMode);
|
||||||
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
std::string getProcessorType()
|
||||||
|
{
|
||||||
|
PyThread_StateRestore pyThreadRestore( g_dbgEng->pystate );
|
||||||
|
|
||||||
|
HRESULT hres;
|
||||||
|
ULONG processorMode;
|
||||||
|
|
||||||
|
hres = g_dbgEng->control->GetActualProcessorType( &processorMode );
|
||||||
|
if ( FAILED( hres ) )
|
||||||
|
throw DbgException( "IDebugControl::GetActualProcessorType failed" );
|
||||||
|
|
||||||
|
return processorToStr(processorMode);
|
||||||
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
} // end pykd namespace
|
} // end pykd namespace
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user