diff --git a/pykd/dbgext.cpp b/pykd/dbgext.cpp index 0d16233..fdafe4a 100644 --- a/pykd/dbgext.cpp +++ b/pykd/dbgext.cpp @@ -96,80 +96,80 @@ BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS( DebugClient_compareMemory, DebugClient:: BOOST_PYTHON_MODULE( pykd ) { python::class_( "intBase", "intBase", python::no_init ) - .def( int_( boost::python::self ) ) - //.def( boost::python::self = long() ) + .def( int_( python::self ) ) + .def( "__long__", &intBase::convertLong ) - .def( boost::python::self + long() ) - .def( long() + boost::python::self ) - .def( boost::python::self += long() ) - .def( boost::python::self + boost::python::self ) - .def( boost::python::self += boost::python::self ) + .def( python::self + ULONG64() ) + .def( ULONG64() + python::self ) + .def( python::self += ULONG64() ) + .def( python::self + python::self ) + .def( python::self += python::self ) - .def( boost::python::self - long() ) - .def( long() - boost::python::self ) - .def( boost::python::self -= long() ) - .def( boost::python::self - boost::python::self ) - .def( boost::python::self -= boost::python::self ) + .def( python::self - ULONG64() ) + .def( ULONG64() - python::self ) + .def( python::self -= ULONG64() ) + .def( python::self - python::self ) + .def( python::self -= python::self ) - .def( boost::python::self * long() ) - .def( long() * boost::python::self ) - .def( boost::python::self *= long() ) - .def( boost::python::self * boost::python::self ) - .def( boost::python::self *= boost::python::self ) + .def( python::self * ULONG64() ) + .def( ULONG64() * python::self ) + .def( python::self *= ULONG64() ) + .def( python::self * python::self ) + .def( python::self *= python::self ) - .def( boost::python::self / long() ) - .def( long() / boost::python::self ) - .def( boost::python::self /= long() ) - .def( boost::python::self / boost::python::self ) - .def( boost::python::self /= boost::python::self ) + .def( python::self / ULONG64() ) + .def( ULONG64() / python::self ) + .def( python::self /= ULONG64() ) + .def( python::self / python::self ) + .def( python::self /= python::self ) - .def( boost::python::self % long() ) - .def( long() % boost::python::self ) - .def( boost::python::self %= long() ) - .def( boost::python::self % boost::python::self ) - .def( boost::python::self %= boost::python::self ) + .def( python::self % ULONG64() ) + .def( ULONG64() % python::self ) + .def( python::self %= ULONG64() ) + .def( python::self % python::self ) + .def( python::self %= python::self ) - .def( boost::python::self & long() ) - .def( long() & boost::python::self ) - .def( boost::python::self &= long() ) - .def( boost::python::self & boost::python::self ) - .def( boost::python::self &= boost::python::self ) + .def( python::self & ULONG64() ) + .def( ULONG64() & python::self ) + .def( python::self &= ULONG64() ) + .def( python::self & python::self ) + .def( python::self &= python::self ) - .def( boost::python::self | long() ) - .def( long() | boost::python::self ) - .def( boost::python::self |= long() ) - .def( boost::python::self | boost::python::self ) - .def( boost::python::self |= boost::python::self ) + .def( python::self | ULONG64() ) + .def( ULONG64() | python::self ) + .def( python::self |= ULONG64() ) + .def( python::self | python::self ) + .def( python::self |= python::self ) - .def( boost::python::self ^ long() ) - .def( long() ^ boost::python::self ) - .def( boost::python::self ^= long() ) - .def( boost::python::self ^ boost::python::self ) - .def( boost::python::self ^= boost::python::self ) + .def( python::self ^ ULONG64() ) + .def( ULONG64() ^ python::self ) + .def( python::self ^= ULONG64() ) + .def( python::self ^ python::self ) + .def( python::self ^= python::self ) - .def( boost::python::self << long() ) - .def( boost::python::self <<= long() ) + .def( python::self << ULONG64() ) + .def( python::self <<= ULONG64() ) - .def( boost::python::self >> long() ) - .def( boost::python::self >>= long() ) + .def( python::self >> ULONG64() ) + .def( python::self >>= ULONG64() ) - .def( boost::python::self < long() ) - .def( boost::python::self < boost::python::self ) + .def( python::self < ULONG64() ) + .def( python::self < python::self ) - .def( boost::python::self <= long() ) - .def( boost::python::self <= boost::python::self ) + .def( python::self <= ULONG64() ) + .def( python::self <= python::self ) - .def( boost::python::self == long() ) - .def( boost::python::self == boost::python::self ) + .def( python::self == ULONG64() ) + .def( python::self == boost::python::self ) - .def( boost::python::self >= long() ) - .def( boost::python::self >= boost::python::self ) + .def( python::self >= ULONG64() ) + .def( python::self >= boost::python::self ) - .def( boost::python::self > long() ) - .def( boost::python::self > boost::python::self ) + .def( python::self > ULONG64() ) + .def( python::self > boost::python::self ) - .def( boost::python::self != long() ) - .def( boost::python::self != boost::python::self ) + .def( python::self != ULONG64() ) + .def( python::self != boost::python::self ) .def( ~boost::python::self ) .def( !boost::python::self ) diff --git a/pykd/intbase.h b/pykd/intbase.h index 898577b..04fee50 100644 --- a/pykd/intbase.h +++ b/pykd/intbase.h @@ -82,6 +82,8 @@ public: intBase& operator>>=(T const& rhs) { setValue( getValue() >> rhs ); return *this; } + PyObject* convertLong() { return PyLong_FromLongLong( getValue() ); } + private: ULONG64 m_intValue; diff --git a/test/scripts/pykdtest.py b/test/scripts/pykdtest.py index fd7a67c..916c3f6 100644 --- a/test/scripts/pykdtest.py +++ b/test/scripts/pykdtest.py @@ -33,7 +33,7 @@ def getTestSuite( singleName = "" ): unittest.TestLoader().loadTestsFromTestCase( dbgcmd.DbgcmdTest ), unittest.TestLoader().loadTestsFromTestCase( clienttest.DbgClientTest ), unittest.TestLoader().loadTestsFromTestCase( eventtest.EventTest ), - unittest.TestLoader().loadTestsFromTestCase( memtest.MemoryTest ) + unittest.TestLoader().loadTestsFromTestCase( memtest.MemoryTest ), ] ) else: return unittest.TestSuite( unittest.TestLoader().loadTestsFromName( singleName ) ) @@ -51,9 +51,9 @@ if __name__ == "__main__": target.module = pykd.loadModule( target.moduleName ) target.module.reload(); - #suite = getTestSuite() - suite = getTestSuite( "typedvar.TypedVarTest.testGlobalVar" ) + suite = getTestSuite() + #suite = getTestSuite( "typedvar.TypedVarTest" ) unittest.TextTestRunner(stream=sys.stdout, verbosity=2).run( suite ) - a = raw_input("\npress return\n") \ No newline at end of file + #a = raw_input("\npress return\n") \ No newline at end of file diff --git a/test/scripts/typedvar.py b/test/scripts/typedvar.py index 2c91bc3..f268673 100644 --- a/test/scripts/typedvar.py +++ b/test/scripts/typedvar.py @@ -37,7 +37,6 @@ class TypedVarTest( unittest.TestCase ): def testPtrField(self): tv = target.module.typedVar( "g_structTest" ) self.assertEqual( 0, tv.m_field4 ) - tv1 = target.module.typedVar( "g_structTest1" ) self.assertEqual( tv.getAddress(), tv1.m_field4 ) @@ -53,13 +52,14 @@ class TypedVarTest( unittest.TestCase ): self.assertEqual( 0, tv.m_arrayField[0] ) self.assertEqual( 2, tv.m_arrayField[1] ) 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 ) def testGlobalVar(self): 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( 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" ) ) \ No newline at end of file diff --git a/test/targetapp/targetapp.cpp b/test/targetapp/targetapp.cpp index 3373af9..4585d03 100644 --- a/test/targetapp/targetapp.cpp +++ b/test/targetapp/targetapp.cpp @@ -64,6 +64,7 @@ unsigned short ushortArray[] = {0, 10, 0xFF, 0x8000, 0xFFFF }; unsigned long ulongArray[] = {0, 0xFF, 0x8000, 0x80000000, 0xFFFFFFFF }; long longArray[] = {0, -10, -2000, -100000, 0xFFFFFFFF }; 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 intMatrix2[2][3] = { { 0, 1, 2}, { 3, 4, 5 } }; diff --git a/test/targetapp/targetapp.vcproj b/test/targetapp/targetapp.vcproj index 8a932f0..4f61382 100644 --- a/test/targetapp/targetapp.vcproj +++ b/test/targetapp/targetapp.vcproj @@ -420,6 +420,10 @@ RelativePath="..\scripts\eventtest.py" > + +