mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-21 04:13:22 +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" )
|
"Return current thread" )
|
||||||
.def("getNumberBreakpoints", TargetProcessAdapter::getNumberBreakpoints,
|
.def("getNumberBreakpoints", TargetProcessAdapter::getNumberBreakpoints,
|
||||||
"Return number of breakpoints for this process" )
|
"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" )
|
"Return a breakpoint by it's index" )
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
#include <kdlib/process.h>
|
#include <kdlib/process.h>
|
||||||
|
|
||||||
#include "pythreadstate.h"
|
#include "pythreadstate.h"
|
||||||
|
#include "pyeventhandler.h"
|
||||||
|
|
||||||
namespace pykd {
|
namespace pykd {
|
||||||
|
|
||||||
@ -68,10 +69,16 @@ struct TargetProcessAdapter {
|
|||||||
return process.getNumberBreakpoints();
|
return process.getNumberBreakpoints();
|
||||||
}
|
}
|
||||||
|
|
||||||
static kdlib::BreakpointPtr getBreakpointByIndex(kdlib::TargetProcess& process, unsigned long index)
|
static Breakpoint* getBreakpointByIndex(kdlib::TargetProcess& process, unsigned long index)
|
||||||
{
|
{
|
||||||
AutoRestorePyState pystate;
|
kdlib::BreakpointPtr bp;
|
||||||
return process.getBreakpoint(index);
|
|
||||||
|
{
|
||||||
|
AutoRestorePyState pystate;
|
||||||
|
bp = process.getBreakpoint(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Breakpoint(bp);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -42,6 +42,10 @@ class ProcessTest(unittest.TestCase):
|
|||||||
thread = proc.thread(i)
|
thread = proc.thread(i)
|
||||||
thread.setCurrent()
|
thread.setCurrent()
|
||||||
|
|
||||||
|
def testGetBreakpoint(self):
|
||||||
|
proc = pykd.targetProcess.getCurrent()
|
||||||
|
self.assertEqual(0, proc.getNumberBreakpoints())
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user