From 4aeefd3ec5ec9da40ea22ecb9d626dd3886b23ff Mon Sep 17 00:00:00 2001 From: "SND\\ussrhero_cp" Date: Wed, 21 Jan 2015 20:48:46 +0000 Subject: [PATCH] [0.3.x] added : getNumberBreakpoint, breakpoints methods git-svn-id: https://pykd.svn.codeplex.com/svn@89668 9b283d60-5439-405e-af05-b73fd8c4d996 --- pykd/pykd_vc120.vcxproj | 1 + pykd/pykd_vc120.vcxproj.filters | 3 +++ pykd/pymod.cpp | 8 +++++++- pykd/pyprocess.h | 18 ++++++++++++++++++ 4 files changed, 29 insertions(+), 1 deletion(-) diff --git a/pykd/pykd_vc120.vcxproj b/pykd/pykd_vc120.vcxproj index 796fbc6..c94a038 100644 --- a/pykd/pykd_vc120.vcxproj +++ b/pykd/pykd_vc120.vcxproj @@ -182,6 +182,7 @@ + diff --git a/pykd/pykd_vc120.vcxproj.filters b/pykd/pykd_vc120.vcxproj.filters index f3b0c40..682f2ca 100644 --- a/pykd/pykd_vc120.vcxproj.filters +++ b/pykd/pykd_vc120.vcxproj.filters @@ -75,6 +75,9 @@ Header Files + + Header Files + diff --git a/pykd/pymod.cpp b/pykd/pymod.cpp index f7b527d..343331c 100644 --- a/pykd/pymod.cpp +++ b/pykd/pymod.cpp @@ -519,7 +519,11 @@ BOOST_PYTHON_MODULE( pykd ) "Return thread by its index" ) .def("currentThread", TargetProcessAdapter::getCurrentThread, "Return current thread" ) - ; + .def("getNumberBreakpoints", TargetProcessAdapter::getNumberBreakpoints, + "Return number of breakpoints for this process" ) + .def("breakpoint", TargetProcessAdapter::getBreakpointByIndex, + "Return a breakpoint by it's index" ) + ; python::class_("targetThread", "Class representing process in the target system", python::no_init ) .add_property("systemID", TargetThreadAdapter::getSystemId, @@ -528,6 +532,8 @@ BOOST_PYTHON_MODULE( pykd ) "Return TEB address" ) .def("setCurrent", TargetThreadAdapter::setCurrent, "Set this thread current") + .def("isCurrent", TargetThreadAdapter::isCurrent, + "Check if this thread is current") ; python::class_, boost::noncopyable>("module", "Class representing executable module", python::no_init ) diff --git a/pykd/pyprocess.h b/pykd/pyprocess.h index 2ed4239..8d8c3c7 100644 --- a/pykd/pyprocess.h +++ b/pykd/pyprocess.h @@ -61,6 +61,18 @@ struct TargetProcessAdapter { AutoRestorePyState pystate; return process.getCurrentThread(); } + + static unsigned long getNumberBreakpoints(kdlib::TargetProcess& process) + { + AutoRestorePyState pystate; + return process.getNumberBreakpoints(); + } + + static kdlib::BreakpointPtr getBreakpointByIndex(kdlib::TargetProcess& process, unsigned long index) + { + AutoRestorePyState pystate; + return process.getBreakpoint(index); + } }; @@ -83,6 +95,12 @@ struct TargetThreadAdapter { AutoRestorePyState pystate; return thread.setCurrent(); } + + static bool isCurrent(kdlib::TargetThread& thread) + { + AutoRestorePyState pystate; + return thread.isCurrent(); + } }; } // pykd namespace