diff --git a/pykd/dbgengine.h b/pykd/dbgengine.h index cb3b5a1..2e6d362 100644 --- a/pykd/dbgengine.h +++ b/pykd/dbgengine.h @@ -16,6 +16,7 @@ bool isDumpAnalyzing(); bool isKernelDebugging(); void debugGo(); +void debugBreak(); // debug output void dprint( const std::wstring &str, bool dml = false ); diff --git a/pykd/pymod.cpp b/pykd/pymod.cpp index 841dc13..51eaf17 100644 --- a/pykd/pymod.cpp +++ b/pykd/pymod.cpp @@ -70,6 +70,9 @@ BOOST_PYTHON_MODULE( pykd ) python::def( "isKernelDebugging", &isKernelDebugging, "Check if kernel dubugging is running" ); + + python::def( "breakin", &debugBreak, + "Break into debugger" ); python::def( "go", &debugGo, "Go debugging" ); diff --git a/pykd/win/dbgeng.cpp b/pykd/win/dbgeng.cpp index 8bd6d66..9636243 100644 --- a/pykd/win/dbgeng.cpp +++ b/pykd/win/dbgeng.cpp @@ -168,6 +168,21 @@ void debugGo() } while( currentStatus != DEBUG_STATUS_BREAK && currentStatus != DEBUG_STATUS_NO_DEBUGGEE ); } +///////////////////////////////////////////////////////////////////////////////// + +void debugBreak() +{ + PyThreadState *pystate = PyEval_SaveThread(); + + HRESULT hres; + + hres = g_dbgEng->control->SetInterrupt( DEBUG_INTERRUPT_ACTIVE ); + + PyEval_RestoreThread( pystate ); + + if ( FAILED( hres ) ) + throw DbgException( "IDebugControl::SetInterrupt" ); +} /////////////////////////////////////////////////////////////////////////////////