[0.3.x] added : dbgCommand routine

git-svn-id: https://pykd.svn.codeplex.com/svn@84232 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
SND\kernelnet_cp 2013-07-09 15:04:03 +00:00 committed by Mikhail I. Izmestev
parent 6d0bb6e9ab
commit 49e4558428
3 changed files with 33 additions and 4 deletions

View File

@ -107,6 +107,32 @@ void loadDump( const std::wstring &fileName )
///////////////////////////////////////////////////////////////////////////////
std::wstring debugCommand( const std::wstring &command )
{
PyThreadState* state = PyEval_SaveThread();
std::wstring outstr = kdlib::debugCommand(command);
PyEval_RestoreThread( state );
return outstr;
}
///////////////////////////////////////////////////////////////////////////////
unsigned long long evaluate( const std::wstring &expression )
{
PyThreadState* state = PyEval_SaveThread();
unsigned long long result = kdlib::evaluate(expression);
PyEval_RestoreThread( state );
return result;
}
///////////////////////////////////////////////////////////////////////////////
python::tuple getSourceLine( kdlib::MEMOFFSET_64 offset )
{
std::wstring fileName;

View File

@ -18,6 +18,9 @@ kdlib::PROCESS_DEBUG_ID startProcess( const std::wstring &processName );
kdlib::PROCESS_DEBUG_ID attachProcess( kdlib::PROCESS_ID pid );
void loadDump( const std::wstring &fileName );
std::wstring debugCommand( const std::wstring &command );
unsigned long long evaluate( const std::wstring &expression );
python::tuple getSourceLine( kdlib::MEMOFFSET_64 offset = 0 );
python::tuple findSymbolAndDisp( ULONG64 offset );

View File

@ -104,10 +104,10 @@ BOOST_PYTHON_MODULE( pykd )
python::def( "breakin", &targetBreak,
"Break into debugger" );
//python::def( "expr", &evaluate,
// "Evaluate windbg expression" );
//python::def( "dbgCommand", &debugCommand,
// "Run a debugger's command and return it's result as a string" );
python::def( "expr", &evaluate,
"Evaluate windbg expression" );
python::def( "dbgCommand", &debugCommand,
"Run a debugger's command and return it's result as a string" );
python::def( "go", &targetGo,
"Go debugging" );
python::def( "step", &targetStep,