From 2288f1aeb07e96ec024a2755eb70c22db4d6ac6b Mon Sep 17 00:00:00 2001 From: "SND\\kernelnet_cp" Date: Tue, 4 Jun 2013 09:25:12 +0000 Subject: [PATCH] [0.3.x] updated : tests git-svn-id: https://pykd.svn.codeplex.com/svn@83945 9b283d60-5439-405e-af05-b73fd8c4d996 --- pykd/pymod.cpp | 18 +++++++++--------- pykd/typedvar.h | 8 ++++++++ 2 files changed, 17 insertions(+), 9 deletions(-) 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