mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-21 04:13:22 +08:00
[0.2.x] added : step, trace routines
git-svn-id: https://pykd.svn.codeplex.com/svn@78896 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
parent
6b09a73cc6
commit
8a41abcd13
@ -16,6 +16,8 @@ bool isDumpAnalyzing();
|
|||||||
bool isKernelDebugging();
|
bool isKernelDebugging();
|
||||||
|
|
||||||
void debugGo();
|
void debugGo();
|
||||||
|
void debugStep();
|
||||||
|
void debugStepIn();
|
||||||
void debugBreak();
|
void debugBreak();
|
||||||
ULONG64 evaluate( const std::wstring &expression );
|
ULONG64 evaluate( const std::wstring &expression );
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include "localvar.h"
|
#include "localvar.h"
|
||||||
|
|
||||||
#include "win/dbgio.h"
|
#include "win/dbgio.h"
|
||||||
|
#include "win/windbg.h"
|
||||||
|
|
||||||
using namespace pykd;
|
using namespace pykd;
|
||||||
|
|
||||||
@ -72,6 +73,8 @@ BOOST_PYTHON_MODULE( pykd )
|
|||||||
"Check if it is a dump analyzing ( not living debuggee )" );
|
"Check if it is a dump analyzing ( not living debuggee )" );
|
||||||
python::def( "isKernelDebugging", &isKernelDebugging,
|
python::def( "isKernelDebugging", &isKernelDebugging,
|
||||||
"Check if kernel dubugging is running" );
|
"Check if kernel dubugging is running" );
|
||||||
|
python::def( "isWindbgExt", &WindbgGlobalSession::isInit,
|
||||||
|
"Check if script works in windbg context" );
|
||||||
|
|
||||||
python::def( "breakin", &debugBreak,
|
python::def( "breakin", &debugBreak,
|
||||||
"Break into debugger" );
|
"Break into debugger" );
|
||||||
@ -79,6 +82,10 @@ BOOST_PYTHON_MODULE( pykd )
|
|||||||
"Evaluate windbg expression" );
|
"Evaluate windbg expression" );
|
||||||
python::def( "go", &debugGo,
|
python::def( "go", &debugGo,
|
||||||
"Go debugging" );
|
"Go debugging" );
|
||||||
|
python::def( "step", &debugStep,
|
||||||
|
"The target is executing a single instruction or--if that instruction is a subroutine call--subroutine" );
|
||||||
|
python::def( "trace", &debugStepIn,
|
||||||
|
"The target is executing a single instruction" );
|
||||||
|
|
||||||
// Debug output
|
// Debug output
|
||||||
python::def( "dprint", &pykd::dprint, dprint_( boost::python::args( "str", "dml" ),
|
python::def( "dprint", &pykd::dprint, dprint_( boost::python::args( "str", "dml" ),
|
||||||
|
@ -170,6 +170,62 @@ void debugGo()
|
|||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void debugStep()
|
||||||
|
{
|
||||||
|
PyThread_StateRestore pyThreadRestore( g_dbgEng->pystate );
|
||||||
|
|
||||||
|
HRESULT hres;
|
||||||
|
|
||||||
|
hres = g_dbgEng->control->SetExecutionStatus( DEBUG_STATUS_STEP_OVER );
|
||||||
|
|
||||||
|
if ( FAILED( hres ) )
|
||||||
|
throw DbgException( "IDebugControl::SetExecutionStatus failed" );
|
||||||
|
|
||||||
|
ULONG currentStatus;
|
||||||
|
|
||||||
|
do {
|
||||||
|
hres = g_dbgEng->control->WaitForEvent(DEBUG_WAIT_DEFAULT, INFINITE);
|
||||||
|
if ( FAILED( hres ) )
|
||||||
|
throw DbgException( "IDebugControl::WaitForEvent failed" );
|
||||||
|
|
||||||
|
hres = g_dbgEng->control->GetExecutionStatus( ¤tStatus );
|
||||||
|
|
||||||
|
if ( FAILED( hres ) )
|
||||||
|
throw DbgException( "IDebugControl::GetExecutionStatus failed" );
|
||||||
|
|
||||||
|
} while( currentStatus != DEBUG_STATUS_BREAK && currentStatus != DEBUG_STATUS_NO_DEBUGGEE );
|
||||||
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void debugStepIn()
|
||||||
|
{
|
||||||
|
PyThread_StateRestore pyThreadRestore( g_dbgEng->pystate );
|
||||||
|
|
||||||
|
HRESULT hres;
|
||||||
|
|
||||||
|
hres = g_dbgEng->control->SetExecutionStatus( DEBUG_STATUS_STEP_INTO );
|
||||||
|
|
||||||
|
if ( FAILED( hres ) )
|
||||||
|
throw DbgException( "IDebugControl::SetExecutionStatus failed" );
|
||||||
|
|
||||||
|
ULONG currentStatus;
|
||||||
|
|
||||||
|
do {
|
||||||
|
hres = g_dbgEng->control->WaitForEvent(DEBUG_WAIT_DEFAULT, INFINITE);
|
||||||
|
if ( FAILED( hres ) )
|
||||||
|
throw DbgException( "IDebugControl::WaitForEvent failed" );
|
||||||
|
|
||||||
|
hres = g_dbgEng->control->GetExecutionStatus( ¤tStatus );
|
||||||
|
|
||||||
|
if ( FAILED( hres ) )
|
||||||
|
throw DbgException( "IDebugControl::GetExecutionStatus failed" );
|
||||||
|
|
||||||
|
} while( currentStatus != DEBUG_STATUS_BREAK && currentStatus != DEBUG_STATUS_NO_DEBUGGEE );
|
||||||
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void debugBreak()
|
void debugBreak()
|
||||||
{
|
{
|
||||||
PyThreadState *pystate = PyEval_SaveThread();
|
PyThreadState *pystate = PyEval_SaveThread();
|
||||||
|
Loading…
Reference in New Issue
Block a user