diff --git a/pykd/pydbgeng.h b/pykd/pydbgeng.h index c3dca93..df670f6 100644 --- a/pykd/pydbgeng.h +++ b/pykd/pydbgeng.h @@ -102,6 +102,7 @@ bool isKernelDebugging() return kdlib::isKernelDebugging(); } + inline python::object debugCommand( const std::wstring &command, bool suppressOutput = true) { diff --git a/pykd/pydbgio.h b/pykd/pydbgio.h index 9874d76..d397583 100644 --- a/pykd/pydbgio.h +++ b/pykd/pydbgio.h @@ -13,7 +13,7 @@ inline void dprint( const std::wstring &str, bool dml = false ) { python::object sys = python::import("sys"); - if (dml && PyObject_HasAttrString(python::object(sys.attr("stdout")).ptr(), "writedml")) + if (dml && 0 != PyObject_HasAttrString(python::object(sys.attr("stdout")).ptr(), "writedml")) sys.attr("stdout").attr("writedml")(str); else sys.attr("stdout").attr("write")( str ); @@ -83,4 +83,13 @@ public: /////////////////////////////////////////////////////////////////////////////// +inline +bool isWindbgExt() +{ + python::object sys = python::import("sys"); + return 0 != PyObject_HasAttrString(python::object(sys.attr("stdout")).ptr(), "writedml"); +} + +/////////////////////////////////////////////////////////////////////////////// + } diff --git a/pykd/pykdver.h b/pykd/pykdver.h index 1865eee..4af3f07 100644 --- a/pykd/pykdver.h +++ b/pykd/pykdver.h @@ -2,7 +2,7 @@ #define PYKD_VERSION_MAJOR 0 #define PYKD_VERSION_MINOR 3 #define PYKD_VERSION_SUBVERSION 0 -#define PYKD_VERSION_BUILDNO 21 +#define PYKD_VERSION_BUILDNO 22 #define __VER_STR2__(x) #x #define __VER_STR1__(x) __VER_STR2__(x) diff --git a/pykd/pymod.cpp b/pykd/pymod.cpp index c4dcd39..103851a 100644 --- a/pykd/pymod.cpp +++ b/pykd/pymod.cpp @@ -101,6 +101,7 @@ void remote_initialize( const std::wstring& remoteOptions ) void uninitialize() { + AutoRestorePyState pystate; kdlib::uninitialize(); } @@ -159,7 +160,7 @@ BOOST_PYTHON_MODULE( pykd ) "Check if it is a dump analyzing ( not living debuggee )" ); python::def( "isKernelDebugging", pykd::isKernelDebugging, "Check if kernel dubugging is running" ); - python::def( "isWindbgExt", PykdExt::isInit, + python::def( "isWindbgExt", pykd::isWindbgExt, "Check if script works in windbg context" ); python::def( "writeDump", pykd::writeDump, "Create memory dump file" ); diff --git a/pykd_bootstrapper/pykd_bootstrapper_vc120.vcxproj b/pykd_bootstrapper/pykd_bootstrapper_vc120.vcxproj index 842b659..8cdac4b 100644 --- a/pykd_bootstrapper/pykd_bootstrapper_vc120.vcxproj +++ b/pykd_bootstrapper/pykd_bootstrapper_vc120.vcxproj @@ -74,18 +74,22 @@ true $(ProjectName) + $(SolutionDir)out\$(Platform)\$(Configuration)\ true $(ProjectName) + $(SolutionDir)out\$(Platform)\$(Configuration)\ false $(ProjectName) + $(SolutionDir)out\$(Platform)\$(Configuration)\ false $(ProjectName) + $(SolutionDir)out\$(Platform)\$(Configuration)\ @@ -193,7 +197,6 @@ - diff --git a/pykd_bootstrapper/pykd_bootstrapper_vc120.vcxproj.filters b/pykd_bootstrapper/pykd_bootstrapper_vc120.vcxproj.filters index f1936f5..85fe9fa 100644 --- a/pykd_bootstrapper/pykd_bootstrapper_vc120.vcxproj.filters +++ b/pykd_bootstrapper/pykd_bootstrapper_vc120.vcxproj.filters @@ -125,6 +125,5 @@ Source Files - \ No newline at end of file diff --git a/pykd_bootstrapper/windbgext.cpp b/pykd_bootstrapper/windbgext.cpp index 39299dd..98b7d15 100644 --- a/pykd_bootstrapper/windbgext.cpp +++ b/pykd_bootstrapper/windbgext.cpp @@ -343,6 +343,7 @@ void PykdBootsTrapper::setUp() // Python debug output console helper classes python::class_<::DbgOut>("dout", "dout", python::no_init) .def("write", &::DbgOut::write) + .def("writedml", &::DbgOut::writedml) .def("flush", &::DbgOut::flush) .add_property("encoding", &::DbgOut::encoding);