From ee60976466758f98a7c749dbb2794cff9cb3a054 Mon Sep 17 00:00:00 2001 From: "SND\\kernelnet_cp" Date: Mon, 10 Oct 2011 14:06:57 +0000 Subject: [PATCH] [0.0 -> 0.1 ] integrated dbgcmd.h git-svn-id: https://pykd.svn.codeplex.com/svn@70292 9b283d60-5439-405e-af05-b73fd8c4d996 --- pykd/dbgcmd.h | 86 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 pykd/dbgcmd.h diff --git a/pykd/dbgcmd.h b/pykd/dbgcmd.h new file mode 100644 index 0000000..9b361e9 --- /dev/null +++ b/pykd/dbgcmd.h @@ -0,0 +1,86 @@ +#pragma once + +#include +#include +#include "pyaux.h" + +///////////////////////////////////////////////////////////////////////////////// + +std::string +dbgCommand( const std::wstring &command ); + +template +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(); + +///////////////////////////////////////////////////////////////////////////////// \ No newline at end of file