diff --git a/pykd/dbgengine.cpp b/pykd/dbgengine.cpp index c238a39..6896f5b 100644 --- a/pykd/dbgengine.cpp +++ b/pykd/dbgengine.cpp @@ -111,6 +111,15 @@ void loadDump( const std::wstring &fileName ) /////////////////////////////////////////////////////////////////////////////// +void attachKernel( const std::wstring &connectOptions ) +{ + AutoRestorePyState pystate; + + kdlib::attachKernel(connectOptions); +} + +/////////////////////////////////////////////////////////////////////////////// + std::wstring debugCommand( const std::wstring &command ) { AutoRestorePyState pystate; diff --git a/pykd/dbgengine.h b/pykd/dbgengine.h index 8b4745c..956a196 100644 --- a/pykd/dbgengine.h +++ b/pykd/dbgengine.h @@ -18,6 +18,8 @@ kdlib::PROCESS_DEBUG_ID startProcess( const std::wstring &processName ); kdlib::PROCESS_DEBUG_ID attachProcess( kdlib::PROCESS_ID pid ); void loadDump( const std::wstring &fileName ); +void attachKernel( const std::wstring &connectOptions = L"" ); + std::wstring debugCommand( const std::wstring &command ); unsigned long long evaluate( const std::wstring &expression ); diff --git a/pykd/pymod.cpp b/pykd/pymod.cpp index 45a2210..877137e 100644 --- a/pykd/pymod.cpp +++ b/pykd/pymod.cpp @@ -30,6 +30,7 @@ static const std::string pykdVersion = PYKD_VERSION_BUILD_STR BOOST_PYTHON_FUNCTION_OVERLOADS( detachProcess_, kdlib::detachProcess, 0, 1 ); BOOST_PYTHON_FUNCTION_OVERLOADS( terminateProcess_, kdlib::terminateProcess, 0, 1 ); +BOOST_PYTHON_FUNCTION_OVERLOADS( attachKernel_, attachKernel, 0, 1 ); BOOST_PYTHON_FUNCTION_OVERLOADS( dprint_, kdlib::dprint, 1, 2 ); BOOST_PYTHON_FUNCTION_OVERLOADS( dprintln_, kdlib::dprintln, 1, 2 ); @@ -93,6 +94,11 @@ BOOST_PYTHON_MODULE( pykd ) "Stop debugging and terminate current process" ) ); python::def( "loadDump", &loadDump, "Load crash dump"); + python::def( "isLocalKernelDebuggerEnabled", &kdlib::isLocalKernelDebuggerEnabled, + "Check whether kernel debugging is enabled for the local kernel"); + python::def( "attachKernel", &attachKernel, attachKernel_( boost::python::args( "connectOptions" ), + "Connect the debugger engine to a kernel target.\n" + "If connectOptions is not specified - attach to the local kernel") ); python::def( "isDumpAnalyzing", &kdlib::isDumpAnalyzing, "Check if it is a dump analyzing ( not living debuggee )" ); python::def( "isKernelDebugging", &kdlib::isKernelDebugging,