From 128394ff851db35ded8998555bef8000a4b264e8 Mon Sep 17 00:00:00 2001 From: "SND\\EreTIk_cp" Date: Mon, 2 Sep 2013 16:18:07 +0000 Subject: [PATCH] [0.3.x] + attachKernel, isLocalKernelDebuggerEnabled git-svn-id: https://pykd.svn.codeplex.com/svn@85046 9b283d60-5439-405e-af05-b73fd8c4d996 --- pykd/dbgengine.cpp | 9 +++++++++ pykd/dbgengine.h | 2 ++ pykd/pymod.cpp | 6 ++++++ 3 files changed, 17 insertions(+) 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,