diff --git a/pykd/pymod.cpp b/pykd/pymod.cpp index cfb0171..c6a4b89 100644 --- a/pykd/pymod.cpp +++ b/pykd/pymod.cpp @@ -259,12 +259,12 @@ BOOST_PYTHON_MODULE( pykd ) // "Return a list of the typedVar class instances. Each item represents an item of the counted array in the target memory" ); // python::def("typedVarArray", &getTypedVarArrayByType, // "Return a list of the typedVar class instances. Each item represents an item of the counted array in the target memory" ); - // python::def("containingRecord", &containingRecordByName, - // "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("containingRecord", &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("containingRecord", &TypedVarAdapter::containingRecordByName, + "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("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" ); // // CPU registers // python::def( "reg", &getRegByName, @@ -412,9 +412,9 @@ BOOST_PYTHON_MODULE( pykd ) // "Return a list of the typedVar class instances. Each item represents an item of the linked list in the target memory" ) //.def("typedVarArray", &Module::getTypedVarArrayByTypeName, // "Return a list of the typedVar class instances. Each item represents an item of the counted array in the target memory" ) - //.def("containingRecord", &Module::containingRecordByName, - // "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" ) + .def("containingRecord", &kdlib::Module::containingRecord, + "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" ) .def("enumSymbols", ModuleAdapter::enumSymbols, Module_enumSymbols( python::args("mask"), "Return list of tuple ( symbolname, offset )" ) ) //.def("checksum", &Module::getCheckSum, diff --git a/pykd/typedvar.h b/pykd/typedvar.h index 4f90542..204a35c 100644 --- a/pykd/typedvar.h +++ b/pykd/typedvar.h @@ -36,6 +36,14 @@ struct TypedVarAdapter { return L"TYPEDVAR STR"; } + static kdlib::TypedVarPtr containingRecordByName( kdlib::MEMOFFSET_64 offset, const std::wstring &typeName, const std::wstring &fieldName ) { + return kdlib::containingRecord( offset, typeName, fieldName ); + } + + static kdlib::TypedVarPtr containingRecordByType( kdlib::MEMOFFSET_64 offset, kdlib::TypeInfoPtr &typeInfo, const std::wstring &fieldName ) { + return kdlib::containingRecord( offset, typeInfo, fieldName ); + + } }; } // end namespace pykd