From d1ac91ae715e3e2ab6b72f67e8dae6516411130f Mon Sep 17 00:00:00 2001 From: ussrhero Date: Mon, 4 Feb 2019 20:44:05 +0300 Subject: [PATCH] adopted to new version kdlibcpp --- kdlibcpp | 2 +- pykd/pydbgeng.h | 4 ++-- pykd/pyeventhandler.cpp | 4 ++-- pykd/pyeventhandler.h | 28 ++++++++++++++-------------- pykd/pykdver.h | 2 +- pykd/pymod.cpp | 5 +++-- 6 files changed, 23 insertions(+), 22 deletions(-) diff --git a/kdlibcpp b/kdlibcpp index 7c3fcfb..199df2e 160000 --- a/kdlibcpp +++ b/kdlibcpp @@ -1 +1 @@ -Subproject commit 7c3fcfbf80300cf100b6fe98d40662a1c56041b4 +Subproject commit 199df2e24cc766b2bc1cd531548584b0af6e1a44 diff --git a/pykd/pydbgeng.h b/pykd/pydbgeng.h index 18cfdc7..b296d9c 100644 --- a/pykd/pydbgeng.h +++ b/pykd/pydbgeng.h @@ -19,10 +19,10 @@ kdlib::PROCESS_DEBUG_ID startProcess(const std::wstring &processName, const kdl } inline -kdlib::PROCESS_DEBUG_ID attachProcess(kdlib::PROCESS_ID pid) +kdlib::PROCESS_DEBUG_ID attachProcess(kdlib::PROCESS_ID pid, const kdlib::ProcessDebugFlags& flags = kdlib::ProcessDebugDefault) { AutoRestorePyState pystate; - return kdlib::attachProcess(pid); + return kdlib::attachProcess(pid, flags); } inline diff --git a/pykd/pyeventhandler.cpp b/pykd/pyeventhandler.cpp index d4ac289..9fc94ee 100644 --- a/pykd/pyeventhandler.cpp +++ b/pykd/pyeventhandler.cpp @@ -468,7 +468,7 @@ void EventHandler::onChangeBreakpoints() ///////////////////////////////////////////////////////////////////////////////// -void EventHandler::onDebugOutput(const std::wstring& text) +void EventHandler::onDebugOutput(const std::wstring& text, kdlib::OutputFlag flag) { PyEval_RestoreThread( m_pystate ); @@ -477,7 +477,7 @@ void EventHandler::onDebugOutput(const std::wstring& text) python::override pythonHandler = get_override("onDebugOutput"); if ( pythonHandler ) { - pythonHandler(text); + pythonHandler(text, flag); } } catch (const python::error_already_set &) diff --git a/pykd/pyeventhandler.h b/pykd/pyeventhandler.h index 486571e..372e746 100644 --- a/pykd/pyeventhandler.h +++ b/pykd/pyeventhandler.h @@ -28,21 +28,21 @@ public: EventHandler(); - virtual kdlib::DebugCallbackResult onBreakpoint( kdlib::BREAKPOINT_ID bpId ); - virtual kdlib::DebugCallbackResult onException( const kdlib::ExceptionInfo &exceptionInfo ); - virtual kdlib::DebugCallbackResult onModuleLoad( kdlib::MEMOFFSET_64 offset, const std::wstring &name ); - virtual kdlib::DebugCallbackResult onModuleUnload( kdlib::MEMOFFSET_64 offset, const std::wstring &name ); - virtual kdlib::DebugCallbackResult onThreadStart(); - virtual kdlib::DebugCallbackResult onThreadStop(); + kdlib::DebugCallbackResult onBreakpoint( kdlib::BREAKPOINT_ID bpId ) override; + kdlib::DebugCallbackResult onException( const kdlib::ExceptionInfo &exceptionInfo ) override; + kdlib::DebugCallbackResult onModuleLoad( kdlib::MEMOFFSET_64 offset, const std::wstring &name ) override; + kdlib::DebugCallbackResult onModuleUnload( kdlib::MEMOFFSET_64 offset, const std::wstring &name ) override; + kdlib::DebugCallbackResult onThreadStart() override; + kdlib::DebugCallbackResult onThreadStop() override; - virtual void onExecutionStatusChange(kdlib::ExecutionStatus executionStatus); - virtual void onCurrentThreadChange(kdlib::THREAD_DEBUG_ID threadid); - virtual void onChangeLocalScope(); - virtual void onChangeSymbolPaths(); - virtual void onChangeBreakpoints(); - virtual void onDebugOutput(const std::wstring& text); - virtual void onStartInput(); - virtual void onStopInput(); + void onExecutionStatusChange(kdlib::ExecutionStatus executionStatus) override; + void onCurrentThreadChange(kdlib::THREAD_DEBUG_ID threadid) override; + void onChangeLocalScope() override; + void onChangeSymbolPaths() override; + void onChangeBreakpoints() override; + void onDebugOutput(const std::wstring& text, kdlib::OutputFlag) override; + void onStartInput() override; + void onStopInput() override; private: diff --git a/pykd/pykdver.h b/pykd/pykdver.h index e7391bc..5f69344 100644 --- a/pykd/pykdver.h +++ b/pykd/pykdver.h @@ -2,7 +2,7 @@ #define PYKD_VERSION_MAJOR 0 #define PYKD_VERSION_MINOR 3 #define PYKD_VERSION_SUBVERSION 4 -#define PYKD_VERSION_BUILDNO 3 +#define PYKD_VERSION_BUILDNO 4 #define __VER_STR2__(x) #x #define __VER_STR1__(x) __VER_STR2__(x) diff --git a/pykd/pymod.cpp b/pykd/pymod.cpp index e86e718..3722140 100644 --- a/pykd/pymod.cpp +++ b/pykd/pymod.cpp @@ -36,6 +36,7 @@ static const std::string pykdVersion = PYKD_VERSION_BUILD_STR BOOST_PYTHON_FUNCTION_OVERLOADS( startProcess_, pykd::startProcess, 1, 2 ); +BOOST_PYTHON_FUNCTION_OVERLOADS( attachProcess_, pykd::attachProcess, 1, 2); BOOST_PYTHON_FUNCTION_OVERLOADS( detachProcess_, pykd::detachProcess, 0, 1 ); BOOST_PYTHON_FUNCTION_OVERLOADS( terminateProcess_, pykd::terminateProcess, 0, 1 ); BOOST_PYTHON_FUNCTION_OVERLOADS(closeDump_, pykd::closeDump, 0, 1); @@ -160,8 +161,8 @@ void pykd_init() python::def( "startProcess", pykd::startProcess, startProcess_( boost::python::args( "commandline", "debugOptions"), "Start process for debugging" ) ); - python::def("attachProcess", pykd::attachProcess, - "Attach debugger to a exsisting process"); + python::def("attachProcess", pykd::attachProcess, attachProcess_(boost::python::args("pid", "debugOptions"), + "Attach debugger to a exsisting process")); python::def( "detachProcess", pykd::detachProcess, detachProcess_( boost::python::args( "id" ), "Stop process debugging") ); python::def( "detachAllProcesses", pykd::detachAllProcesses,