mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-21 04:13:22 +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;
|
return m_control;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CComPtr< IDebugDataSpaces4>&
|
||||||
|
dataSpace() {
|
||||||
|
return m_dataSpaces;
|
||||||
|
}
|
||||||
|
|
||||||
PyThreadStateSaver&
|
PyThreadStateSaver&
|
||||||
getThreadState() {
|
getThreadState() {
|
||||||
@ -321,6 +325,20 @@ public:
|
|||||||
void removeBp(BPOINT_ID Id);
|
void removeBp(BPOINT_ID Id);
|
||||||
void removeAllBp();
|
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:
|
private:
|
||||||
template<typename T>
|
template<typename T>
|
||||||
python::list
|
python::list
|
||||||
|
@ -264,6 +264,12 @@ BOOST_PYTHON_MODULE( pykd )
|
|||||||
"Read an signed mashine's word wide integer from the target memory" )
|
"Read an signed mashine's word wide integer from the target memory" )
|
||||||
.def( "ptrPtr", &DebugClient::ptrPtr,
|
.def( "ptrPtr", &DebugClient::ptrPtr,
|
||||||
"Read an pointer value from the target memory" )
|
"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,
|
.def( "loadExt", &pykd::DebugClient::loadExtension,
|
||||||
"Load a debuger extension" )
|
"Load a debuger extension" )
|
||||||
.def( "loadModule", &pykd::DebugClient::loadModuleByName,
|
.def( "loadModule", &pykd::DebugClient::loadModuleByName,
|
||||||
@ -519,8 +525,10 @@ BOOST_PYTHON_MODULE( pykd )
|
|||||||
.def( "__getattr__", &TypeInfo::getField );
|
.def( "__getattr__", &TypeInfo::getField );
|
||||||
|
|
||||||
python::class_<TypedVar, TypedVarPtr, python::bases<intBase>, boost::noncopyable >("typedVar",
|
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",
|
"Class of non-primitive type object, child class of typeClass. Data from target is copied into object instance", python::no_init )
|
||||||
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,
|
.def("getAddress", &TypedVar::getAddress,
|
||||||
"Return virtual address" )
|
"Return virtual address" )
|
||||||
.def("sizeof", &TypedVar::getSize,
|
.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 ) :
|
TypedVar::TypedVar ( IDebugClient4 *client, const TypeInfoPtr& typeInfo, VarDataPtr varData ) :
|
||||||
DbgObject( client ),
|
DbgObject( client ),
|
||||||
m_typeInfo( typeInfo ),
|
m_typeInfo( typeInfo ),
|
||||||
|
@ -21,6 +21,12 @@ public:
|
|||||||
|
|
||||||
static TypedVarPtr getTypedVar( IDebugClient4 *client, const TypeInfoPtr& typeInfo, VarDataPtr varData );
|
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 {
|
ULONG64 getAddress() const {
|
||||||
return m_varData->getAddr();
|
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( "structTest", target.module.g_structTest )
|
||||||
tv = target.module.typedVar( "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):
|
def testBaseTypes(self):
|
||||||
self.assertEqual( 1, target.module.typedVar( "g_ucharValue" ) )
|
self.assertEqual( 1, target.module.typedVar( "g_ucharValue" ) )
|
||||||
self.assertEqual( 2, target.module.typedVar( "g_ushortValue" ) )
|
self.assertEqual( 2, target.module.typedVar( "g_ushortValue" ) )
|
||||||
|
Loading…
Reference in New Issue
Block a user