mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-21 21:03:23 +08:00
[0.1.x] added : is64bitSystem routine
git-svn-id: https://pykd.svn.codeplex.com/svn@71845 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
parent
427f5e290d
commit
5ee21bec08
68
pykd/cpureg.cpp
Normal file
68
pykd/cpureg.cpp
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
#include "stdafx.h"
|
||||||
|
|
||||||
|
#include "cpureg.h"
|
||||||
|
#include "dbgclient.h"
|
||||||
|
|
||||||
|
namespace pykd {
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
python::object DebugClient::getRegByIndex( ULONG index )
|
||||||
|
{
|
||||||
|
HRESULT hres;
|
||||||
|
|
||||||
|
DEBUG_VALUE debugValue;
|
||||||
|
hres = m_registers->GetValue( index, &debugValue );
|
||||||
|
if ( FAILED( hres ) )
|
||||||
|
throw DbgException( "IDebugRegister::GetValue failed" );
|
||||||
|
|
||||||
|
switch( debugValue.Type )
|
||||||
|
{
|
||||||
|
case DEBUG_VALUE_INT8:
|
||||||
|
return boost::python::long_( debugValue.I8 );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DEBUG_VALUE_INT16:
|
||||||
|
return boost::python::long_( debugValue.I16 );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DEBUG_VALUE_INT32:
|
||||||
|
return boost::python::long_( debugValue.I32 );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DEBUG_VALUE_INT64:
|
||||||
|
return boost::python::long_(debugValue.I64 );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
throw DbgException( "Invalid register value" );
|
||||||
|
}
|
||||||
|
|
||||||
|
python::object getRegByIndex( ULONG index )
|
||||||
|
{
|
||||||
|
return g_dbgClient->getRegByIndex( index );
|
||||||
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
python::object DebugClient::getRegByName( const std::wstring ®Name )
|
||||||
|
{
|
||||||
|
ULONG registerIndex = 0;
|
||||||
|
HRESULT hres;
|
||||||
|
|
||||||
|
hres = m_registers->GetIndexByNameWide( regName.c_str(), ®isterIndex );
|
||||||
|
if ( FAILED( hres ) )
|
||||||
|
throw DbgException( "IDebugRegister2::GetIndexByNameWide failed" );
|
||||||
|
|
||||||
|
return getRegByIndex( registerIndex );
|
||||||
|
}
|
||||||
|
|
||||||
|
python::object getRegByName( const std::wstring ®Name )
|
||||||
|
{
|
||||||
|
return g_dbgClient->getRegByName( regName );
|
||||||
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
} // end namespace pykd
|
17
pykd/cpureg.h
Normal file
17
pykd/cpureg.h
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "intbase.h"
|
||||||
|
#include "dbgobj.h"
|
||||||
|
|
||||||
|
namespace pykd {
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
python::object getRegByName( const std::wstring ®Name );
|
||||||
|
|
||||||
|
python::object getRegByIndex( ULONG index );
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
}; // end pykd namespace
|
||||||
|
|
@ -88,6 +88,26 @@ ULONG getExecutionStatus()
|
|||||||
return g_dbgClient->getExecutionStatus();
|
return g_dbgClient->getExecutionStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
bool DebugClient::is64bitSystem()
|
||||||
|
{
|
||||||
|
HRESULT hres;
|
||||||
|
|
||||||
|
hres = m_control->IsPointer64Bit();
|
||||||
|
if ( FAILED( hres ) )
|
||||||
|
throw DbgException( "IDebugControl::IsPointer64Bit failed" );
|
||||||
|
|
||||||
|
return hres == S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
is64bitSystem()
|
||||||
|
{
|
||||||
|
return g_dbgClient->is64bitSystem();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
bool DebugClient::isDumpAnalyzing()
|
bool DebugClient::isDumpAnalyzing()
|
||||||
|
@ -86,6 +86,8 @@ public:
|
|||||||
template<ULONG status>
|
template<ULONG status>
|
||||||
void changeDebuggerStatus();
|
void changeDebuggerStatus();
|
||||||
|
|
||||||
|
bool is64bitSystem();
|
||||||
|
|
||||||
bool isKernelDebugging();
|
bool isKernelDebugging();
|
||||||
|
|
||||||
bool isDumpAnalyzing();
|
bool isDumpAnalyzing();
|
||||||
@ -213,6 +215,8 @@ python::tuple getDebuggeeType();
|
|||||||
|
|
||||||
ULONG getExecutionStatus();
|
ULONG getExecutionStatus();
|
||||||
|
|
||||||
|
bool is64bitSystem();
|
||||||
|
|
||||||
bool isKernelDebugging();
|
bool isKernelDebugging();
|
||||||
|
|
||||||
bool isDumpAnalyzing();
|
bool isDumpAnalyzing();
|
||||||
|
@ -145,14 +145,16 @@ BOOST_PYTHON_MODULE( pykd )
|
|||||||
"Attach debugger to a exsisting process" )
|
"Attach debugger to a exsisting process" )
|
||||||
.def( "attachKernel", &DebugClient::attachKernel,
|
.def( "attachKernel", &DebugClient::attachKernel,
|
||||||
"Attach debugger to a target's kernel" )
|
"Attach debugger to a target's kernel" )
|
||||||
.def( "expr", &pykd::DebugClient::evaluate,
|
.def( "expr", &DebugClient::evaluate,
|
||||||
"Evaluate windbg expression" )
|
"Evaluate windbg expression" )
|
||||||
.def( "getDebuggeeType", &pykd::DebugClient::getDebuggeeType,
|
.def( "getDebuggeeType", &DebugClient::getDebuggeeType,
|
||||||
"Return type of the debuggee" )
|
"Return type of the debuggee" )
|
||||||
.def( "getExecutionStatus", &pykd::DebugClient::getExecutionStatus,
|
.def( "getExecutionStatus", &DebugClient::getExecutionStatus,
|
||||||
"Return information about the execution status of the debugger" )
|
"Return information about the execution status of the debugger" )
|
||||||
.def( "go", &pykd::DebugClient::changeDebuggerStatus<DEBUG_STATUS_GO>,
|
.def( "go", &DebugClient::changeDebuggerStatus<DEBUG_STATUS_GO>,
|
||||||
"Change debugger status to DEBUG_STATUS_GO" )
|
"Change debugger status to DEBUG_STATUS_GO" )
|
||||||
|
.def( "is64bitSystem", &DebugClient::is64bitSystem,
|
||||||
|
"Check if target system has 64 address space" )
|
||||||
.def( "isDumpAnalyzing", &pykd::DebugClient::isDumpAnalyzing,
|
.def( "isDumpAnalyzing", &pykd::DebugClient::isDumpAnalyzing,
|
||||||
"Check if it is a dump analyzing ( not living debuggee )" )
|
"Check if it is a dump analyzing ( not living debuggee )" )
|
||||||
.def( "isKernelDebugging", &pykd::DebugClient::isKernelDebugging,
|
.def( "isKernelDebugging", &pykd::DebugClient::isKernelDebugging,
|
||||||
@ -252,6 +254,8 @@ BOOST_PYTHON_MODULE( pykd )
|
|||||||
"Return information about the execution status of the debugger" );
|
"Return information about the execution status of the debugger" );
|
||||||
python::def( "go", &changeDebuggerStatus<DEBUG_STATUS_GO>,
|
python::def( "go", &changeDebuggerStatus<DEBUG_STATUS_GO>,
|
||||||
"Change debugger status to DEBUG_STATUS_GO" );
|
"Change debugger status to DEBUG_STATUS_GO" );
|
||||||
|
python::def( "is64bitSystem", &is64bitSystem,
|
||||||
|
"Check if target system has 64 address space" );
|
||||||
python::def( "isDumpAnalyzing", &isDumpAnalyzing,
|
python::def( "isDumpAnalyzing", &isDumpAnalyzing,
|
||||||
"Check if it is a dump analyzing ( not living debuggee )" );
|
"Check if it is a dump analyzing ( not living debuggee )" );
|
||||||
python::def( "isKernelDebugging", &isKernelDebugging,
|
python::def( "isKernelDebugging", &isKernelDebugging,
|
||||||
|
Loading…
Reference in New Issue
Block a user