Commit c9b63b1b authored by SND\EreTIk_cp's avatar SND\EreTIk_cp
Browse files

[+] getProcessorType: type of physical processor

git-svn-id: https://pykd.svn.codeplex.com/svn@70185 9b283d60-5439-405e-af05-b73fd8c4d996
parent b8950859
......@@ -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,
......
......@@ -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" );
}
}
/////////////////////////////////////////////////////////////////////////////////
......
......@@ -40,11 +40,14 @@ public:
std::string
getProcessorMode();
std::string
getProcessorType();
void
setProcessorMode(
const std::string &mode );
ULONG64
ULONG64
getCurrentProcess();
VOID
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment