diff --git a/pykd/pymod.cpp b/pykd/pymod.cpp index 684ff31..eb992d4 100644 --- a/pykd/pymod.cpp +++ b/pykd/pymod.cpp @@ -257,6 +257,8 @@ BOOST_PYTHON_MODULE( pykd ) python::def("containingRecord", &TypedVarAdapter::containingRecordByType, "Return instance of the typedVar class. It's value are loaded from the target memory." "The start address is calculated by the same method as the standard macro CONTAINING_RECORD does" ); + python::def("customStruct", &kdlib::defineStruct, + "return custom defined struct" ); // CPU registers python::def( "reg", &getRegisterByName, @@ -531,30 +533,24 @@ BOOST_PYTHON_MODULE( pykd ) //.def("__getitem__", &kdlib::TypedVar::getElementByIndexPtr ) ; - // python::class_("typeBuilder", - // "Class for building dynamically defined types", boost::python::no_init ) - // .def( python::init() ) - // .def( python::init<>() ) - // .add_property( "UInt1B", &TypeBuilder::getUInt1B ) - // .add_property( "UInt2B", &TypeBuilder::getUInt2B ) - // .add_property( "UInt4B", &TypeBuilder::getUInt4B ) - // .add_property( "UInt8B", &TypeBuilder::getUInt8B ) - // .add_property( "Int1B", &TypeBuilder::getInt1B ) - // .add_property( "Int2B", &TypeBuilder::getInt2B ) - // .add_property( "Int4B", &TypeBuilder::getInt4B ) - // .add_property( "Int8B", &TypeBuilder::getInt8B ) - // .add_property( "Long", &TypeBuilder::getLong ) - // .add_property( "ULong", &TypeBuilder::getULong ) - // .add_property( "Bool", &TypeBuilder::getBool ) - // .add_property( "Char", &TypeBuilder::getChar ) - // .add_property( "WChar", &TypeBuilder::getWChar ) - // .add_property( "VoidPtr", &TypeBuilder::getVoidPtr ) - // .def( "createStruct", &TypeBuilder::createStruct, TypeBuilder_createStruct( python::args( "name", "align" ), - // "Create custom struct" ) ) - // .def( "createUnion", &TypeBuilder::createUnion, - // "Create custom union" ); + python::class_("baseTypes", "base types enumeration", boost::python::no_init) + .add_static_property( "UInt1B", &BaseTypesEnum::getUInt1B ) + .add_static_property( "UInt2B", &BaseTypesEnum::getUInt2B ) + .add_static_property( "UInt4B", &BaseTypesEnum::getUInt4B ) + .add_static_property( "UInt8B", &BaseTypesEnum::getUInt8B ) + .add_static_property( "Int1B", &BaseTypesEnum::getInt1B ) + .add_static_property( "Int2B", &BaseTypesEnum::getInt2B ) + .add_static_property( "Int4B", &BaseTypesEnum::getInt4B ) + .add_static_property( "Int8B", &BaseTypesEnum::getInt8B ) + .add_static_property( "Long", &BaseTypesEnum::getLong ) + .add_static_property( "ULong", &BaseTypesEnum::getULong ) + .add_static_property( "Bool", &BaseTypesEnum::getBool ) + .add_static_property( "Char", &BaseTypesEnum::getChar ) + .add_static_property( "WChar", &BaseTypesEnum::getWChar ) + .add_static_property( "VoidPtr", &BaseTypesEnum::getVoidPtr ) + ; - python::class_( "breakpoint", + python::class_( "breakpoint", "class for breakpoint representation", python::no_init ) .def("__init__", python::make_constructor(Breakpoint::setSoftwareBreakpoint) ) ; diff --git a/pykd/typeinfo.h b/pykd/typeinfo.h index 5db7578..1cf7fb7 100644 --- a/pykd/typeinfo.h +++ b/pykd/typeinfo.h @@ -75,4 +75,21 @@ struct TypeInfoAdapter : public kdlib::TypeInfo { }; +struct BaseTypesEnum { + static kdlib::TypeInfoPtr getUInt1B() { return kdlib::loadType(L"UInt1B"); } + static kdlib::TypeInfoPtr getUInt2B() { return kdlib::loadType(L"UInt2B"); } + static kdlib::TypeInfoPtr getUInt4B() { return kdlib::loadType(L"UInt4B"); } + static kdlib::TypeInfoPtr getUInt8B() { return kdlib::loadType(L"UInt8B"); } + static kdlib::TypeInfoPtr getInt1B() { return kdlib::loadType(L"Int1B"); } + static kdlib::TypeInfoPtr getInt2B() { return kdlib::loadType(L"Int2B"); } + static kdlib::TypeInfoPtr getInt4B() { return kdlib::loadType(L"Int4B"); } + static kdlib::TypeInfoPtr getInt8B() { return kdlib::loadType(L"Int8B"); } + static kdlib::TypeInfoPtr getLong() { return kdlib::loadType(L"Long"); } + static kdlib::TypeInfoPtr getULong() { return kdlib::loadType(L"ULong"); } + static kdlib::TypeInfoPtr getBool() { return kdlib::loadType(L"Bool"); } + static kdlib::TypeInfoPtr getChar() { return kdlib::loadType(L"Char"); } + static kdlib::TypeInfoPtr getWChar() { return kdlib::loadType(L"WChar"); } + static kdlib::TypeInfoPtr getVoidPtr() { return kdlib::loadType(L"Void*"); } +}; + } // end namespace pykd