mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-21 12:53:23 +08:00
[0.3.x] added : dinput routine ( provide input for debugger )
[0.3.x] added : onStartInput callback ( request debug input ) [0.3.x] added : onStopInput callback ( debug input is completed ) git-svn-id: https://pykd.svn.codeplex.com/svn@90701 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
parent
8eab57aa3c
commit
34755cec85
@ -43,6 +43,14 @@ inline void eprintln( const std::wstring &str )
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
inline void dinput(const std::wstring &str)
|
||||
{
|
||||
AutoRestorePyState pystate;
|
||||
kdlib::dinput(str);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class DbgOut : public kdlib::windbg::WindbgOut
|
||||
{
|
||||
public:
|
||||
|
@ -467,6 +467,50 @@ void EventHandler::onDebugOutput(const std::wstring& text)
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void EventHandler::onStartInput()
|
||||
{
|
||||
PyEval_RestoreThread(m_pystate);
|
||||
|
||||
try {
|
||||
|
||||
python::override pythonHandler = get_override("onStartInput");
|
||||
if (pythonHandler)
|
||||
{
|
||||
pythonHandler();
|
||||
}
|
||||
}
|
||||
catch (const python::error_already_set &)
|
||||
{
|
||||
printException();
|
||||
}
|
||||
|
||||
m_pystate = PyEval_SaveThread();
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void EventHandler::onStopInput()
|
||||
{
|
||||
PyEval_RestoreThread(m_pystate);
|
||||
|
||||
try {
|
||||
|
||||
python::override pythonHandler = get_override("onStopInput");
|
||||
if (pythonHandler)
|
||||
{
|
||||
pythonHandler();
|
||||
}
|
||||
}
|
||||
catch (const python::error_already_set &)
|
||||
{
|
||||
printException();
|
||||
}
|
||||
|
||||
m_pystate = PyEval_SaveThread();
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Breakpoint::Breakpoint(kdlib::BreakpointPtr bp)
|
||||
{
|
||||
m_pystate = PyThreadState_Get();
|
||||
|
@ -40,8 +40,8 @@ public:
|
||||
virtual void onChangeLocalScope();
|
||||
virtual void onChangeBreakpoints();
|
||||
virtual void onDebugOutput(const std::wstring& text);
|
||||
|
||||
|
||||
virtual void onStartInput();
|
||||
virtual void onStopInput();
|
||||
|
||||
private:
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
#define PYKD_VERSION_MAJOR 0
|
||||
#define PYKD_VERSION_MINOR 3
|
||||
#define PYKD_VERSION_SUBVERSION 0
|
||||
#define PYKD_VERSION_BUILDNO 25
|
||||
#define PYKD_VERSION_BUILDNO 27
|
||||
|
||||
#define __VER_STR2__(x) #x
|
||||
#define __VER_STR1__(x) __VER_STR2__(x)
|
||||
|
@ -192,6 +192,9 @@ BOOST_PYTHON_MODULE( pykd )
|
||||
"Print out string. If dml = True string is printed with dml highlighting ( only for windbg )" ) );
|
||||
python::def( "dprintln", &pykd::dprintln, dprintln_( python::args( "str", "dml" ),
|
||||
"Print out string and insert end of line symbol. If dml = True string is printed with dml highlighting ( only for windbg )" ) );
|
||||
python::def("dinput", &pykd::dinput,
|
||||
"Provide input for debugger");
|
||||
|
||||
|
||||
// Python debug output console helper classes
|
||||
python::class_<DbgOut>( "dout", "dout", python::no_init )
|
||||
@ -1045,6 +1048,10 @@ BOOST_PYTHON_MODULE( pykd )
|
||||
"Breakpoints is changed for current process" )
|
||||
.def( "onDebugOutput", &EventHandler::onDebugOutput,
|
||||
"Request debug output" )
|
||||
.def("onStartInput", &EventHandler::onStartInput,
|
||||
"Request debug input" )
|
||||
.def("onStopInput", &EventHandler::onStopInput,
|
||||
"Debug input is completed")
|
||||
.def("onThreadStart", &EventHandler::onThreadStart,
|
||||
"New thread is started in the current process" )
|
||||
.def("onThreadStop", &EventHandler::onThreadStop,
|
||||
|
@ -8,7 +8,7 @@ import zipfile
|
||||
|
||||
_name = "pykd"
|
||||
_desc = "python windbg extension"
|
||||
_version = '0.3.0.26'
|
||||
_version = '0.3.0.27'
|
||||
|
||||
def makeWheel(args):
|
||||
|
||||
@ -91,10 +91,6 @@ def makeZip(args):
|
||||
|
||||
shutil.copy( os.path.join(pykd_dir, 'pykd.pyd'), os.path.join(package_dir, 'pykd.pyd') )
|
||||
|
||||
dist_dir = os.path.join(os.path.curdir, 'dist')
|
||||
if not os.path.exists(dist_dir):
|
||||
os.mkdir(dist_dir)
|
||||
|
||||
with zipfile.ZipFile(os.path.join(os.path.curdir, 'dist', zip_name), mode='w' ) as archive:
|
||||
for srcFile in os.listdir(package_dir):
|
||||
print "zipped %s" % (srcFile)
|
||||
|
Loading…
Reference in New Issue
Block a user