mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-21 04:13:22 +08:00
[0.2.x] added : removeBp routine
git-svn-id: https://pykd.svn.codeplex.com/svn@78899 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
parent
17b0cf7447
commit
e9fa66a877
@ -15,6 +15,7 @@ ULONG setSoftwareBp(ULONG64 offset, BpCallback &callback = BpCallback() );
|
|||||||
ULONG setHardwareBp(ULONG64 offset, ULONG size, ULONG accessType, BpCallback &callback = BpCallback());
|
ULONG setHardwareBp(ULONG64 offset, ULONG size, ULONG accessType, BpCallback &callback = BpCallback());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
//inline BPOINT_ID setSoftwareBp(ULONG64 addr, BpCallback &callback = BpCallback()) {
|
//inline BPOINT_ID setSoftwareBp(ULONG64 addr, BpCallback &callback = BpCallback()) {
|
||||||
|
@ -64,6 +64,8 @@ void getStackTrace( STACK_FRAME_DESC* frames, ULONG frameCount, ULONG* frameRetu
|
|||||||
|
|
||||||
//breakpoints
|
//breakpoints
|
||||||
ULONG breakPointSet( ULONG64 offset, bool hardware = false, ULONG size = 0, ULONG accessType = 0 );
|
ULONG breakPointSet( ULONG64 offset, bool hardware = false, ULONG size = 0, ULONG accessType = 0 );
|
||||||
|
void breakPointRemove( ULONG id );
|
||||||
|
void breakPointRemoveAll();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -226,7 +226,10 @@ BOOST_PYTHON_MODULE( pykd )
|
|||||||
"Set software breakpoint on executiont" ) );
|
"Set software breakpoint on executiont" ) );
|
||||||
python::def( "setBp", &setHardwareBp, setHardwareBp_( python::args( "offset", "size", "accsessType", "callback" ) ,
|
python::def( "setBp", &setHardwareBp, setHardwareBp_( python::args( "offset", "size", "accsessType", "callback" ) ,
|
||||||
"Set hardware breakpoint" ) );
|
"Set hardware breakpoint" ) );
|
||||||
|
python::def( "removeBp", &breakPointRemove,
|
||||||
|
"Remove breapoint by IDs" );
|
||||||
|
python::def( "removeAllBp", &breakPointRemoveAll,
|
||||||
|
"Remove all breapoints" );
|
||||||
|
|
||||||
python::class_<intBase>( "intBase", "intBase", python::no_init )
|
python::class_<intBase>( "intBase", "intBase", python::no_init )
|
||||||
.def( python::init<python::object&>() )
|
.def( python::init<python::object&>() )
|
||||||
|
@ -829,6 +829,46 @@ ULONG breakPointSet( ULONG64 offset, bool hardware, ULONG size, ULONG accessType
|
|||||||
return breakId;
|
return breakId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void breakPointRemove( ULONG id )
|
||||||
|
{
|
||||||
|
PyThread_StateRestore pyThreadRestore( g_dbgEng->pystate );
|
||||||
|
|
||||||
|
IDebugBreakpoint *bp;
|
||||||
|
HRESULT hres = g_dbgEng->control->GetBreakpointById(id, &bp);
|
||||||
|
if (S_OK != hres)
|
||||||
|
throw DbgException("IDebugControl::GetBreakpointById", hres);
|
||||||
|
|
||||||
|
hres = g_dbgEng->control->RemoveBreakpoint(bp);
|
||||||
|
if (S_OK != hres)
|
||||||
|
throw DbgException("IDebugControl::RemoveBreakpoint", hres);
|
||||||
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void breakPointRemoveAll()
|
||||||
|
{
|
||||||
|
ULONG numberOfBps;
|
||||||
|
do {
|
||||||
|
HRESULT hres = g_dbgEng->control->GetNumberBreakpoints(&numberOfBps);
|
||||||
|
if (S_OK != hres)
|
||||||
|
throw DbgException("IDebugControl::GetNumberBreakpoints", hres);
|
||||||
|
|
||||||
|
if (!numberOfBps)
|
||||||
|
break;
|
||||||
|
|
||||||
|
IDebugBreakpoint *bp;
|
||||||
|
hres = g_dbgEng->control->GetBreakpointByIndex(0, &bp);
|
||||||
|
if (S_OK != hres)
|
||||||
|
throw DbgException("IDebugControl::GetBreakpointByIndex", hres);
|
||||||
|
|
||||||
|
hres = g_dbgEng->control->RemoveBreakpoint(bp);
|
||||||
|
if (S_OK != hres)
|
||||||
|
throw DbgException("IDebugControl::RemoveBreakpoint", hres);
|
||||||
|
|
||||||
|
} while (numberOfBps);
|
||||||
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user