mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-21 04:13:22 +08:00
[0.1.x] added : breakin routine
git-svn-id: https://pykd.svn.codeplex.com/svn@71390 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
parent
fff5521dc0
commit
6d33eb5286
@ -44,6 +44,8 @@ public:
|
|||||||
|
|
||||||
ULONG64 addr64( ULONG64 addr );
|
ULONG64 addr64( ULONG64 addr );
|
||||||
|
|
||||||
|
void breakin();
|
||||||
|
|
||||||
DbgOut dout() {
|
DbgOut dout() {
|
||||||
return DbgOut( m_client );
|
return DbgOut( m_client );
|
||||||
}
|
}
|
||||||
|
166
pykd/dbgcmd.cpp
166
pykd/dbgcmd.cpp
@ -132,149 +132,25 @@ evaluate( const std::wstring &expression )
|
|||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void DebugClient::breakin()
|
||||||
|
{
|
||||||
|
HRESULT hres;
|
||||||
|
|
||||||
|
PyThreadState *pystate = PyEval_SaveThread();
|
||||||
|
|
||||||
|
hres = m_control->SetInterrupt( DEBUG_INTERRUPT_ACTIVE );
|
||||||
|
|
||||||
|
PyEval_RestoreThread( pystate );
|
||||||
|
|
||||||
|
if ( FAILED( hres ) )
|
||||||
|
throw DbgException( "IDebugControl::SetInterrupt" );
|
||||||
|
}
|
||||||
|
|
||||||
|
void breakin()
|
||||||
|
{
|
||||||
|
g_dbgClient->breakin();
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
} // end namespace pykd
|
} // end namespace pykd
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//#include <boost/format.hpp>
|
|
||||||
//
|
|
||||||
//#include "dbgext.h"
|
|
||||||
//#include "dbgcmd.h"
|
|
||||||
//#include "dbgexcept.h"
|
|
||||||
//#include "dbgio.h"
|
|
||||||
//#include "dbgsystem.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
//std::string
|
|
||||||
//dbgCommand( const std::wstring &command )
|
|
||||||
//{
|
|
||||||
// HRESULT hres;
|
|
||||||
//
|
|
||||||
// OutputReader outReader( dbgExt->client );
|
|
||||||
// {
|
|
||||||
// PyThread_StateRestore pyThreadRestore;
|
|
||||||
//
|
|
||||||
// hres = dbgExt->control4->ExecuteWide( DEBUG_OUTCTL_THIS_CLIENT, command.c_str(), 0 );
|
|
||||||
// }
|
|
||||||
// if ( FAILED( hres ) )
|
|
||||||
// throw DbgException( "IDebugControl::Execute failed" );
|
|
||||||
//
|
|
||||||
// return std::string( outReader.Line() );
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
//dbgExtensionClass::dbgExtensionClass( const char* path ) : m_path(path)
|
|
||||||
//{
|
|
||||||
// HRESULT hres;
|
|
||||||
//
|
|
||||||
// hres = dbgExt->control->AddExtension( path, 0, &m_handle );
|
|
||||||
// if ( FAILED( hres ) )
|
|
||||||
// throw DbgException( "IDebugControl::AddExtension failed" );
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
//dbgExtensionClass::~dbgExtensionClass()
|
|
||||||
//{
|
|
||||||
// if ( m_handle )
|
|
||||||
// dbgExt->control->RemoveExtension( m_handle );
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
//std::string
|
|
||||||
//dbgExtensionClass::call( const std::string &command, const std::string params )
|
|
||||||
//{
|
|
||||||
// HRESULT hres;
|
|
||||||
//
|
|
||||||
// OutputReader outReader( dbgExt->client );
|
|
||||||
//
|
|
||||||
// hres = dbgExt->control->CallExtension( m_handle, command.c_str(), params.c_str() );
|
|
||||||
// if ( FAILED( hres ) )
|
|
||||||
// throw DbgException( "IDebugControl::CallExtension failed" );
|
|
||||||
//
|
|
||||||
// return std::string( outReader.Line() );
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
//std::string
|
|
||||||
//dbgExtensionClass::print() const
|
|
||||||
//{
|
|
||||||
// return m_handle ? m_path : "";
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
//ULONG64
|
|
||||||
//evaluate( const std::string &expression )
|
|
||||||
//{
|
|
||||||
// HRESULT hres;
|
|
||||||
// ULONG64 value = 0;
|
|
||||||
//
|
|
||||||
// DEBUG_VALUE debugValue = {};
|
|
||||||
// ULONG remainderIndex = 0;
|
|
||||||
//
|
|
||||||
// if ( is64bitSystem() )
|
|
||||||
// {
|
|
||||||
// hres = dbgExt->control->Evaluate(
|
|
||||||
// expression.c_str(),
|
|
||||||
// DEBUG_VALUE_INT64,
|
|
||||||
// &debugValue,
|
|
||||||
// &remainderIndex );
|
|
||||||
//
|
|
||||||
// if ( FAILED( hres ) )
|
|
||||||
// throw DbgException( "IDebugControl::Evaluate failed" );
|
|
||||||
//
|
|
||||||
// if ( remainderIndex == expression.length() )
|
|
||||||
// value = debugValue.I64;
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// hres = dbgExt->control->Evaluate(
|
|
||||||
// expression.c_str(),
|
|
||||||
// DEBUG_VALUE_INT32,
|
|
||||||
// &debugValue,
|
|
||||||
// &remainderIndex );
|
|
||||||
//
|
|
||||||
// if ( FAILED( hres ) )
|
|
||||||
// throw DbgException( "IDebugControl::Evaluate failed" );
|
|
||||||
//
|
|
||||||
// if ( remainderIndex == expression.length() )
|
|
||||||
// value = debugValue.I32;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// return value;
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
//void
|
|
||||||
//breakin()
|
|
||||||
//{
|
|
||||||
// HRESULT hres;
|
|
||||||
//
|
|
||||||
// {
|
|
||||||
// PyThread_StateRestore pyThreadRestore;
|
|
||||||
// hres = dbgExt->control->SetInterrupt( DEBUG_INTERRUPT_ACTIVE );
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if ( FAILED( hres ) )
|
|
||||||
// throw DbgException( "IDebugControl::SetInterrupt" );
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////
|
|
@ -166,13 +166,17 @@ BOOST_PYTHON_MODULE( pykd )
|
|||||||
.def( "__hex__", &intBase::hex );
|
.def( "__hex__", &intBase::hex );
|
||||||
|
|
||||||
python::class_<pykd::DebugClient, pykd::DebugClientPtr>("dbgClient", "Class representing a debugging session", python::no_init )
|
python::class_<pykd::DebugClient, pykd::DebugClientPtr>("dbgClient", "Class representing a debugging session", python::no_init )
|
||||||
.def( "loadDump", &pykd::DebugClient::loadDump,
|
.def( "addr64", &DebugClient::addr64,
|
||||||
|
"Extend address to 64 bits formats" )
|
||||||
|
.def( "breakin", &DebugClient::breakin,
|
||||||
|
"Break into debugger" )
|
||||||
|
.def( "loadDump", &DebugClient::loadDump,
|
||||||
"Load crash dump" )
|
"Load crash dump" )
|
||||||
.def( "startProcess", &pykd::DebugClient::startProcess,
|
.def( "startProcess", &DebugClient::startProcess,
|
||||||
"Start process for debugging" )
|
"Start process for debugging" )
|
||||||
.def( "attachProcess", &pykd::DebugClient::attachProcess,
|
.def( "attachProcess", &DebugClient::attachProcess,
|
||||||
"Attach debugger to a exsisting process" )
|
"Attach debugger to a exsisting process" )
|
||||||
.def( "attachKernel", &pykd::DebugClient::attachKernel,
|
.def( "attachKernel", &DebugClient::attachKernel,
|
||||||
"Attach debugger to a target's kernel" )
|
"Attach debugger to a target's kernel" )
|
||||||
.def( "expr", &pykd::DebugClient::evaluate,
|
.def( "expr", &pykd::DebugClient::evaluate,
|
||||||
"Evaluate windbg expression" )
|
"Evaluate windbg expression" )
|
||||||
@ -251,6 +255,10 @@ BOOST_PYTHON_MODULE( pykd )
|
|||||||
.def( "waitForEvent", &pykd::DebugClient::waitForEvent,
|
.def( "waitForEvent", &pykd::DebugClient::waitForEvent,
|
||||||
"Wait for events that breaks into the debugger" );
|
"Wait for events that breaks into the debugger" );
|
||||||
|
|
||||||
|
python::def( "addr64", &addr64,
|
||||||
|
"Extend address to 64 bits formats" );
|
||||||
|
python::def( "breakin", &breakin,
|
||||||
|
"Break into debugger" );
|
||||||
python::def( "createDbgClient", (DebugClientPtr(*)())&pykd::DebugClient::createDbgClient,
|
python::def( "createDbgClient", (DebugClientPtr(*)())&pykd::DebugClient::createDbgClient,
|
||||||
"create a new instance of the dbgClient class" );
|
"create a new instance of the dbgClient class" );
|
||||||
python::def( "loadDump", &pykd::loadDump,
|
python::def( "loadDump", &pykd::loadDump,
|
||||||
|
Loading…
Reference in New Issue
Block a user