mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-20 03:23:23 +08:00
[0.1.x] added : new API : typedVar class can be created directly ( creation through module calss will be depriceted )
git-svn-id: https://pykd.svn.codeplex.com/svn@74964 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
parent
d44cc55f21
commit
641741e0e5
@ -273,6 +273,10 @@ public:
|
||||
return m_control;
|
||||
}
|
||||
|
||||
CComPtr< IDebugDataSpaces4>&
|
||||
dataSpace() {
|
||||
return m_dataSpaces;
|
||||
}
|
||||
|
||||
PyThreadStateSaver&
|
||||
getThreadState() {
|
||||
@ -321,6 +325,20 @@ public:
|
||||
void removeBp(BPOINT_ID Id);
|
||||
void removeAllBp();
|
||||
|
||||
TypedVarPtr getTypedVarByName( const std::string &varName )
|
||||
{
|
||||
throw DbgException( "not implemented" );
|
||||
}
|
||||
|
||||
TypedVarPtr getTypedVarByTypeName( const std::string &typeName, ULONG64 addr )
|
||||
{
|
||||
throw DbgException( "not implemented" );
|
||||
}
|
||||
|
||||
TypedVarPtr getTypedVarByTypeInfo( const TypeInfoPtr &typeInfo, ULONG64 addr ) {
|
||||
return TypedVar::getTypedVar( m_client, typeInfo, VarDataMemory::factory(m_dataSpaces, addr) );
|
||||
}
|
||||
|
||||
private:
|
||||
template<typename T>
|
||||
python::list
|
||||
|
@ -264,6 +264,12 @@ BOOST_PYTHON_MODULE( pykd )
|
||||
"Read an signed mashine's word wide integer from the target memory" )
|
||||
.def( "ptrPtr", &DebugClient::ptrPtr,
|
||||
"Read an pointer value from the target memory" )
|
||||
.def("typedVar",&DebugClient::getTypedVarByName,
|
||||
"Return a typedVar class instance" )
|
||||
.def("typedVar",&DebugClient::getTypedVarByTypeInfo,
|
||||
"Return a typedVar class instance" )
|
||||
.def("typedVar",&DebugClient::getTypedVarByTypeName,
|
||||
"Return a typedVar class instance" )
|
||||
.def( "loadExt", &pykd::DebugClient::loadExtension,
|
||||
"Load a debuger extension" )
|
||||
.def( "loadModule", &pykd::DebugClient::loadModuleByName,
|
||||
@ -519,8 +525,10 @@ BOOST_PYTHON_MODULE( pykd )
|
||||
.def( "__getattr__", &TypeInfo::getField );
|
||||
|
||||
python::class_<TypedVar, TypedVarPtr, python::bases<intBase>, boost::noncopyable >("typedVar",
|
||||
"Class of non-primitive type object, child class of typeClass. Data from target is copied into object instance",
|
||||
python::no_init )
|
||||
"Class of non-primitive type object, child class of typeClass. Data from target is copied into object instance", python::no_init )
|
||||
.def("__init__", python::make_constructor(TypedVar::getTypedVarByName) )
|
||||
.def("__init__", python::make_constructor(TypedVar::getTypedVarByTypeName) )
|
||||
.def("__init__", python::make_constructor(TypedVar::getTypedVarByTypeInfo) )
|
||||
.def("getAddress", &TypedVar::getAddress,
|
||||
"Return virtual address" )
|
||||
.def("sizeof", &TypedVar::getSize,
|
||||
|
@ -57,6 +57,23 @@ TypedVarPtr TypedVar::getTypedVar( IDebugClient4 *client, const TypeInfoPtr& t
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
TypedVarPtr TypedVar::getTypedVarByName( const std::string &varName )
|
||||
{
|
||||
return g_dbgClient->getTypedVarByName( varName );
|
||||
}
|
||||
|
||||
TypedVarPtr TypedVar::getTypedVarByTypeName( const std::string &typeName, ULONG64 addr )
|
||||
{
|
||||
return g_dbgClient->getTypedVarByTypeName( typeName, addr );
|
||||
}
|
||||
|
||||
TypedVarPtr TypedVar::getTypedVarByTypeInfo( const TypeInfoPtr &typeInfo, ULONG64 addr )
|
||||
{
|
||||
return g_dbgClient->getTypedVarByTypeInfo( typeInfo, addr );
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
TypedVar::TypedVar ( IDebugClient4 *client, const TypeInfoPtr& typeInfo, VarDataPtr varData ) :
|
||||
DbgObject( client ),
|
||||
m_typeInfo( typeInfo ),
|
||||
|
@ -21,6 +21,12 @@ public:
|
||||
|
||||
static TypedVarPtr getTypedVar( IDebugClient4 *client, const TypeInfoPtr& typeInfo, VarDataPtr varData );
|
||||
|
||||
static TypedVarPtr getTypedVarByName( const std::string &varName );
|
||||
|
||||
static TypedVarPtr getTypedVarByTypeName( const std::string &typeName, ULONG64 addr );
|
||||
|
||||
static TypedVarPtr getTypedVarByTypeInfo( const TypeInfoPtr &typeInfo, ULONG64 addr );
|
||||
|
||||
ULONG64 getAddress() const {
|
||||
return m_varData->getAddr();
|
||||
}
|
||||
|
@ -12,6 +12,15 @@ class TypedVarTest( unittest.TestCase ):
|
||||
tv = target.module.typedVar( "structTest", target.module.g_structTest )
|
||||
tv = target.module.typedVar( "g_structTest" )
|
||||
|
||||
tv = pykd.typedVar( "structTest", target.module.g_structTest )
|
||||
tv = pykd.typedVar( target.moduleName + "!structTest", target.module.g_structTest )
|
||||
|
||||
structTest = target.module.type( "structTest" )
|
||||
tv = pykd.typedVar( structTest, target.module.g_structTest )
|
||||
|
||||
tv = pykd.typedVar( "g_structTest" )
|
||||
tv = pykd.typedVar( target.moduleName + "!g_structTest" )
|
||||
|
||||
def testBaseTypes(self):
|
||||
self.assertEqual( 1, target.module.typedVar( "g_ucharValue" ) )
|
||||
self.assertEqual( 2, target.module.typedVar( "g_ushortValue" ) )
|
||||
|
Loading…
Reference in New Issue
Block a user