mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-21 12:53:23 +08:00
[0.3.x] fixed : targetProcess.breakpoint method raises execption
git-svn-id: https://pykd.svn.codeplex.com/svn@89674 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
parent
4aeefd3ec5
commit
4561d67d21
@ -521,7 +521,7 @@ BOOST_PYTHON_MODULE( pykd )
|
||||
"Return current thread" )
|
||||
.def("getNumberBreakpoints", TargetProcessAdapter::getNumberBreakpoints,
|
||||
"Return number of breakpoints for this process" )
|
||||
.def("breakpoint", TargetProcessAdapter::getBreakpointByIndex,
|
||||
.def("breakpoint", TargetProcessAdapter::getBreakpointByIndex, python::return_value_policy<python::manage_new_object>(),
|
||||
"Return a breakpoint by it's index" )
|
||||
;
|
||||
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include <kdlib/process.h>
|
||||
|
||||
#include "pythreadstate.h"
|
||||
#include "pyeventhandler.h"
|
||||
|
||||
namespace pykd {
|
||||
|
||||
@ -68,10 +69,16 @@ struct TargetProcessAdapter {
|
||||
return process.getNumberBreakpoints();
|
||||
}
|
||||
|
||||
static kdlib::BreakpointPtr getBreakpointByIndex(kdlib::TargetProcess& process, unsigned long index)
|
||||
static Breakpoint* getBreakpointByIndex(kdlib::TargetProcess& process, unsigned long index)
|
||||
{
|
||||
kdlib::BreakpointPtr bp;
|
||||
|
||||
{
|
||||
AutoRestorePyState pystate;
|
||||
return process.getBreakpoint(index);
|
||||
bp = process.getBreakpoint(index);
|
||||
}
|
||||
|
||||
return new Breakpoint(bp);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -42,6 +42,10 @@ class ProcessTest(unittest.TestCase):
|
||||
thread = proc.thread(i)
|
||||
thread.setCurrent()
|
||||
|
||||
def testGetBreakpoint(self):
|
||||
proc = pykd.targetProcess.getCurrent()
|
||||
self.assertEqual(0, proc.getNumberBreakpoints())
|
||||
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user