[+] getProcessorType: type of physical processor

git-svn-id: https://pykd.svn.codeplex.com/svn@70185 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
SND\EreTIk_cp 2011-10-03 19:47:03 +00:00
parent b8950859be
commit c9b63b1bdb
3 changed files with 41 additions and 14 deletions

View File

@ -213,6 +213,8 @@ BOOST_PYTHON_MODULE( pykd )
"Return current processor mode as string: X86, ARM, IA64 or X64" );
boost::python::def( "setProcessorMode", &setProcessorMode,
"Set current processor mode by string (X86, ARM, IA64 or X64)" );
boost::python::def( "getProcessorType", &getProcessorType,
"Returns physical processor type as string: X86, ARM, IA64 or X64");
boost::python::def( "addSynSymbol", &addSyntheticSymbol,
"Add new synthetic symbol for virtual address" );
boost::python::def( "delAllSynSymbols", &delAllSyntheticSymbols,

View File

@ -119,17 +119,10 @@ getCurrentStack()
}
/////////////////////////////////////////////////////////////////////////////////
std::string
getProcessorMode()
// Processor type to string
/////////////////////////////////////////////////////////////////////////////////
static std::string processorToStr(ULONG processorMode)
{
HRESULT hres;
ULONG processorMode;
hres = dbgExt->control->GetEffectiveProcessorType( &processorMode );
if ( FAILED( hres ) )
throw DbgException( "IDebugControl::GetEffectiveProcessorType failed" );
switch( processorMode )
{
case IMAGE_FILE_MACHINE_I386:
@ -146,7 +139,36 @@ getProcessorMode()
}
throw DbgException( "Unknown CPU type" );
}
/////////////////////////////////////////////////////////////////////////////////
std::string
getProcessorMode()
{
HRESULT hres;
ULONG processorMode;
hres = dbgExt->control->GetEffectiveProcessorType( &processorMode );
if ( FAILED( hres ) )
throw DbgException( "IDebugControl::GetEffectiveProcessorType failed" );
return processorToStr(processorMode);
}
/////////////////////////////////////////////////////////////////////////////////
std::string
getProcessorType()
{
HRESULT hres;
ULONG processorMode;
hres = dbgExt->control->GetActualProcessorType( &processorMode );
if ( FAILED( hres ) )
throw DbgException( "IDebugControl::GetEffectiveProcessorType failed" );
return processorToStr(processorMode);
}
/////////////////////////////////////////////////////////////////////////////////
@ -167,13 +189,13 @@ setProcessorMode(
else if ( mode == "X64" )
processorMode = IMAGE_FILE_MACHINE_AMD64;
else
throw DbgException( "Unknown processor type" );
throw DbgException( "Unknown processor type" );
hres = dbgExt->control->SetEffectiveProcessorType( processorMode );
if ( FAILED( hres ) )
throw DbgException( "IDebugControl::SetEffectiveProcessorType failed" );
}
}
/////////////////////////////////////////////////////////////////////////////////

View File

@ -40,11 +40,14 @@ public:
std::string
getProcessorMode();
std::string
getProcessorType();
void
setProcessorMode(
const std::string &mode );
ULONG64
ULONG64
getCurrentProcess();
VOID