mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-21 04:13:22 +08:00

[+] Breakpoint debug event [+] Exception debug event [+] watchDog.py - demo for debugEvent::onException and WaitEventException git-svn-id: https://pykd.svn.codeplex.com/svn@69518 9b283d60-5439-405e-af05-b73fd8c4d996
86 lines
1.9 KiB
C++
86 lines
1.9 KiB
C++
#pragma once
|
|
|
|
#include <string>
|
|
#include <map>
|
|
#include "pyaux.h"
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
std::string
|
|
dbgCommand( const std::string &command );
|
|
|
|
template <ULONG status>
|
|
void
|
|
setExecutionStatus()
|
|
{
|
|
HRESULT hres;
|
|
|
|
hres = dbgExt->control->SetExecutionStatus( status );
|
|
|
|
if ( FAILED( hres ) )
|
|
throw DbgException( "IDebugControl::SetExecutionStatus failed" );
|
|
|
|
ULONG currentStatus;
|
|
|
|
do {
|
|
|
|
{
|
|
PyThread_StateRestore pyThreadRestore;
|
|
hres = dbgExt->control->WaitForEvent( 0, INFINITE );
|
|
}
|
|
|
|
if ( FAILED( hres ) )
|
|
{
|
|
if (E_UNEXPECTED == hres)
|
|
throw WaitEventException();
|
|
|
|
throw DbgException( "IDebugControl::WaitForEvent failed" );
|
|
}
|
|
|
|
hres = dbgExt->control->GetExecutionStatus( ¤tStatus );
|
|
|
|
if ( FAILED( hres ) )
|
|
throw DbgException( "IDebugControl::GetExecutionStatus failed" );
|
|
|
|
} while( currentStatus != DEBUG_STATUS_BREAK && currentStatus != DEBUG_STATUS_NO_DEBUGGEE );
|
|
|
|
}
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
class dbgExtensionClass {
|
|
|
|
public:
|
|
|
|
dbgExtensionClass() :
|
|
m_handle( NULL )
|
|
{}
|
|
|
|
dbgExtensionClass( const char* path );
|
|
|
|
~dbgExtensionClass();
|
|
|
|
std::string
|
|
call( const std::string &command, const std::string param );
|
|
|
|
std::string
|
|
print() const;
|
|
|
|
private:
|
|
|
|
ULONG64 m_handle;
|
|
std::string m_path;
|
|
};
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
ULONG64
|
|
evaluate( const std::string &expression );
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
void
|
|
breakin();
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|