mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-29 20:03:33 +08:00
[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:
parent
da56036fee
commit
f93df74624
@ -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 )
|
void DebugClient::startProcess( const std::wstring &processName )
|
||||||
{
|
{
|
||||||
HRESULT hres;
|
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()
|
void DebugClient::waitForEvent()
|
||||||
{
|
{
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
|
@ -162,6 +162,8 @@ public:
|
|||||||
|
|
||||||
python::list loadPtrArray( ULONG64 address, ULONG number );
|
python::list loadPtrArray( ULONG64 address, ULONG number );
|
||||||
|
|
||||||
|
ULONG64 loadMSR( ULONG msr );
|
||||||
|
|
||||||
ULONG ptrSize();
|
ULONG ptrSize();
|
||||||
|
|
||||||
ULONG64 ptrByte( ULONG64 offset );
|
ULONG64 ptrByte( ULONG64 offset );
|
||||||
@ -186,6 +188,8 @@ public:
|
|||||||
|
|
||||||
ULONG64 ptrPtr( ULONG64 offset );
|
ULONG64 ptrPtr( ULONG64 offset );
|
||||||
|
|
||||||
|
void setMSR( ULONG msr, ULONG64 value);
|
||||||
|
|
||||||
python::object getRegByName( const std::wstring ®Name );
|
python::object getRegByName( const std::wstring ®Name );
|
||||||
|
|
||||||
python::object getRegByIndex( ULONG index );
|
python::object getRegByIndex( ULONG index );
|
||||||
@ -300,10 +304,14 @@ bool isKernelDebugging();
|
|||||||
|
|
||||||
bool isDumpAnalyzing();
|
bool isDumpAnalyzing();
|
||||||
|
|
||||||
|
ULONG64 loadMSR( ULONG msr );
|
||||||
|
|
||||||
ULONG ptrSize();
|
ULONG ptrSize();
|
||||||
|
|
||||||
void setExecutionStatus( ULONG status );
|
void setExecutionStatus( ULONG status );
|
||||||
|
|
||||||
|
void setMSR( ULONG msr, ULONG64 value);
|
||||||
|
|
||||||
void terminateProcess();
|
void terminateProcess();
|
||||||
|
|
||||||
void waitForEvent();
|
void waitForEvent();
|
||||||
|
@ -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 )" )
|
"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,
|
.def( "ptrSize", &DebugClient::ptrSize,
|
||||||
"Return effective pointer size" )
|
"Return effective pointer size" )
|
||||||
|
.def ( "rdmsr", &DebugClient::loadMSR,
|
||||||
|
"Return MSR value" )
|
||||||
.def( "reg", &DebugClient::getRegByName,
|
.def( "reg", &DebugClient::getRegByName,
|
||||||
"Return a CPU regsiter value by the register's name" )
|
"Return a CPU regsiter value by the register's name" )
|
||||||
.def( "reg", &DebugClient::getRegByIndex,
|
.def( "reg", &DebugClient::getRegByIndex,
|
||||||
"Return a CPU regsiter value by the register's value" )
|
"Return a CPU regsiter value by the register's value" )
|
||||||
.def( "setExecutionStatus", &DebugClient::setExecutionStatus,
|
.def( "setExecutionStatus", &DebugClient::setExecutionStatus,
|
||||||
"Requests that the debugger engine enter an executable state" )
|
"Requests that the debugger engine enter an executable state" )
|
||||||
|
.def( "wrmsr", &DebugClient::setMSR,
|
||||||
|
"Set MSR value" )
|
||||||
.def( "step", &DebugClient::changeDebuggerStatus<DEBUG_STATUS_STEP_OVER>,
|
.def( "step", &DebugClient::changeDebuggerStatus<DEBUG_STATUS_STEP_OVER>,
|
||||||
"Change debugger status to DEBUG_STATUS_STEP_OVER" )
|
"Change debugger status to DEBUG_STATUS_STEP_OVER" )
|
||||||
.def( "trace", &DebugClient::changeDebuggerStatus<DEBUG_STATUS_STEP_INTO>,
|
.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 )" ) );
|
"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,
|
python::def( "ptrSize", &ptrSize,
|
||||||
"Return effective pointer size" );
|
"Return effective pointer size" );
|
||||||
|
python::def ( "rdmsr", &DebugClient::loadMSR,
|
||||||
|
"Return MSR value" );
|
||||||
python::def( "reg", &getRegByName,
|
python::def( "reg", &getRegByName,
|
||||||
"Return a CPU regsiter value by the register's name" );
|
"Return a CPU regsiter value by the register's name" );
|
||||||
python::def( "reg", &getRegByIndex,
|
python::def( "reg", &getRegByIndex,
|
||||||
@ -418,6 +424,8 @@ BOOST_PYTHON_MODULE( pykd )
|
|||||||
"Requests that the debugger engine enter an executable state" );
|
"Requests that the debugger engine enter an executable state" );
|
||||||
python::def( "step", &pykd::changeDebuggerStatus<DEBUG_STATUS_STEP_OVER>,
|
python::def( "step", &pykd::changeDebuggerStatus<DEBUG_STATUS_STEP_OVER>,
|
||||||
"Change debugger status to 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>,
|
python::def( "trace", &pykd::changeDebuggerStatus<DEBUG_STATUS_STEP_INTO>,
|
||||||
"Change debugger status to DEBUG_STATUS_STEP_INTO" );
|
"Change debugger status to DEBUG_STATUS_STEP_INTO" );
|
||||||
python::def( "waitForEvent", &pykd::waitForEvent,
|
python::def( "waitForEvent", &pykd::waitForEvent,
|
||||||
|
@ -114,11 +114,11 @@ class BaseTest( unittest.TestCase ):
|
|||||||
def testNewAddededApi( self ):
|
def testNewAddededApi( self ):
|
||||||
""" Branch test: new API 0.1.x what must be available """
|
""" Branch test: new API 0.1.x what must be available """
|
||||||
self.assertTrue( hasattr(pykd, 'createDbgClient') )
|
self.assertTrue( hasattr(pykd, 'createDbgClient') )
|
||||||
self.asseerTrue( hasattr(pykd, 'detachProcess') )
|
self.assertTrue( hasattr(pykd, 'detachProcess') )
|
||||||
self.assertTrue( hasattr(pykd, 'diaLoadPdb') )
|
self.assertTrue( hasattr(pykd, 'diaLoadPdb') )
|
||||||
self.assertTrue( hasattr(pykd, 'getDebuggeeType' ) )
|
self.assertTrue( hasattr(pykd, 'getDebuggeeType' ) )
|
||||||
self.assertTrue( hasattr(pykd, 'getExecutionStatus' ) )
|
self.assertTrue( hasattr(pykd, 'getExecutionStatus' ) )
|
||||||
self.asseerTrue( hasattr(pykd, 'killProcess') )
|
self.assertTrue( hasattr(pykd, 'killProcess') )
|
||||||
self.assertTrue( hasattr(pykd, 'loadExt') )
|
self.assertTrue( hasattr(pykd, 'loadExt') )
|
||||||
self.assertTrue( hasattr(pykd, 'loadPtrList') )
|
self.assertTrue( hasattr(pykd, 'loadPtrList') )
|
||||||
self.assertTrue( hasattr(pykd, 'loadPtrArray') )
|
self.assertTrue( hasattr(pykd, 'loadPtrArray') )
|
||||||
|
Loading…
Reference in New Issue
Block a user