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

[pykd] added: typeException, memoryException and their translation into python git-svn-id: https://pykd.svn.codeplex.com/svn@65714 9b283d60-5439-405e-af05-b73fd8c4d996
88 lines
2.1 KiB
C++
88 lines
2.1 KiB
C++
#pragma once
|
|
|
|
#include <string>
|
|
#include <map>
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
std::string
|
|
dbgCommand( const std::string &command );
|
|
|
|
template <ULONG status>
|
|
bool
|
|
setExecutionStatus()
|
|
{
|
|
HRESULT hres;
|
|
|
|
try {
|
|
|
|
hres = dbgExt->control->SetExecutionStatus( status );
|
|
|
|
if ( FAILED( hres ) )
|
|
return false;
|
|
|
|
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 );
|
|
|
|
return true;
|
|
|
|
}
|
|
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" );
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
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 );
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|