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

[+] Added dbgExtensionClass::print() [+] Added dbgBreakpointClass::print() [+] Added dbgStackFrameClass::print() git-svn-id: https://pykd.svn.codeplex.com/svn@61914 9b283d60-5439-405e-af05-b73fd8c4d996
113 lines
2.5 KiB
C++
113 lines
2.5 KiB
C++
#pragma once
|
|
|
|
#include <string>
|
|
|
|
#include <boost/python.hpp>
|
|
#include <boost/python/object.hpp>
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
std::string
|
|
dbgCommand( const std::string &command );
|
|
|
|
template <ULONG status>
|
|
void
|
|
setExecutionStatus()
|
|
{
|
|
HRESULT hres;
|
|
|
|
try {
|
|
|
|
hres = dbgExt->control->SetExecutionStatus( status );
|
|
|
|
if ( FAILED( hres ) )
|
|
throw DbgException( "IDebugControl::SetExecutionStatus failed" );
|
|
|
|
ULONG currentStatus;
|
|
|
|
do {
|
|
|
|
hres = dbgExt->control->WaitForEvent( 0, INFINITE );
|
|
|
|
if ( FAILED( hres ) )
|
|
throw DbgException( "IDebugControl::SetExecutionStatus failed" );
|
|
|
|
hres = dbgExt->control->GetExecutionStatus( ¤tStatus );
|
|
|
|
if ( FAILED( hres ) )
|
|
throw DbgException( "IDebugControl::GetExecutionStatus failed" );
|
|
|
|
|
|
} while( currentStatus != DEBUG_STATUS_BREAK && currentStatus != DEBUG_STATUS_NO_DEBUGGEE );
|
|
|
|
}
|
|
catch( std::exception &e )
|
|
{
|
|
dbgExt->control->Output( DEBUG_OUTPUT_ERROR, "pykd error: %s\n", e.what() );
|
|
}
|
|
catch(...)
|
|
{
|
|
dbgExt->control->Output( DEBUG_OUTPUT_ERROR, "pykd unexpected error\n" );
|
|
}
|
|
}
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
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;
|
|
};
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
class dbgBreakpointClass {
|
|
|
|
public:
|
|
|
|
dbgBreakpointClass( ULONG64 offset );
|
|
|
|
~dbgBreakpointClass();
|
|
|
|
bool
|
|
set();
|
|
|
|
void
|
|
remove();
|
|
|
|
std::string
|
|
print() const;
|
|
|
|
private:
|
|
|
|
ULONG64 m_offset;
|
|
|
|
IDebugBreakpoint *m_breakpoint;
|
|
|
|
};
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
ULONG64
|
|
evaluate( const std::string &expression );
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|