mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-20 03:23:23 +08:00
[0.1.x] updated : intBase
git-svn-id: https://pykd.svn.codeplex.com/svn@71592 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
parent
e3900c02a5
commit
664f6e4c69
116
pykd/dbgext.cpp
116
pykd/dbgext.cpp
@ -96,80 +96,80 @@ BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS( DebugClient_compareMemory, DebugClient::
|
|||||||
BOOST_PYTHON_MODULE( pykd )
|
BOOST_PYTHON_MODULE( pykd )
|
||||||
{
|
{
|
||||||
python::class_<intBase>( "intBase", "intBase", python::no_init )
|
python::class_<intBase>( "intBase", "intBase", python::no_init )
|
||||||
.def( int_( boost::python::self ) )
|
.def( int_( python::self ) )
|
||||||
//.def( boost::python::self = long() )
|
.def( "__long__", &intBase::convertLong )
|
||||||
|
|
||||||
.def( boost::python::self + long() )
|
.def( python::self + ULONG64() )
|
||||||
.def( long() + boost::python::self )
|
.def( ULONG64() + python::self )
|
||||||
.def( boost::python::self += long() )
|
.def( python::self += ULONG64() )
|
||||||
.def( boost::python::self + boost::python::self )
|
.def( python::self + python::self )
|
||||||
.def( boost::python::self += boost::python::self )
|
.def( python::self += python::self )
|
||||||
|
|
||||||
.def( boost::python::self - long() )
|
.def( python::self - ULONG64() )
|
||||||
.def( long() - boost::python::self )
|
.def( ULONG64() - python::self )
|
||||||
.def( boost::python::self -= long() )
|
.def( python::self -= ULONG64() )
|
||||||
.def( boost::python::self - boost::python::self )
|
.def( python::self - python::self )
|
||||||
.def( boost::python::self -= boost::python::self )
|
.def( python::self -= python::self )
|
||||||
|
|
||||||
.def( boost::python::self * long() )
|
.def( python::self * ULONG64() )
|
||||||
.def( long() * boost::python::self )
|
.def( ULONG64() * python::self )
|
||||||
.def( boost::python::self *= long() )
|
.def( python::self *= ULONG64() )
|
||||||
.def( boost::python::self * boost::python::self )
|
.def( python::self * python::self )
|
||||||
.def( boost::python::self *= boost::python::self )
|
.def( python::self *= python::self )
|
||||||
|
|
||||||
.def( boost::python::self / long() )
|
.def( python::self / ULONG64() )
|
||||||
.def( long() / boost::python::self )
|
.def( ULONG64() / python::self )
|
||||||
.def( boost::python::self /= long() )
|
.def( python::self /= ULONG64() )
|
||||||
.def( boost::python::self / boost::python::self )
|
.def( python::self / python::self )
|
||||||
.def( boost::python::self /= boost::python::self )
|
.def( python::self /= python::self )
|
||||||
|
|
||||||
.def( boost::python::self % long() )
|
.def( python::self % ULONG64() )
|
||||||
.def( long() % boost::python::self )
|
.def( ULONG64() % python::self )
|
||||||
.def( boost::python::self %= long() )
|
.def( python::self %= ULONG64() )
|
||||||
.def( boost::python::self % boost::python::self )
|
.def( python::self % python::self )
|
||||||
.def( boost::python::self %= boost::python::self )
|
.def( python::self %= python::self )
|
||||||
|
|
||||||
.def( boost::python::self & long() )
|
.def( python::self & ULONG64() )
|
||||||
.def( long() & boost::python::self )
|
.def( ULONG64() & python::self )
|
||||||
.def( boost::python::self &= long() )
|
.def( python::self &= ULONG64() )
|
||||||
.def( boost::python::self & boost::python::self )
|
.def( python::self & python::self )
|
||||||
.def( boost::python::self &= boost::python::self )
|
.def( python::self &= python::self )
|
||||||
|
|
||||||
.def( boost::python::self | long() )
|
.def( python::self | ULONG64() )
|
||||||
.def( long() | boost::python::self )
|
.def( ULONG64() | python::self )
|
||||||
.def( boost::python::self |= long() )
|
.def( python::self |= ULONG64() )
|
||||||
.def( boost::python::self | boost::python::self )
|
.def( python::self | python::self )
|
||||||
.def( boost::python::self |= boost::python::self )
|
.def( python::self |= python::self )
|
||||||
|
|
||||||
.def( boost::python::self ^ long() )
|
.def( python::self ^ ULONG64() )
|
||||||
.def( long() ^ boost::python::self )
|
.def( ULONG64() ^ python::self )
|
||||||
.def( boost::python::self ^= long() )
|
.def( python::self ^= ULONG64() )
|
||||||
.def( boost::python::self ^ boost::python::self )
|
.def( python::self ^ python::self )
|
||||||
.def( boost::python::self ^= boost::python::self )
|
.def( python::self ^= python::self )
|
||||||
|
|
||||||
.def( boost::python::self << long() )
|
.def( python::self << ULONG64() )
|
||||||
.def( boost::python::self <<= long() )
|
.def( python::self <<= ULONG64() )
|
||||||
|
|
||||||
.def( boost::python::self >> long() )
|
.def( python::self >> ULONG64() )
|
||||||
.def( boost::python::self >>= long() )
|
.def( python::self >>= ULONG64() )
|
||||||
|
|
||||||
.def( boost::python::self < long() )
|
.def( python::self < ULONG64() )
|
||||||
.def( boost::python::self < boost::python::self )
|
.def( python::self < python::self )
|
||||||
|
|
||||||
.def( boost::python::self <= long() )
|
.def( python::self <= ULONG64() )
|
||||||
.def( boost::python::self <= boost::python::self )
|
.def( python::self <= python::self )
|
||||||
|
|
||||||
.def( boost::python::self == long() )
|
.def( python::self == ULONG64() )
|
||||||
.def( boost::python::self == boost::python::self )
|
.def( python::self == boost::python::self )
|
||||||
|
|
||||||
.def( boost::python::self >= long() )
|
.def( python::self >= ULONG64() )
|
||||||
.def( boost::python::self >= boost::python::self )
|
.def( python::self >= boost::python::self )
|
||||||
|
|
||||||
.def( boost::python::self > long() )
|
.def( python::self > ULONG64() )
|
||||||
.def( boost::python::self > boost::python::self )
|
.def( python::self > boost::python::self )
|
||||||
|
|
||||||
.def( boost::python::self != long() )
|
.def( python::self != ULONG64() )
|
||||||
.def( boost::python::self != boost::python::self )
|
.def( python::self != boost::python::self )
|
||||||
|
|
||||||
.def( ~boost::python::self )
|
.def( ~boost::python::self )
|
||||||
.def( !boost::python::self )
|
.def( !boost::python::self )
|
||||||
|
@ -82,6 +82,8 @@ public:
|
|||||||
intBase& operator>>=(T const& rhs)
|
intBase& operator>>=(T const& rhs)
|
||||||
{ setValue( getValue() >> rhs ); return *this; }
|
{ setValue( getValue() >> rhs ); return *this; }
|
||||||
|
|
||||||
|
PyObject* convertLong() { return PyLong_FromLongLong( getValue() ); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
ULONG64 m_intValue;
|
ULONG64 m_intValue;
|
||||||
|
@ -33,7 +33,7 @@ def getTestSuite( singleName = "" ):
|
|||||||
unittest.TestLoader().loadTestsFromTestCase( dbgcmd.DbgcmdTest ),
|
unittest.TestLoader().loadTestsFromTestCase( dbgcmd.DbgcmdTest ),
|
||||||
unittest.TestLoader().loadTestsFromTestCase( clienttest.DbgClientTest ),
|
unittest.TestLoader().loadTestsFromTestCase( clienttest.DbgClientTest ),
|
||||||
unittest.TestLoader().loadTestsFromTestCase( eventtest.EventTest ),
|
unittest.TestLoader().loadTestsFromTestCase( eventtest.EventTest ),
|
||||||
unittest.TestLoader().loadTestsFromTestCase( memtest.MemoryTest )
|
unittest.TestLoader().loadTestsFromTestCase( memtest.MemoryTest ),
|
||||||
] )
|
] )
|
||||||
else:
|
else:
|
||||||
return unittest.TestSuite( unittest.TestLoader().loadTestsFromName( singleName ) )
|
return unittest.TestSuite( unittest.TestLoader().loadTestsFromName( singleName ) )
|
||||||
@ -51,9 +51,9 @@ if __name__ == "__main__":
|
|||||||
target.module = pykd.loadModule( target.moduleName )
|
target.module = pykd.loadModule( target.moduleName )
|
||||||
target.module.reload();
|
target.module.reload();
|
||||||
|
|
||||||
#suite = getTestSuite()
|
suite = getTestSuite()
|
||||||
suite = getTestSuite( "typedvar.TypedVarTest.testGlobalVar" )
|
#suite = getTestSuite( "typedvar.TypedVarTest" )
|
||||||
|
|
||||||
unittest.TextTestRunner(stream=sys.stdout, verbosity=2).run( suite )
|
unittest.TextTestRunner(stream=sys.stdout, verbosity=2).run( suite )
|
||||||
|
|
||||||
a = raw_input("\npress return\n")
|
#a = raw_input("\npress return\n")
|
@ -37,7 +37,6 @@ class TypedVarTest( unittest.TestCase ):
|
|||||||
def testPtrField(self):
|
def testPtrField(self):
|
||||||
tv = target.module.typedVar( "g_structTest" )
|
tv = target.module.typedVar( "g_structTest" )
|
||||||
self.assertEqual( 0, tv.m_field4 )
|
self.assertEqual( 0, tv.m_field4 )
|
||||||
|
|
||||||
tv1 = target.module.typedVar( "g_structTest1" )
|
tv1 = target.module.typedVar( "g_structTest1" )
|
||||||
self.assertEqual( tv.getAddress(), tv1.m_field4 )
|
self.assertEqual( tv.getAddress(), tv1.m_field4 )
|
||||||
|
|
||||||
@ -53,13 +52,14 @@ class TypedVarTest( unittest.TestCase ):
|
|||||||
self.assertEqual( 0, tv.m_arrayField[0] )
|
self.assertEqual( 0, tv.m_arrayField[0] )
|
||||||
self.assertEqual( 2, tv.m_arrayField[1] )
|
self.assertEqual( 2, tv.m_arrayField[1] )
|
||||||
self.assertEqual( 3, tv.m_noArrayField )
|
self.assertEqual( 3, tv.m_noArrayField )
|
||||||
self.assertNotEqual( -1, tv.m_arrayField[0] )
|
self.assertNotEqual( -1, long(tv.m_arrayField[0]) )
|
||||||
self.assertNotEqual( 0, tv.m_noArrayField )
|
self.assertNotEqual( 0, tv.m_noArrayField )
|
||||||
|
|
||||||
def testGlobalVar(self):
|
def testGlobalVar(self):
|
||||||
self.assertEqual( 4, target.module.typedVar( "g_ulongValue" ) )
|
self.assertEqual( 4, target.module.typedVar( "g_ulongValue" ) )
|
||||||
self.assertEqual( -100000, target.module.typedVar( "longArray" )[3] )
|
|
||||||
self.assertEqual( 0x80000000, target.module.typedVar( "ulongArray" )[3] )
|
self.assertEqual( 0x80000000, target.module.typedVar( "ulongArray" )[3] )
|
||||||
self.assertEqual( 0x8000000000000000, target.module.typedVar( "ulonglongArray" )[3] )
|
self.assertEqual( 0x8000000000000000, target.module.typedVar( "ulonglongArray" )[3] )
|
||||||
|
self.assertEqual( -100000, int(target.module.typedVar( "longArray" )[3]) )
|
||||||
|
self.assertEqual( -10000000000, long(target.module.typedVar( "longlongArray" )[4]) )
|
||||||
self.assertEqual( target.module.g_structTest, target.module.typedVar( "g_structTestPtr" ) )
|
self.assertEqual( target.module.g_structTest, target.module.typedVar( "g_structTestPtr" ) )
|
||||||
|
|
@ -64,6 +64,7 @@ unsigned short ushortArray[] = {0, 10, 0xFF, 0x8000, 0xFFFF };
|
|||||||
unsigned long ulongArray[] = {0, 0xFF, 0x8000, 0x80000000, 0xFFFFFFFF };
|
unsigned long ulongArray[] = {0, 0xFF, 0x8000, 0x80000000, 0xFFFFFFFF };
|
||||||
long longArray[] = {0, -10, -2000, -100000, 0xFFFFFFFF };
|
long longArray[] = {0, -10, -2000, -100000, 0xFFFFFFFF };
|
||||||
unsigned __int64 ulonglongArray[] = {0, 0xFF, 0xFFFFFFFF, 0x8000000000000000, 0xFFFFFFFFFFFFFFFF };
|
unsigned __int64 ulonglongArray[] = {0, 0xFF, 0xFFFFFFFF, 0x8000000000000000, 0xFFFFFFFFFFFFFFFF };
|
||||||
|
long long longlongArray[] = {0, -10, -2000, -100000, -10000000000 };
|
||||||
|
|
||||||
int intMatrix[2][3] = { { 0, 1, 2}, { 3, 4, 5 } };
|
int intMatrix[2][3] = { { 0, 1, 2}, { 3, 4, 5 } };
|
||||||
int intMatrix2[2][3] = { { 0, 1, 2}, { 3, 4, 5 } };
|
int intMatrix2[2][3] = { { 0, 1, 2}, { 3, 4, 5 } };
|
||||||
|
@ -420,6 +420,10 @@
|
|||||||
RelativePath="..\scripts\eventtest.py"
|
RelativePath="..\scripts\eventtest.py"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\scripts\intbase.py"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\scripts\memtest.py"
|
RelativePath="..\scripts\memtest.py"
|
||||||
>
|
>
|
||||||
|
Loading…
Reference in New Issue
Block a user