mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-21 12:53:23 +08:00
[0.1.x] fixed : pykd routines can not convert parameters to long
git-svn-id: https://pykd.svn.codeplex.com/svn@74113 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
parent
1f05ab7431
commit
30795b3ef9
@ -1,9 +1,12 @@
|
|||||||
|
|
||||||
|
[!] fixed : issue #10336 ( pykd routines can not convert parameters to long )
|
||||||
|
|
||||||
version 0.1.0.7 30/01/2012
|
version 0.1.0.7 30/01/2012
|
||||||
|
|
||||||
[+] added : cpuReg class
|
[+] added : cpuReg class
|
||||||
[+] added : getLocals method for the class stackFrame
|
[+] added : getLocals method for the class stackFrame
|
||||||
[+] added : checksum method for the class module
|
[+] added : checksum method for the class module
|
||||||
[+] added : timestam method for the class module
|
[+] added : timestamp method for the class module
|
||||||
|
|
||||||
|
|
||||||
version 0.1.0.6 20/01/2012
|
version 0.1.0.6 20/01/2012
|
||||||
|
@ -150,8 +150,10 @@ BOOST_PYTHON_MODULE( pykd )
|
|||||||
.def( "__long__", &intBase::long_ )
|
.def( "__long__", &intBase::long_ )
|
||||||
.def( "__int__", &intBase::int_ )
|
.def( "__int__", &intBase::int_ )
|
||||||
.def( "__index__", &intBase::long_ )
|
.def( "__index__", &intBase::long_ )
|
||||||
.def( "__hash__", &intBase::long_ )
|
.def( "__hash__", &intBase::long_ );
|
||||||
.def( "__coerce__", &intBase::coerce );
|
|
||||||
|
python::implicitly_convertible<intBase,ULONG64>();
|
||||||
|
python::implicitly_convertible<intBase,LONG64>();
|
||||||
|
|
||||||
python::class_<DebugClient, DebugClientPtr>("dbgClient", "Class representing a debugging session", python::no_init )
|
python::class_<DebugClient, DebugClientPtr>("dbgClient", "Class representing a debugging session", python::no_init )
|
||||||
.def( "addr64", &DebugClient::addr64,
|
.def( "addr64", &DebugClient::addr64,
|
||||||
|
@ -53,6 +53,34 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class VariantToULong64 : public boost::static_visitor<ULONG64>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
template<typename T>
|
||||||
|
ULONG64 operator()(T i ) const {
|
||||||
|
return static_cast<ULONG64>( i );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class VariantToLong : public boost::static_visitor<LONG>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
template<typename T>
|
||||||
|
LONG operator()(T i ) const {
|
||||||
|
return static_cast<LONG>( i );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
class VariantToLong64 : public boost::static_visitor<LONG64>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
template<typename T>
|
||||||
|
LONG64 operator()(T i ) const {
|
||||||
|
return static_cast<LONG64>( i );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
class intBase {
|
class intBase {
|
||||||
|
|
||||||
@ -185,11 +213,23 @@ public:
|
|||||||
return boost::apply_visitor( VariantToPyobj(), getValue() ) != 0;
|
return boost::apply_visitor( VariantToPyobj(), getValue() ) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
python::object coerce() {
|
operator ULONG64() {
|
||||||
__debugbreak();
|
return boost::apply_visitor( VariantToULong64(), getValue() );
|
||||||
return python::object();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
operator ULONG() {
|
||||||
|
return boost::apply_visitor( VariantToULong(), getValue() );
|
||||||
|
}
|
||||||
|
|
||||||
|
operator LONG64() {
|
||||||
|
return boost::apply_visitor( VariantToLong64(), getValue() );
|
||||||
|
}
|
||||||
|
|
||||||
|
operator LONG() {
|
||||||
|
return boost::apply_visitor( VariantToLong(), getValue() );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
virtual BaseTypeVariant getValue() {
|
virtual BaseTypeVariant getValue() {
|
||||||
@ -224,4 +264,7 @@ private:
|
|||||||
BaseTypeVariant m_variant;
|
BaseTypeVariant m_variant;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
@ -169,7 +169,7 @@ class TypedVarTest( unittest.TestCase ):
|
|||||||
self.assertEqual( 4, tv.m_fieldNestedStruct )
|
self.assertEqual( 4, tv.m_fieldNestedStruct )
|
||||||
self.assertEqual( 5, tv.m_fieldOfUnNamed )
|
self.assertEqual( 5, tv.m_fieldOfUnNamed )
|
||||||
|
|
||||||
def testPointerToFunction( self ):
|
def testPointerToFunction(self):
|
||||||
tv1 = target.module.typedVar( "g_unTypedPtrToFunction" )
|
tv1 = target.module.typedVar( "g_unTypedPtrToFunction" )
|
||||||
|
|
||||||
# if debug: g_unTypedPtrToFunction point to jmp EnumWindowsProc2 (e9 xxxxxxxx)
|
# if debug: g_unTypedPtrToFunction point to jmp EnumWindowsProc2 (e9 xxxxxxxx)
|
||||||
@ -181,3 +181,10 @@ class TypedVarTest( unittest.TestCase ):
|
|||||||
|
|
||||||
self.assertRaises( pykd.TypeException, tv1.deref )
|
self.assertRaises( pykd.TypeException, tv1.deref )
|
||||||
self.assertRaises( pykd.TypeException, tv2.deref )
|
self.assertRaises( pykd.TypeException, tv2.deref )
|
||||||
|
|
||||||
|
|
||||||
|
def testTypeVarArg(self):
|
||||||
|
tv1 = target.module.typedVar( "structTest", target.module.g_structTest )
|
||||||
|
tv2 = target.module.typedVar( "structTest", tv1 )
|
||||||
|
self.assertEqual( tv1, tv2 )
|
||||||
|
self.assertTrue( tv1 )
|
||||||
|
Loading…
Reference in New Issue
Block a user