From 0aa0c0522b23809b432dd790a52b4eb26c0dac63 Mon Sep 17 00:00:00 2001 From: "SND\\ussrhero_cp" <SND\ussrhero_cp@9b283d60-5439-405e-af05-b73fd8c4d996> Date: Tue, 14 Apr 2015 21:27:36 +0000 Subject: [PATCH] [bootstrapper] fixed : issue #13528 (dml does not work) [bootstrapper] fixed : issue #13529 (isWindbgExt routine returns false) git-svn-id: https://pykd.svn.codeplex.com/svn@90381 9b283d60-5439-405e-af05-b73fd8c4d996 --- pykd/pydbgeng.h | 1 + pykd/pydbgio.h | 11 ++++++++++- pykd/pykdver.h | 2 +- pykd/pymod.cpp | 3 ++- pykd_bootstrapper/pykd_bootstrapper_vc120.vcxproj | 5 ++++- .../pykd_bootstrapper_vc120.vcxproj.filters | 1 - pykd_bootstrapper/windbgext.cpp | 1 + 7 files changed, 19 insertions(+), 5 deletions(-) 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 @@ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_2.7|Win32'"> <LinkIncremental>true</LinkIncremental> <TargetName>$(ProjectName)</TargetName> + <OutDir>$(SolutionDir)out\$(Platform)\$(Configuration)\</OutDir> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_2.7|x64'"> <LinkIncremental>true</LinkIncremental> <TargetName>$(ProjectName)</TargetName> + <OutDir>$(SolutionDir)out\$(Platform)\$(Configuration)\</OutDir> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_2.7|Win32'"> <LinkIncremental>false</LinkIncremental> <TargetName>$(ProjectName)</TargetName> + <OutDir>$(SolutionDir)out\$(Platform)\$(Configuration)\</OutDir> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_2.7|x64'"> <LinkIncremental>false</LinkIncremental> <TargetName>$(ProjectName)</TargetName> + <OutDir>$(SolutionDir)out\$(Platform)\$(Configuration)\</OutDir> </PropertyGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug_2.7|Win32'"> <ClCompile> @@ -193,7 +197,6 @@ </ItemGroup> <ItemGroup> <None Include="export.def" /> - <None Include="packages.config" /> <None Include="packages.pykd_bootstrapper_vc120.config" /> </ItemGroup> <ItemGroup> 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 @@ <Filter>Source Files</Filter> </None> <None Include="packages.pykd_bootstrapper_vc120.config" /> - <None Include="packages.config" /> </ItemGroup> </Project> \ 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);