mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-21 21:03:23 +08:00
[0.3.x] added : defineFunction ( "Define custom function prototype" )
git-svn-id: https://pykd.svn.codeplex.com/svn@91037 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
parent
06239a502a
commit
669df8e55b
@ -2,7 +2,7 @@
|
|||||||
#define PYKD_VERSION_MAJOR 0
|
#define PYKD_VERSION_MAJOR 0
|
||||||
#define PYKD_VERSION_MINOR 3
|
#define PYKD_VERSION_MINOR 3
|
||||||
#define PYKD_VERSION_SUBVERSION 1
|
#define PYKD_VERSION_SUBVERSION 1
|
||||||
#define PYKD_VERSION_BUILDNO 6
|
#define PYKD_VERSION_BUILDNO 7
|
||||||
|
|
||||||
#define __VER_STR2__(x) #x
|
#define __VER_STR2__(x) #x
|
||||||
#define __VER_STR1__(x) __VER_STR2__(x)
|
#define __VER_STR1__(x) __VER_STR2__(x)
|
||||||
|
@ -89,6 +89,7 @@ BOOST_PYTHON_FUNCTION_OVERLOADS( getThreadIdBySystemId_, pykd::getThreadIdBySyst
|
|||||||
|
|
||||||
BOOST_PYTHON_FUNCTION_OVERLOADS( createStruct_, pykd::defineStruct, 1, 2 );
|
BOOST_PYTHON_FUNCTION_OVERLOADS( createStruct_, pykd::defineStruct, 1, 2 );
|
||||||
BOOST_PYTHON_FUNCTION_OVERLOADS( createUnion_, pykd::defineUnion, 1, 2 );
|
BOOST_PYTHON_FUNCTION_OVERLOADS( createUnion_, pykd::defineUnion, 1, 2 );
|
||||||
|
BOOST_PYTHON_FUNCTION_OVERLOADS( defineFunction_, pykd::defineFunction, 1, 2 );
|
||||||
|
|
||||||
BOOST_PYTHON_FUNCTION_OVERLOADS( setSoftwareBreakpoint_, Breakpoint::setSoftwareBreakpoint, 1, 2 );
|
BOOST_PYTHON_FUNCTION_OVERLOADS( setSoftwareBreakpoint_, Breakpoint::setSoftwareBreakpoint, 1, 2 );
|
||||||
BOOST_PYTHON_FUNCTION_OVERLOADS( setHardwareBreakpoint_, Breakpoint::setHardwareBreakpoint, 3, 4 );
|
BOOST_PYTHON_FUNCTION_OVERLOADS( setHardwareBreakpoint_, Breakpoint::setHardwareBreakpoint, 3, 4 );
|
||||||
@ -405,6 +406,8 @@ BOOST_PYTHON_MODULE( pykd )
|
|||||||
"Create custom struct" ) );
|
"Create custom struct" ) );
|
||||||
python::def( "createUnion", &pykd::defineUnion, createUnion_( python::args( "name", "align" ),
|
python::def( "createUnion", &pykd::defineUnion, createUnion_( python::args( "name", "align" ),
|
||||||
"Create custom union" ) );
|
"Create custom union" ) );
|
||||||
|
python::def( "defineFunction", &pykd::defineFunction, defineFunction_( python::args("returnType", "callconv"),
|
||||||
|
"Define custom function prototype" ) );
|
||||||
|
|
||||||
// CPU registers
|
// CPU registers
|
||||||
python::def( "reg", pykd::getRegisterByName,
|
python::def( "reg", pykd::getRegisterByName,
|
||||||
|
@ -38,6 +38,12 @@ inline kdlib::TypeInfoPtr defineUnion( const std::wstring& unionName, size_t ali
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline kdlib::TypeInfoPtr defineFunction( const kdlib::TypeInfoPtr& returnType, kdlib::CallingConventionType callconv = kdlib::CallConv_NearC)
|
||||||
|
{
|
||||||
|
AutoRestorePyState pystate;
|
||||||
|
return kdlib::defineFunction(returnType, callconv);
|
||||||
|
}
|
||||||
|
|
||||||
inline kdlib::TypeInfoPtr getTypeInfoByName( const std::wstring &name )
|
inline kdlib::TypeInfoPtr getTypeInfoByName( const std::wstring &name )
|
||||||
{
|
{
|
||||||
AutoRestorePyState pystate;
|
AutoRestorePyState pystate;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
"""Custom types tests"""
|
"""Custom types tests"""
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
import target
|
import target
|
||||||
@ -137,3 +137,9 @@ class CustomTypesTest(unittest.TestCase):
|
|||||||
struct.append( "field2", baseTypes.UInt1B )
|
struct.append( "field2", baseTypes.UInt1B )
|
||||||
self.assertEqual( struct.size(), 8 )
|
self.assertEqual( struct.size(), 8 )
|
||||||
self.assertEqual( struct.fieldOffset("field2"), 4 )
|
self.assertEqual( struct.fieldOffset("field2"), 4 )
|
||||||
|
|
||||||
|
def testCustomFunction(self):
|
||||||
|
functype = pykd.defineFunction( baseTypes.UInt4B )
|
||||||
|
functype.append( "var1", baseTypes.WChar)
|
||||||
|
functype.append( "var2", baseTypes.UInt4B.ptrTo() )
|
||||||
|
self.assertEqual( "UInt4B(__cdecl)(WChar, UInt4B*)", functype.name() )
|
||||||
|
Loading…
Reference in New Issue
Block a user