From 59f90a5d5a951f90bafff601ac3165143b23050f Mon Sep 17 00:00:00 2001 From: "SND\\ussrhero_cp" Date: Sun, 22 Mar 2015 21:59:31 +0000 Subject: [PATCH] [0.3.x] fixed : some bug of pykd.dll git-svn-id: https://pykd.svn.codeplex.com/svn@90071 9b283d60-5439-405e-af05-b73fd8c4d996 --- pykd_bootstrapper/windbgext.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/pykd_bootstrapper/windbgext.cpp b/pykd_bootstrapper/windbgext.cpp index 3c465e6..39299dd 100644 --- a/pykd_bootstrapper/windbgext.cpp +++ b/pykd_bootstrapper/windbgext.cpp @@ -36,6 +36,8 @@ private: PyThreadState *m_pyState; + bool m_pykdInitialized; + }; /////////////////////////////////////////////////////////////////////////////// @@ -231,9 +233,11 @@ KDLIB_EXT_COMMAND_METHOD_IMPL(PykdBootsTrapper, py) try { InterruptWatch interruptWatch; - python::exec("import pykd", global); - - python::exec("from pykd import *", global); + if (!m_pykdInitialized) + { + python::exec("__import__('pykd').initialize()", global); + m_pykdInitialized = true; + } python::exec_file(scriptFileName.c_str(), global); } @@ -379,6 +383,13 @@ void PykdBootsTrapper::startConsole() try { InterruptWatch interruptWatch; + python::exec("import pykd", global); + python::exec("from pykd import *", global); + if (!m_pykdInitialized) + { + python::exec("pykd.initialize()", global); + m_pykdInitialized = true; + } python::exec("__import__('code').InteractiveConsole(__import__('__main__').__dict__).interact()\n", global); } catch (python::error_already_set const &)