[0.1.x] added : rdmsr routine

[0.1.x] added : wrmsr routine

git-svn-id: https://pykd.svn.codeplex.com/svn@72655 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
SND\kernelnet_cp 2011-12-23 13:07:25 +00:00 committed by Mikhail I. Izmestev
parent da56036fee
commit f93df74624
4 changed files with 53 additions and 2 deletions

View File

@ -179,6 +179,25 @@ void loadDump( const std::wstring &fileName ) {
///////////////////////////////////////////////////////////////////////////////////
ULONG64 DebugClient::loadMSR( ULONG msr )
{
HRESULT hres;
ULONG64 value;
hres = m_dataSpaces->ReadMsr( msr, &value );
if ( FAILED( hres ) )
throw DbgException( "IDebugDataSpaces::ReadMsr failed" );
return value;
}
ULONG64 loadMSR( ULONG msr )
{
return g_dbgClient->loadMSR( msr );
}
///////////////////////////////////////////////////////////////////////////////////
void DebugClient::startProcess( const std::wstring &processName )
{
HRESULT hres;
@ -351,6 +370,22 @@ void setExecutionStatus( ULONG status )
///////////////////////////////////////////////////////////////////////////////////
void DebugClient::setMSR( ULONG msr, ULONG64 value)
{
HRESULT hres;
hres = m_dataSpaces->WriteMsr(msr, value);
if ( FAILED( hres ) )
throw DbgException( "IDebugDataSpaces::WriteMsr failed" );
}
void setMSR( ULONG msr, ULONG64 value)
{
g_dbgClient->setMSR( msr, value );
}
///////////////////////////////////////////////////////////////////////////////////
void DebugClient::waitForEvent()
{
HRESULT hres;

View File

@ -162,6 +162,8 @@ public:
python::list loadPtrArray( ULONG64 address, ULONG number );
ULONG64 loadMSR( ULONG msr );
ULONG ptrSize();
ULONG64 ptrByte( ULONG64 offset );
@ -186,6 +188,8 @@ public:
ULONG64 ptrPtr( ULONG64 offset );
void setMSR( ULONG msr, ULONG64 value);
python::object getRegByName( const std::wstring &regName );
python::object getRegByIndex( ULONG index );
@ -300,10 +304,14 @@ bool isKernelDebugging();
bool isDumpAnalyzing();
ULONG64 loadMSR( ULONG msr );
ULONG ptrSize();
void setExecutionStatus( ULONG status );
void setMSR( ULONG msr, ULONG64 value);
void terminateProcess();
void waitForEvent();

View File

@ -255,12 +255,16 @@ BOOST_PYTHON_MODULE( pykd )
"Print out string and insert end of line symbol. If dml = True string is printed with dml highlighting ( only for windbg )" )
.def( "ptrSize", &DebugClient::ptrSize,
"Return effective pointer size" )
.def ( "rdmsr", &DebugClient::loadMSR,
"Return MSR value" )
.def( "reg", &DebugClient::getRegByName,
"Return a CPU regsiter value by the register's name" )
.def( "reg", &DebugClient::getRegByIndex,
"Return a CPU regsiter value by the register's value" )
.def( "setExecutionStatus", &DebugClient::setExecutionStatus,
"Requests that the debugger engine enter an executable state" )
.def( "wrmsr", &DebugClient::setMSR,
"Set MSR value" )
.def( "step", &DebugClient::changeDebuggerStatus<DEBUG_STATUS_STEP_OVER>,
"Change debugger status to DEBUG_STATUS_STEP_OVER" )
.def( "trace", &DebugClient::changeDebuggerStatus<DEBUG_STATUS_STEP_INTO>,
@ -410,6 +414,8 @@ BOOST_PYTHON_MODULE( pykd )
"Print out string and insert end of line symbol. If dml = True string is printed with dml highlighting ( only for windbg )" ) );
python::def( "ptrSize", &ptrSize,
"Return effective pointer size" );
python::def ( "rdmsr", &DebugClient::loadMSR,
"Return MSR value" );
python::def( "reg", &getRegByName,
"Return a CPU regsiter value by the register's name" );
python::def( "reg", &getRegByIndex,
@ -418,6 +424,8 @@ BOOST_PYTHON_MODULE( pykd )
"Requests that the debugger engine enter an executable state" );
python::def( "step", &pykd::changeDebuggerStatus<DEBUG_STATUS_STEP_OVER>,
"Change debugger status to DEBUG_STATUS_STEP_OVER" );
python::def( "wrmsr", &setMSR,
"Set MSR value" );
python::def( "trace", &pykd::changeDebuggerStatus<DEBUG_STATUS_STEP_INTO>,
"Change debugger status to DEBUG_STATUS_STEP_INTO" );
python::def( "waitForEvent", &pykd::waitForEvent,

View File

@ -114,11 +114,11 @@ class BaseTest( unittest.TestCase ):
def testNewAddededApi( self ):
""" Branch test: new API 0.1.x what must be available """
self.assertTrue( hasattr(pykd, 'createDbgClient') )
self.asseerTrue( hasattr(pykd, 'detachProcess') )
self.assertTrue( hasattr(pykd, 'detachProcess') )
self.assertTrue( hasattr(pykd, 'diaLoadPdb') )
self.assertTrue( hasattr(pykd, 'getDebuggeeType' ) )
self.assertTrue( hasattr(pykd, 'getExecutionStatus' ) )
self.asseerTrue( hasattr(pykd, 'killProcess') )
self.assertTrue( hasattr(pykd, 'killProcess') )
self.assertTrue( hasattr(pykd, 'loadExt') )
self.assertTrue( hasattr(pykd, 'loadPtrList') )
self.assertTrue( hasattr(pykd, 'loadPtrArray') )