mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-21 04:13:22 +08:00
[0.1.x]
+ getNumberProcessors() + getPageSize() git-svn-id: https://pykd.svn.codeplex.com/svn@72721 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
parent
fd6ed0769e
commit
251a01d7e8
@ -30,6 +30,23 @@ typedef boost::shared_ptr<DebugClient> DebugClientPtr;
|
|||||||
|
|
||||||
class DebugClient : private DbgObject {
|
class DebugClient : private DbgObject {
|
||||||
|
|
||||||
|
private:
|
||||||
|
// simple IDebugControl4 call wrapper
|
||||||
|
template <typename T>
|
||||||
|
T getDbgControlT(
|
||||||
|
HRESULT (STDMETHODCALLTYPE IDebugControl4::*method)(T *),
|
||||||
|
const char *methodName
|
||||||
|
)
|
||||||
|
{
|
||||||
|
T retValue;
|
||||||
|
HRESULT hres = (m_control->*method)(&retValue);
|
||||||
|
if (S_OK != hres)
|
||||||
|
throw DbgException( buildExceptDesc(methodName, hres) );
|
||||||
|
return retValue;
|
||||||
|
}
|
||||||
|
#define getDbgControl(method) \
|
||||||
|
getDbgControlT( &IDebugControl4::##method, "IDebugControl4::" #method )
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
virtual ~DebugClient() {}
|
virtual ~DebugClient() {}
|
||||||
@ -208,6 +225,13 @@ public:
|
|||||||
|
|
||||||
void waitForEvent();
|
void waitForEvent();
|
||||||
|
|
||||||
|
ULONG getNumberProcessors() {
|
||||||
|
return getDbgControl(GetNumberProcessors);
|
||||||
|
}
|
||||||
|
|
||||||
|
ULONG getPageSize() {
|
||||||
|
return getDbgControl(GetPageSize);
|
||||||
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -266,7 +290,6 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
python::list
|
python::list
|
||||||
loadArray( ULONG64 offset, ULONG count, bool phyAddr );
|
loadArray( ULONG64 offset, ULONG count, bool phyAddr );
|
||||||
@ -356,6 +379,16 @@ inline ULONG delSyntheticSymbolsMask(
|
|||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
inline ULONG getNumberProcessors() {
|
||||||
|
return g_dbgClient->getNumberProcessors();
|
||||||
|
}
|
||||||
|
|
||||||
|
inline ULONG getPageSize() {
|
||||||
|
return g_dbgClient->getPageSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
template<ULONG status>
|
template<ULONG status>
|
||||||
void DebugClient::changeDebuggerStatus()
|
void DebugClient::changeDebuggerStatus()
|
||||||
{
|
{
|
||||||
|
@ -279,6 +279,10 @@ BOOST_PYTHON_MODULE( pykd )
|
|||||||
"Wait for events that breaks into the debugger" )
|
"Wait for events that breaks into the debugger" )
|
||||||
.def( "wrmsr", &DebugClient::setMSR,
|
.def( "wrmsr", &DebugClient::setMSR,
|
||||||
"Set MSR value" )
|
"Set MSR value" )
|
||||||
|
.def( "getNumberProcessors", &DebugClient::getNumberProcessors,
|
||||||
|
"Get the number of actual processors in the machine" )
|
||||||
|
.def( "getPageSize", &DebugClient::getPageSize,
|
||||||
|
"Get the page size for the currently executing processor context" )
|
||||||
.def( "addSynSymbol", &DebugClient::addSyntheticSymbol,
|
.def( "addSynSymbol", &DebugClient::addSyntheticSymbol,
|
||||||
"Add new synthetic symbol for virtual address" )
|
"Add new synthetic symbol for virtual address" )
|
||||||
.def( "delAllSynSymbols", &DebugClient::delAllSyntheticSymbols,
|
.def( "delAllSynSymbols", &DebugClient::delAllSyntheticSymbols,
|
||||||
@ -446,6 +450,10 @@ BOOST_PYTHON_MODULE( pykd )
|
|||||||
"Change debugger status to DEBUG_STATUS_STEP_INTO" );
|
"Change debugger status to DEBUG_STATUS_STEP_INTO" );
|
||||||
python::def( "waitForEvent", &waitForEvent,
|
python::def( "waitForEvent", &waitForEvent,
|
||||||
"Wait for events that breaks into the debugger" );
|
"Wait for events that breaks into the debugger" );
|
||||||
|
python::def( "getNumberProcessors", &getNumberProcessors,
|
||||||
|
"Get the number of actual processors in the machine" );
|
||||||
|
python::def( "getPageSize", &getPageSize,
|
||||||
|
"Get the page size for the currently executing processor context" );
|
||||||
|
|
||||||
python::class_<TypeInfo, TypeInfoPtr, python::bases<intBase>, boost::noncopyable >("typeInfo", "Class representing typeInfo", python::no_init )
|
python::class_<TypeInfo, TypeInfoPtr, python::bases<intBase>, boost::noncopyable >("typeInfo", "Class representing typeInfo", python::no_init )
|
||||||
.def( "name", &TypeInfo::getName )
|
.def( "name", &TypeInfo::getName )
|
||||||
|
@ -13,6 +13,14 @@ class DbgClientTest( unittest.TestCase ):
|
|||||||
def testIsKernelDebugging( self ):
|
def testIsKernelDebugging( self ):
|
||||||
self.assertFalse( pykd.isKernelDebugging() )
|
self.assertFalse( pykd.isKernelDebugging() )
|
||||||
|
|
||||||
|
def testNumberProcessors( self ):
|
||||||
|
"""Number of processors mus be >= 0"""
|
||||||
|
self.assertNotEqual( 0, pykd.getNumberProcessors() )
|
||||||
|
|
||||||
|
def testPageSize( self ):
|
||||||
|
"""Size of memory page mus be >= 4kb"""
|
||||||
|
self.assertTrue( pykd.getPageSize() >= 4*1024 )
|
||||||
|
|
||||||
def testIsDumpAnalyzing( self ):
|
def testIsDumpAnalyzing( self ):
|
||||||
self.assertFalse( pykd.isDumpAnalyzing() )
|
self.assertFalse( pykd.isDumpAnalyzing() )
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user