[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
This commit is contained in:
SND\ussrhero_cp 2015-04-14 21:27:36 +00:00 committed by Mikhail I. Izmestev
parent 041a58f6e0
commit 0aa0c0522b
7 changed files with 19 additions and 5 deletions

View File

@ -102,6 +102,7 @@ bool isKernelDebugging()
return kdlib::isKernelDebugging(); return kdlib::isKernelDebugging();
} }
inline inline
python::object debugCommand( const std::wstring &command, bool suppressOutput = true) python::object debugCommand( const std::wstring &command, bool suppressOutput = true)
{ {

View File

@ -13,7 +13,7 @@ inline void dprint( const std::wstring &str, bool dml = false )
{ {
python::object sys = python::import("sys"); 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); sys.attr("stdout").attr("writedml")(str);
else else
sys.attr("stdout").attr("write")( str ); 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");
}
///////////////////////////////////////////////////////////////////////////////
} }

View File

@ -2,7 +2,7 @@
#define PYKD_VERSION_MAJOR 0 #define PYKD_VERSION_MAJOR 0
#define PYKD_VERSION_MINOR 3 #define PYKD_VERSION_MINOR 3
#define PYKD_VERSION_SUBVERSION 0 #define PYKD_VERSION_SUBVERSION 0
#define PYKD_VERSION_BUILDNO 21 #define PYKD_VERSION_BUILDNO 22
#define __VER_STR2__(x) #x #define __VER_STR2__(x) #x
#define __VER_STR1__(x) __VER_STR2__(x) #define __VER_STR1__(x) __VER_STR2__(x)

View File

@ -101,6 +101,7 @@ void remote_initialize( const std::wstring& remoteOptions )
void uninitialize() void uninitialize()
{ {
AutoRestorePyState pystate;
kdlib::uninitialize(); kdlib::uninitialize();
} }
@ -159,7 +160,7 @@ BOOST_PYTHON_MODULE( pykd )
"Check if it is a dump analyzing ( not living debuggee )" ); "Check if it is a dump analyzing ( not living debuggee )" );
python::def( "isKernelDebugging", pykd::isKernelDebugging, python::def( "isKernelDebugging", pykd::isKernelDebugging,
"Check if kernel dubugging is running" ); "Check if kernel dubugging is running" );
python::def( "isWindbgExt", PykdExt::isInit, python::def( "isWindbgExt", pykd::isWindbgExt,
"Check if script works in windbg context" ); "Check if script works in windbg context" );
python::def( "writeDump", pykd::writeDump, python::def( "writeDump", pykd::writeDump,
"Create memory dump file" ); "Create memory dump file" );

View File

@ -74,18 +74,22 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_2.7|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_2.7|Win32'">
<LinkIncremental>true</LinkIncremental> <LinkIncremental>true</LinkIncremental>
<TargetName>$(ProjectName)</TargetName> <TargetName>$(ProjectName)</TargetName>
<OutDir>$(SolutionDir)out\$(Platform)\$(Configuration)\</OutDir>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_2.7|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_2.7|x64'">
<LinkIncremental>true</LinkIncremental> <LinkIncremental>true</LinkIncremental>
<TargetName>$(ProjectName)</TargetName> <TargetName>$(ProjectName)</TargetName>
<OutDir>$(SolutionDir)out\$(Platform)\$(Configuration)\</OutDir>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_2.7|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_2.7|Win32'">
<LinkIncremental>false</LinkIncremental> <LinkIncremental>false</LinkIncremental>
<TargetName>$(ProjectName)</TargetName> <TargetName>$(ProjectName)</TargetName>
<OutDir>$(SolutionDir)out\$(Platform)\$(Configuration)\</OutDir>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_2.7|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_2.7|x64'">
<LinkIncremental>false</LinkIncremental> <LinkIncremental>false</LinkIncremental>
<TargetName>$(ProjectName)</TargetName> <TargetName>$(ProjectName)</TargetName>
<OutDir>$(SolutionDir)out\$(Platform)\$(Configuration)\</OutDir>
</PropertyGroup> </PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug_2.7|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug_2.7|Win32'">
<ClCompile> <ClCompile>
@ -193,7 +197,6 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="export.def" /> <None Include="export.def" />
<None Include="packages.config" />
<None Include="packages.pykd_bootstrapper_vc120.config" /> <None Include="packages.pykd_bootstrapper_vc120.config" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -125,6 +125,5 @@
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</None> </None>
<None Include="packages.pykd_bootstrapper_vc120.config" /> <None Include="packages.pykd_bootstrapper_vc120.config" />
<None Include="packages.config" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -343,6 +343,7 @@ void PykdBootsTrapper::setUp()
// Python debug output console helper classes // Python debug output console helper classes
python::class_<::DbgOut>("dout", "dout", python::no_init) python::class_<::DbgOut>("dout", "dout", python::no_init)
.def("write", &::DbgOut::write) .def("write", &::DbgOut::write)
.def("writedml", &::DbgOut::writedml)
.def("flush", &::DbgOut::flush) .def("flush", &::DbgOut::flush)
.add_property("encoding", &::DbgOut::encoding); .add_property("encoding", &::DbgOut::encoding);