[0.3.x] added : print for typeInfo

git-svn-id: https://pykd.svn.codeplex.com/svn@84318 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
SND\kernelnet_cp 2013-07-16 15:30:25 +00:00 committed by Mikhail I. Izmestev
parent 5e7a2b5fb4
commit 13857a0385
3 changed files with 20 additions and 12 deletions

View File

@ -114,6 +114,8 @@ BOOST_PYTHON_MODULE( pykd )
"The target is executing a single instruction or--if that instruction is a subroutine call--subroutine" );
python::def( "trace", &targetStepIn,
"The target is executing a single instruction" );
python::def( "getExecutionStatus", &kdlib::targetExecutionStatus,
"Return current execution status" );
// Debug output
python::def( "dprint", &kdlib::dprint, dprint_( python::args( "str", "dml" ),
@ -341,8 +343,8 @@ BOOST_PYTHON_MODULE( pykd )
.def( "__pos__", &NumVariantAdaptor::pos )
.def( "__invert__", &NumVariantAdaptor::invert )
.def( "__nonzero__", &NumVariantAdaptor::nonzero )
//.def( "__str__", &pykd::NumVariant::str )
// .def( "__hex__", &pykd::NumVariant::hex )
.def( "__str__", &NumVariantAdaptor::str )
.def( "__hex__", &NumVariantAdaptor::hex )
.def( "__long__", &NumVariantAdaptor::long_ )
.def( "__int__", &NumVariantAdaptor::int_ )
.def( "__index__", &NumVariantAdaptor::long_ )
@ -399,10 +401,10 @@ BOOST_PYTHON_MODULE( pykd )
"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,
// "Return a image file checksum: IMAGE_OPTIONAL_HEADER.CheckSum" )
//.def("timestamp", &Module::getTimeDataStamp,
// "Return a low 32 bits of the time stamp of the image: IMAGE_FILE_HEADER.TimeDateStamp" )
.def("checksum", &kdlib::Module::getCheckSum,
"Return a image file checksum: IMAGE_OPTIONAL_HEADER.CheckSum" )
.def("timestamp", &kdlib::Module::getTimeDataStamp,
"Return a low 32 bits of the time stamp of the image: IMAGE_FILE_HEADER.TimeDateStamp" )
//.def("unloaded", &Module::isUnloaded,
// "Returns a flag that the module was unloaded")
//.def("um", &Module::isUserMode,
@ -444,8 +446,8 @@ BOOST_PYTHON_MODULE( pykd )
"Return pointer to the type" )
.def( "arrayOf", &kdlib::TypeInfo::arrayOf,
"Return array of the type" )
.def( "__str__", &TypeInfoAdapter::print,
"Return typa as a printable string" )
.def( "__str__", &kdlib::TypeInfo::str,
"Return type as a printable string" )
.def( "__getattr__", TypeInfoAdapter::getElementByName )
.def("__len__", &kdlib::TypeInfo::getElementCount )
.def("__getitem__", TypeInfoAdapter::getElementByIndex )

View File

@ -49,10 +49,6 @@ struct TypeInfoAdapter : public kdlib::TypeInfo {
return typeInfo.getElement(index);
}
static std::wstring print( kdlib::TypeInfo &typeInfo ) {
return L"TYPEINFO STR";
}
};
} // end namespace pykd

View File

@ -195,6 +195,16 @@ public:
return convertToPython(var);
}
static std::wstring str(kdlib::NumBehavior& var) {
kdlib::NumVariant v = var;
return v.asStr();
}
static std::wstring hex(kdlib::NumBehavior& var) {
kdlib::NumVariant v = var;
return v.asHex();
}
static void registerNumConvertion() {
python::converter::registry::push_back( &numConvertible, &numConstruct<long>, python::type_id<long>() );
python::converter::registry::push_back( &numConvertible, &numConstruct<unsigned long>, python::type_id<unsigned long>() );