diff --git a/pykd/pykd_vc120.vcxproj b/pykd/pykd_vc120.vcxproj
index f542c56..412d088 100644
--- a/pykd/pykd_vc120.vcxproj
+++ b/pykd/pykd_vc120.vcxproj
@@ -236,6 +236,7 @@
+
diff --git a/pykd/pykd_vc120.vcxproj.filters b/pykd/pykd_vc120.vcxproj.filters
index 682f2ca..ffa05a7 100644
--- a/pykd/pykd_vc120.vcxproj.filters
+++ b/pykd/pykd_vc120.vcxproj.filters
@@ -242,6 +242,9 @@
Source Files
+
+ Source Files
+
diff --git a/pykd/pymod.cpp b/pykd/pymod.cpp
index c121dcc..ea5ade0 100644
--- a/pykd/pymod.cpp
+++ b/pykd/pymod.cpp
@@ -534,7 +534,7 @@ BOOST_PYTHON_MODULE( pykd )
.def("__init__", python::make_constructor(&kdlib::TargetSystem::getCurrent))
.def("__init__", python::make_constructor(&kdlib::TargetSystem::getByIndex))
.def("getNumber", TargetSystemAdapter::getNumberSystems,
- "Retunr number of systems").staticmethod("getNumber")
+ "Return number of systems").staticmethod("getNumber")
.def("getCurrent", TargetSystemAdapter::getCurrent,
"Return current target system").staticmethod("getCurrent")
.def("getSystemById", TargetSystemAdapter::getSystemById,
@@ -559,6 +559,8 @@ BOOST_PYTHON_MODULE( pykd )
"Return process by id")
.def("currentProcess", TargetSystemAdapter::getCurrentProcess,
"Return current process")
+ .def("processes", TargetSystemAdapter::getProcessesList,
+ "get list of processes for the target system")
;
python::class_("targetProcess", "Class representing process in the target system", python::no_init )
@@ -577,7 +579,7 @@ BOOST_PYTHON_MODULE( pykd )
.add_property("peb", TargetProcessAdapter::getPebOffset,
"Return PEB address" )
.add_property("exeName", TargetProcessAdapter::getExeName,
- "Return the process executbakle file name")
+ "Return the process executable file name")
.def("isCurrent", TargetProcessAdapter::isCurrent,
"Check if the target is current")
.def("getNumberThreads", TargetProcessAdapter::getNumberThreads,
@@ -596,6 +598,12 @@ BOOST_PYTHON_MODULE( pykd )
"Return number of modules for this process" )
.def("getModule", TargetProcessAdapter::getModuleByIndex,
"Return a module object by it's index" )
+ .def("threads", TargetProcessAdapter::getThreadList,
+ "Return list of threads for the target process")
+ .def("breakpoints", TargetProcessAdapter::getBreakpointsList,
+ "Return list of breakpoints for the target process")
+ .def("modules", TargetProcessAdapter::getModulesList,
+ "Return list of modules for the target process")
;
python::class_("targetThread", "Class representing process in the target system", python::no_init )
@@ -606,9 +614,9 @@ BOOST_PYTHON_MODULE( pykd )
.def("getCurrent", TargetThreadAdapter::getCurrent,
"Return a current thread").staticmethod("getCurrent")
.def("getThreadById", TargetThreadAdapter::getThreadById,
- "Return process by id").staticmethod("getThreadById")
+ "Return thread by id").staticmethod("getThreadById")
.add_property("id", TargetThreadAdapter::getId,
- "Return thread id")
+ "Return thread's id")
.add_property("systemID", TargetThreadAdapter::getSystemId,
"Retrun system thread ID ( TID )" )
.add_property("teb", TargetThreadAdapter::getTebOffset,
@@ -617,6 +625,8 @@ BOOST_PYTHON_MODULE( pykd )
"Set this thread current")
.def("isCurrent", TargetThreadAdapter::isCurrent,
"Check if this thread is current")
+ .def("stack", TargetThreadAdapter::getStack,
+ "Get thread's stack tarce")
;
python::class_, boost::noncopyable>("module", "Class representing executable module", python::no_init )
diff --git a/pykd/pyprocess.cpp b/pykd/pyprocess.cpp
new file mode 100644
index 0000000..14434ad
--- /dev/null
+++ b/pykd/pyprocess.cpp
@@ -0,0 +1,89 @@
+#include "stdafx.h"
+
+#include "pyprocess.h"
+#include "stladaptor.h"
+
+namespace pykd {
+
+///////////////////////////////////////////////////////////////////////////////
+
+python::list TargetSystemAdapter::getProcessesList(kdlib::TargetSystem& system)
+{
+ std::vector processLst;
+
+ do {
+ AutoRestorePyState pystate;
+ for ( unsigned long i = 0; i < system.getNumberProcesses(); ++i)
+ processLst.push_back(system.getProcessByIndex(i));
+ } while(false);
+
+ return vectorToList(processLst);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+python::list TargetProcessAdapter::getThreadList(kdlib::TargetProcess& process)
+{
+ std::vector threadLst;
+
+ do {
+ AutoRestorePyState pystate;
+ for ( unsigned long i = 0; i < process.getNumberThreads(); ++i)
+ threadLst.push_back(process.getThreadByIndex(i));
+ } while(false);
+
+ return vectorToList(threadLst);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+python::list TargetProcessAdapter::getBreakpointsList(kdlib::TargetProcess& process)
+{
+ std::vector bpLst;
+
+ do {
+ AutoRestorePyState pystate;
+ for ( unsigned long i = 0; i < process.getNumberBreakpoints(); ++i)
+ bpLst.push_back(new Breakpoint(process.getBreakpoint(i)));
+ } while(false);
+
+ return vectorToList(bpLst);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+python::list TargetProcessAdapter::getModulesList(kdlib::TargetProcess& process)
+{
+ std::vector moduleLst;
+
+ do {
+ AutoRestorePyState pystate;
+ for ( unsigned long i = 0; i < process.getNumberModules(); ++i)
+ moduleLst.push_back(process.getModuleByIndex(i));
+ } while(false);
+
+ return vectorToList(moduleLst);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+python::list TargetThreadAdapter::getStack(kdlib::TargetThread& thread)
+{
+
+ std::vector frameLst;
+
+ do {
+ AutoRestorePyState pystate;
+ kdlib::StackPtr stack = thread.getStack();
+
+ for (unsigned long i = 0; i < stack->getFrameCount(); ++i)
+ frameLst.push_back(stack->getFrame(i));
+ } while(false);
+
+ return vectorToList(frameLst);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+}
+
diff --git a/pykd/pyprocess.h b/pykd/pyprocess.h
index aad4a57..fe9b4bf 100644
--- a/pykd/pyprocess.h
+++ b/pykd/pyprocess.h
@@ -92,6 +92,8 @@ struct TargetSystemAdapter {
AutoRestorePyState pystate;
return system.isCurrent();
}
+
+ static python::list getProcessesList(kdlib::TargetSystem& system);
};
@@ -204,6 +206,12 @@ struct TargetProcessAdapter {
AutoRestorePyState pystate;
return process.getModuleByIndex(index);
}
+
+ static python::list getThreadList(kdlib::TargetProcess& process);
+
+ static python::list getBreakpointsList(kdlib::TargetProcess& process);
+
+ static python::list getModulesList(kdlib::TargetProcess& process);
};
@@ -262,6 +270,8 @@ struct TargetThreadAdapter {
AutoRestorePyState pystate;
return thread.isCurrent();
}
+
+ static python::list getStack(kdlib::TargetThread& thread);
};
} // pykd namespace