mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-21 04:13:22 +08:00
[pykd] added : rdmsr routine ( Return MSR value )
git-svn-id: https://pykd.svn.codeplex.com/svn@65796 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
parent
04adeb02ee
commit
b30c1d15cb
@ -104,6 +104,8 @@ BOOST_PYTHON_MODULE( pykd )
|
|||||||
"Return pointer size ( in bytes )" );
|
"Return pointer size ( in bytes )" );
|
||||||
boost::python::def( "reg", &loadRegister,
|
boost::python::def( "reg", &loadRegister,
|
||||||
"Return CPU's register value" );
|
"Return CPU's register value" );
|
||||||
|
boost::python::def( "rdmsr", &loadMSR,
|
||||||
|
"Return MSR value" );
|
||||||
boost::python::def( "typedVarList", &loadTypedVarList,
|
boost::python::def( "typedVarList", &loadTypedVarList,
|
||||||
"Return list of typedVarClass instances. Each item represents one item of the linked list in the target memory" );
|
"Return list of typedVarClass instances. Each item represents one item of the linked list in the target memory" );
|
||||||
boost::python::def( "typedVarArray", &loadTypedVarArray,
|
boost::python::def( "typedVarArray", &loadTypedVarArray,
|
||||||
|
@ -12,49 +12,53 @@ boost::python::object
|
|||||||
loadRegister( const std::string ®isterName )
|
loadRegister( const std::string ®isterName )
|
||||||
{
|
{
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
ULONG registerIndex = 0;
|
ULONG registerIndex = 0;
|
||||||
|
|
||||||
hres = dbgExt->registers->GetIndexByName( registerName.c_str(), ®isterIndex );
|
hres = dbgExt->registers->GetIndexByName( registerName.c_str(), ®isterIndex );
|
||||||
if ( FAILED( hres ) )
|
if ( FAILED( hres ) )
|
||||||
throw DbgException( "IDebugRegister::GetIndexByName failed" );
|
throw DbgException( "IDebugRegister::GetIndexByName failed" );
|
||||||
|
|
||||||
DEBUG_VALUE debugValue;
|
DEBUG_VALUE debugValue;
|
||||||
hres = dbgExt->registers->GetValue( registerIndex, &debugValue );
|
hres = dbgExt->registers->GetValue( registerIndex, &debugValue );
|
||||||
if ( FAILED( hres ) )
|
if ( FAILED( hres ) )
|
||||||
throw DbgException( "IDebugRegister::GetValue failed" );
|
throw DbgException( "IDebugRegister::GetValue failed" );
|
||||||
|
|
||||||
switch( debugValue.Type )
|
switch( debugValue.Type )
|
||||||
{
|
{
|
||||||
case DEBUG_VALUE_INT8:
|
case DEBUG_VALUE_INT8:
|
||||||
return boost::python::long_( debugValue.I8 );
|
return boost::python::long_( debugValue.I8 );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DEBUG_VALUE_INT16:
|
case DEBUG_VALUE_INT16:
|
||||||
return boost::python::long_( debugValue.I16 );
|
return boost::python::long_( debugValue.I16 );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DEBUG_VALUE_INT32:
|
case DEBUG_VALUE_INT32:
|
||||||
return boost::python::long_( debugValue.I32 );
|
return boost::python::long_( debugValue.I32 );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DEBUG_VALUE_INT64:
|
case DEBUG_VALUE_INT64:
|
||||||
return boost::python::long_(debugValue.I64 );
|
return boost::python::long_(debugValue.I64 );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
catch( std::exception &e )
|
throw DbgException( "Invalid register value" );
|
||||||
{
|
}
|
||||||
dbgExt->control->Output( DEBUG_OUTPUT_ERROR, "pykd error: %s\n", e.what() );
|
|
||||||
}
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
catch(...)
|
|
||||||
{
|
ULONG64
|
||||||
dbgExt->control->Output( DEBUG_OUTPUT_ERROR, "pykd unexpected error\n" );
|
loadMSR( ULONG msr )
|
||||||
}
|
{
|
||||||
|
HRESULT hres;
|
||||||
return boost::python::str( "REG_ERR" );
|
ULONG64 value;
|
||||||
|
|
||||||
|
hres = dbgExt->dataSpaces->ReadMsr( msr, &value );
|
||||||
|
if ( FAILED( hres ) )
|
||||||
|
throw DbgException( "IDebugDataSpaces::ReadMsr failed" );
|
||||||
|
|
||||||
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -7,4 +7,7 @@
|
|||||||
boost::python::object
|
boost::python::object
|
||||||
loadRegister( const std::string ®isterName );
|
loadRegister( const std::string ®isterName );
|
||||||
|
|
||||||
|
ULONG64
|
||||||
|
loadMSR( ULONG msr );
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////
|
Loading…
Reference in New Issue
Block a user