From 7fb30a991280e6d7d9634714327d89010fa70eeb Mon Sep 17 00:00:00 2001 From: "SND\\kernelnet_cp" Date: Mon, 3 Oct 2011 06:44:07 +0000 Subject: [PATCH] [0.1.x] removed : all not refactored files. git-svn-id: https://pykd.svn.codeplex.com/svn@70174 9b283d60-5439-405e-af05-b73fd8c4d996 --- pykd/dbgbreak.cpp | 162 ------ pykd/dbgbreak.h | 46 -- pykd/dbgcmd.cpp | 132 ----- pykd/dbgcmd.h | 86 ---- pykd/dbgdump.cpp | 101 ---- pykd/dbgdump.h | 19 - pykd/dbgevent.cpp | 217 -------- pykd/dbgevent.h | 132 ----- pykd/dbgeventcb.cpp | 153 ------ pykd/dbgeventcb.h | 64 --- pykd/dbgext.h | 43 -- pykd/dbgio.cpp | 34 -- pykd/dbgio.h | 224 --------- pykd/dbgpath.cpp | 148 ------ pykd/dbgpath.h | 32 -- pykd/dbgprocess.cpp | 289 ----------- pykd/dbgprocess.h | 54 -- pykd/dbgreg.cpp | 162 ------ pykd/dbgreg.h | 61 --- pykd/dbgsym.cpp | 78 --- pykd/dbgsym.h | 13 - pykd/dbgsynsym.cpp | 651 ------------------------ pykd/dbgsynsym.h | 56 --- pykd/dbgsystem.cpp | 210 -------- pykd/dbgsystem.h | 31 -- pykd/dbgtype.cpp | 1113 ----------------------------------------- pykd/dbgtype.h | 295 ----------- pykd/disasm.cpp | 49 -- pykd/disasm.h | 54 -- pykd/pyaux.h | 57 --- pykd/pykd_2008.vcproj | 4 + 31 files changed, 4 insertions(+), 4766 deletions(-) delete mode 100644 pykd/dbgbreak.cpp delete mode 100644 pykd/dbgbreak.h delete mode 100644 pykd/dbgcmd.cpp delete mode 100644 pykd/dbgcmd.h delete mode 100644 pykd/dbgdump.cpp delete mode 100644 pykd/dbgdump.h delete mode 100644 pykd/dbgevent.cpp delete mode 100644 pykd/dbgevent.h delete mode 100644 pykd/dbgeventcb.cpp delete mode 100644 pykd/dbgeventcb.h delete mode 100644 pykd/dbgext.h delete mode 100644 pykd/dbgio.cpp delete mode 100644 pykd/dbgio.h delete mode 100644 pykd/dbgpath.cpp delete mode 100644 pykd/dbgpath.h delete mode 100644 pykd/dbgprocess.cpp delete mode 100644 pykd/dbgprocess.h delete mode 100644 pykd/dbgreg.cpp delete mode 100644 pykd/dbgreg.h delete mode 100644 pykd/dbgsym.cpp delete mode 100644 pykd/dbgsym.h delete mode 100644 pykd/dbgsynsym.cpp delete mode 100644 pykd/dbgsynsym.h delete mode 100644 pykd/dbgsystem.cpp delete mode 100644 pykd/dbgsystem.h delete mode 100644 pykd/dbgtype.cpp delete mode 100644 pykd/dbgtype.h delete mode 100644 pykd/disasm.cpp delete mode 100644 pykd/disasm.h delete mode 100644 pykd/pyaux.h diff --git a/pykd/dbgbreak.cpp b/pykd/dbgbreak.cpp deleted file mode 100644 index 8657962..0000000 --- a/pykd/dbgbreak.cpp +++ /dev/null @@ -1,162 +0,0 @@ -#include "stdafx.h" - -//#include -// -//#include "dbgbreak.h" -//#include "dbgexcept.h" -//#include "pyaux.h" -// -///////////////////////////////////////////////////////////////////////////////// -// -//dbgBreakpointClass::breakpointMap dbgBreakpointClass::m_breakMap; -// -///////////////////////////////////////////////////////////////////////////////// -// -//HRESULT dbgBreakpointClass::onBreakpointEvnet( IDebugBreakpoint* bp ) -//{ -// PyThread_StateSave pyThreadSave; -// -// try { -// -// breakpointMap::iterator it = m_breakMap.find( bp ); -// if ( it != m_breakMap.end() ) -// { -// boost::python::object &callback = it->second->m_callback; -// if (!callback.is_none()) -// return boost::python::extract( callback() ); -// -// return DEBUG_STATUS_BREAK; -// } -// -// } -// catch(...) -// { -// } -// -// return DEBUG_STATUS_NO_CHANGE; -//} -// -///////////////////////////////////////////////////////////////////////////////// -// -//dbgBreakpointClass::dbgBreakpointClass( ULONG64 offset, boost::python::object &callback ) -// : m_offset(offset) -// , m_callback(callback) -// , m_breakpoint(NULL) -//{ -// set(); -//} -// -///////////////////////////////////////////////////////////////////////////////// -// -//dbgBreakpointClass::dbgBreakpointClass( ULONG64 offset) -// : m_offset(offset) -// , m_breakpoint(NULL) -//{ -// // m_callback is None, see dbgBreakpointClass::onBreakpointEvnet -// set(); -//} -// -///////////////////////////////////////////////////////////////////////////////// -// -//dbgBreakpointClass::~dbgBreakpointClass() -//{ -// remove(); -//} -// -///////////////////////////////////////////////////////////////////////////////// -// -//bool -//dbgBreakpointClass::set() -//{ -// HRESULT hres; -// -// try { -// -// if ( m_breakpoint ) -// return true; -// -// hres = dbgExt->control->AddBreakpoint( DEBUG_BREAKPOINT_CODE, DEBUG_ANY_ID, &m_breakpoint ); -// if ( FAILED( hres ) ) -// throw DbgException( "IDebugControl::AddBreakpoint failed" ); -// -// hres = m_breakpoint->SetOffset( m_offset ); -// if ( FAILED( hres ) ) -// throw DbgException( "IDebugBreakpoint::SetOffset failed" ); -// -// hres = m_breakpoint->SetFlags( DEBUG_BREAKPOINT_ENABLED ); -// if ( FAILED( hres ) ) -// throw DbgException( "IDebugBreakpoint::SetFlags failed" ); -// -// m_breakMap.insert( std::make_pair( m_breakpoint, this ) ); -// -// 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" ); -// } -// -// remove(); -// -// return false; -//} -// -///////////////////////////////////////////////////////////////////////////////// -// -//void -//dbgBreakpointClass::remove() -//{ -// if ( m_breakpoint ) -// { -// dbgExt->control->RemoveBreakpoint( m_breakpoint ); -// -// breakpointMap::iterator bp = m_breakMap.find( m_breakpoint ); -// if ( bp != m_breakMap.end() ) -// m_breakMap.erase( bp ); -// -// m_breakpoint = NULL; -// } -//} -// -///////////////////////////////////////////////////////////////////////////////// -// -//std::string -//dbgBreakpointClass::print() const -//{ -// HRESULT status = S_OK; -// -// try -// { -// if (!m_breakpoint) -// return "not set"; -// -// DEBUG_BREAKPOINT_PARAMETERS params; -// status = m_breakpoint->GetParameters(¶ms); -// if (FAILED(status)) -// throw DbgException("IDebugBreakpoint::GetParameters failed"); -// -// boost::format fmt("%1$2d %2%%3% %4%:*** "); -// fmt % params.Id -// % (params.Flags & DEBUG_BREAKPOINT_ENABLED ? 'e' : 'd') -// % 'u' -// % params.CurrentPassCount; -// -// return fmt.str(); -// } -// 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 ""; -//} -// -///////////////////////////////////////////////////////////////////////////////// \ No newline at end of file diff --git a/pykd/dbgbreak.h b/pykd/dbgbreak.h deleted file mode 100644 index b8f3d0d..0000000 --- a/pykd/dbgbreak.h +++ /dev/null @@ -1,46 +0,0 @@ -#pragma once - -//#include -//#include "dbgext.h" -// -/////////////////////////////////////////////////////////////////////////////////// -// -//class dbgBreakpointClass { -// -//public: -// -// dbgBreakpointClass( ULONG64 offset, boost::python::object &callback ); -// dbgBreakpointClass( ULONG64 offset ); -// -// ~dbgBreakpointClass(); -// -// bool -// set(); -// -// void -// remove(); -// -// std::string -// print() const; -// -//private: -// -// ULONG64 m_offset; -// -// IDebugBreakpoint *m_breakpoint; -// -// boost::python::object m_callback; -// -//private: -// -// typedef std::map breakpointMap; -// static breakpointMap m_breakMap; -// -//public: -// -// static HRESULT onBreakpointEvnet( IDebugBreakpoint* bp ); -// -//}; -// -/////////////////////////////////////////////////////////////////////////////////// - diff --git a/pykd/dbgcmd.cpp b/pykd/dbgcmd.cpp deleted file mode 100644 index 21bd33a..0000000 --- a/pykd/dbgcmd.cpp +++ /dev/null @@ -1,132 +0,0 @@ -#include "stdafx.h" -// -//#include -// -//#include "dbgext.h" -//#include "dbgcmd.h" -//#include "dbgexcept.h" -//#include "dbgio.h" -//#include "dbgsystem.h" -// -///////////////////////////////////////////////////////////////////////////////// -// -//std::string -//dbgCommand( const std::string &command ) -//{ -// HRESULT hres; -// -// OutputReader outReader( dbgExt->client ); -// { -// PyThread_StateRestore pyThreadRestore; -// -// hres = dbgExt->control->Execute( 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" ); -//} -// -///////////////////////////////////////////////////////////////////////////////// \ No newline at end of file diff --git a/pykd/dbgcmd.h b/pykd/dbgcmd.h deleted file mode 100644 index 021ff6c..0000000 --- a/pykd/dbgcmd.h +++ /dev/null @@ -1,86 +0,0 @@ -#pragma once - -//#include -//#include -//#include "pyaux.h" -// -/////////////////////////////////////////////////////////////////////////////////// -// -//std::string -//dbgCommand( const std::string &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 diff --git a/pykd/dbgdump.cpp b/pykd/dbgdump.cpp deleted file mode 100644 index 6b15fd2..0000000 --- a/pykd/dbgdump.cpp +++ /dev/null @@ -1,101 +0,0 @@ -#include "stdafx.h" - -//#include "dbgext.h" -//#include "dbgdump.h" -//#include "dbgexcept.h" -//#include "dbgeventcb.h" -//#include "dbgsystem.h" -//#include "dbgcmd.h" -//#include "dbgclient.h" -// -/////////////////////////////////////////////////////////////////////////////////// -// -//static -//bool dbgStarted = false; -// -// -/////////////////////////////////////////////////////////////////////////////////// -// -//void -//dbgLoadDump( const std::wstring &fileName ) -//{ -// HRESULT hres; -// -// if ( dbgStarted || isWindbgExt() ) -// throw DbgException( "debugger is alread attached" ); -// -// g_dbgClient.startEventsMgr(); -// -// hres = dbgExt->client4->OpenDumpFileWide( fileName.c_str(), NULL ); -// -// if ( FAILED( hres ) ) -// throw DbgException( "IDebugClient4::OpenDumpFileWide failed" ); -// -// hres = dbgExt->control->WaitForEvent(DEBUG_WAIT_DEFAULT, INFINITE); -// if ( FAILED( hres ) ) -// throw DbgException( "IDebugControl::WaitForEvent failed" ); -// -// dbgStarted = true; -//} -// -/////////////////////////////////////////////////////////////////////////////////// -// -//void -//startProcess( const std::wstring &processName ) -//{ -// HRESULT hres; -// -// if ( dbgStarted || isWindbgExt() ) -// throw DbgException( "debugger is alread attached" ); -// -// g_dbgClient.startEventsMgr(); -// -// ULONG opt; -// hres = dbgExt->control->GetEngineOptions( &opt ); -// if ( FAILED( hres ) ) -// throw DbgException( "IDebugControl::GetEngineOptions failed" ); -// -// opt |= DEBUG_ENGOPT_INITIAL_BREAK; -// hres = dbgExt->control->SetEngineOptions( opt ); -// if ( FAILED( hres ) ) -// throw DbgException( "IDebugControl::SetEngineOptions failed" ); -// -// std::vector< std::wstring::value_type> cmdLine( processName.size() + 1 ); -// wcscpy_s( &cmdLine[0], cmdLine.size(), processName.c_str() ); -// -// hres = dbgExt->client4->CreateProcessWide( 0, &cmdLine[0], DEBUG_PROCESS | DETACHED_PROCESS ); -// if ( FAILED( hres ) ) -// throw DbgException( "IDebugClient4::CreateProcessWide failed" ); -// -// hres = dbgExt->control->WaitForEvent(DEBUG_WAIT_DEFAULT, INFINITE); -// if ( FAILED( hres ) ) -// throw DbgException( "IDebugControl::WaitForEvent failed" ); -// -// dbgStarted = true; -//} -// -/////////////////////////////////////////////////////////////////////////////////// -// -//void -//attachProcess( ULONG processId ) -//{ -// HRESULT hres; -// -// hres = dbgExt->client->AttachProcess( 0, processId, 0 ); -// if ( FAILED( hres ) ) -// throw DbgException( "IDebugClient::AttachProcess failed" ); -//} -// -/////////////////////////////////////////////////////////////////////////////////// -// -//void -//attachKernel( const std::wstring param ) -//{ -// HRESULT hres; -// -// hres = dbgExt->client5->AttachKernelWide( DEBUG_ATTACH_KERNEL_CONNECTION, param.c_str() ); -// if ( FAILED( hres ) ) -// throw DbgException( "IDebugClient5::AttachKernelWide failed" ); -//} -// -/////////////////////////////////////////////////////////////////////////////////// \ No newline at end of file diff --git a/pykd/dbgdump.h b/pykd/dbgdump.h deleted file mode 100644 index 793d0d2..0000000 --- a/pykd/dbgdump.h +++ /dev/null @@ -1,19 +0,0 @@ -#pragma once - -//#include -// -/////////////////////////////////////////////////////////////////////////////////// -// -//void -//dbgLoadDump( const std::wstring &dumpName ); -// -//void -//startProcess( const std::wstring &processName ); -// -//void -//attachProcess( ULONG processId ); -// -//void -//attachKernel( const std::wstring param ); -// -/////////////////////////////////////////////////////////////////////////////////// diff --git a/pykd/dbgevent.cpp b/pykd/dbgevent.cpp deleted file mode 100644 index 3125cd4..0000000 --- a/pykd/dbgevent.cpp +++ /dev/null @@ -1,217 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////// -//// Load/Unload module events -/////////////////////////////////////////////////////////////////////////////////// -// -#include "stdafx.h" -//#include "dbgevent.h" -//#include "dbgio.h" -//#include "dbgexcept.h" -//#include "pyaux.h" -// -///////////////////////////////////////////////////////////////////////////////////// -// -//debugEvent::debugEvent() -//{ -// HRESULT hres; -// -// hres = dbgExt->client->CreateClient( &m_debugClient ); -// if ( FAILED( hres ) ) -// throw DbgException( "IDebugClient::CreateClient" ); -// -// hres = m_debugClient->SetEventCallbacks(this); -// if (FAILED(hres)) -// throw DbgException( "IDebugClient::SetEventCallbacks" ); -//} -// -///////////////////////////////////////////////////////////////////////////////////// -// -//debugEvent::~debugEvent() -//{ -// m_debugClient->SetEventCallbacks( NULL ); -// -// m_debugClient->Release(); -//} -// -///////////////////////////////////////////////////////////////////////////////////// -// -//HRESULT debugEvent::GetInterestMask( -// __out PULONG Mask -//) -//{ -// *Mask = 0; -// -// *Mask |= DEBUG_EVENT_LOAD_MODULE; -// *Mask |= DEBUG_EVENT_UNLOAD_MODULE; -// *Mask |= DEBUG_EVENT_SESSION_STATUS; -// *Mask |= DEBUG_EVENT_EXCEPTION; -// *Mask |= DEBUG_EVENT_BREAKPOINT; -// -// return S_OK; -//} -// -///////////////////////////////////////////////////////////////////////////////////// -// -//HRESULT debugEvent::Breakpoint( -// __in PDEBUG_BREAKPOINT Bp -//) -//{ -// boost::python::dict bpParameters; -// -// HRESULT hres; -// ULONG Value = 0; -// ULONG Value2 = 0; -// ULONG64 Value64 = 0; -// std::string str; -// -//#define _ADD_BP_ULONG(x) \ -// hres = Bp->Get##x(&Value); \ -// BOOST_ASSERT( SUCCEEDED( hres ) || hres == E_NOINTERFACE ); \ -// if (SUCCEEDED( hres )) \ -// bpParameters[#x] = Value; -// -//#define _ADD_BP_ULONG2(x, n1, n2) \ -// hres = Bp->Get##x(&Value, &Value2); \ -// BOOST_ASSERT( SUCCEEDED( hres ) || hres == E_NOINTERFACE ); \ -// if (SUCCEEDED( hres )) \ -// { \ -// bpParameters[n1] = Value; bpParameters[n2] = Value2; \ -// } -// -//#define _ADD_BP_ULONG64(x) \ -// hres = Bp->Get##x(&Value64); \ -// BOOST_ASSERT( SUCCEEDED( hres ) || hres == E_NOINTERFACE ); \ -// if (SUCCEEDED( hres )) \ -// bpParameters[#x] = Value64; -// -//#define _ADD_BP_STR(x) \ -// Value = 0; \ -// Bp->Get##x(NULL, 0, &Value); \ -// if (Value) \ -// { \ -// str.resize(Value + 1); \ -// BOOST_VERIFY( SUCCEEDED( \ -// Bp->Get##x(&str[0], (ULONG)str.size(), NULL) \ -// ) ); \ -// if (!str.empty()) bpParameters[#x] = str.c_str(); \ -// } -// -// _ADD_BP_ULONG(Id); -// _ADD_BP_ULONG2(Type, "BreakType", "ProcType"); -// _ADD_BP_ULONG(Flags); -// _ADD_BP_ULONG64(Offset); -// _ADD_BP_ULONG2(DataParameters, "Size", "AccessType"); -// _ADD_BP_ULONG(PassCount); -// _ADD_BP_ULONG(CurrentPassCount); -// _ADD_BP_ULONG(MatchThreadId); -// _ADD_BP_STR(Command); -// _ADD_BP_STR(OffsetExpression); -// -//#undef _ADD_BP_ULONG -//#undef _ADD_BP_ULONG2 -//#undef _ADD_BP_ULONG64 -//#undef _ADD_BP_STR -// -// PyThread_StateSave pyThreadSave; -// return onException(bpParameters); -//} -// -///////////////////////////////////////////////////////////////////////////////////// -// -//HRESULT debugEvent::Exception( -// __in PEXCEPTION_RECORD64 Exception, -// __in ULONG FirstChance -//) -//{ -// boost::python::list exceptParams; -// boost::python::dict exceptData; -// -// // build list of parameters -// for (ULONG i = 0; i < Exception->NumberParameters; ++i) -// exceptParams.append(Exception->ExceptionInformation[i]); -// -// // build dict of exception data -//#define _ADD_EXCEPTION_ENTRY(x) exceptData[#x] = Exception->Exception##x -// _ADD_EXCEPTION_ENTRY(Code); -// _ADD_EXCEPTION_ENTRY(Flags); -// _ADD_EXCEPTION_ENTRY(Record); -// _ADD_EXCEPTION_ENTRY(Address); -//#undef _ADD_EXCEPTION_ENTRY -// -// exceptData["Parameters"] = exceptParams; -// -// exceptData["FirstChance"] = (0 != FirstChance); -// -// PyThread_StateSave pyThreadSave; -// return onException(exceptData); -//} -// -///////////////////////////////////////////////////////////////////////////////////// -// -//HRESULT debugEvent::LoadModule( -// __in ULONG64 ImageFileHandle, -// __in ULONG64 BaseOffset, -// __in ULONG ModuleSize, -// __in PCSTR ModuleName, -// __in PCSTR ImageName, -// __in ULONG CheckSum, -// __in ULONG TimeDateStamp -//) -//{ -// std::auto_ptr silentMode( new OutputReader(dbgExt->client) ); -// -// ULONG64 moduleBase; -// ULONG moduleSize; -// std::string moduleName; -// -// queryModuleParams(BaseOffset, moduleName, moduleBase, moduleSize); -// dbgModuleClass module(moduleName, moduleBase, moduleSize); -// silentMode.reset(); -// -// PyThread_StateSave pyThreadSave; -// return onLoadModule( module ); -//} -// -///////////////////////////////////////////////////////////////////////////////////// -// -//HRESULT debugEvent::UnloadModule( -// __in PCSTR ImageBaseName, -// __in ULONG64 BaseOffset -//) -//{ -// std::auto_ptr silentMode( new OutputReader(dbgExt->client) ); -// -// ULONG64 moduleBase; -// ULONG moduleSize; -// std::string moduleName; -// -// queryModuleParams(BaseOffset, moduleName, moduleBase, moduleSize); -// dbgModuleClass module(moduleName, moduleBase, moduleSize); -// silentMode.reset(); -// -// PyThread_StateSave pyThreadSave; -// return onUnloadModule( module ); -//} -// -///////////////////////////////////////////////////////////////////////////////////// -// -//HRESULT debugEvent::SessionStatus( -// __in ULONG Status -//) -//{ -// PyThread_StateSave pyThreadSave; -// return onChangeSessionStatus( Status ); -//} -// -///////////////////////////////////////////////////////////////////////////////////// -// -//HRESULT debugEvent::ChangeDebuggeeState( -// __in ULONG Flags, -// __in ULONG64 Argument -//) -//{ -// PyThread_StateSave pyThreadSave; -// return onChangeDebugeeState(); -//} -// -///////////////////////////////////////////////////////////////////////////////////// -// diff --git a/pykd/dbgevent.h b/pykd/dbgevent.h deleted file mode 100644 index 084e5bd..0000000 --- a/pykd/dbgevent.h +++ /dev/null @@ -1,132 +0,0 @@ -#pragma once - -/////////////////////////////////////////////////////////////////////////////////// -//// user-customizing debug event handler -/////////////////////////////////////////////////////////////////////////////////// -// -//#include "dbgeventcb.h" -//#include "dbgmodule.h" -//#include "pyaux.h" -// -/////////////////////////////////////////////////////////////////////////////////// -// -//class debugEvent : public DebugBaseEventCallbacks -//{ -//public: -// -// debugEvent(); -// -// virtual ~debugEvent(); -// -// virtual ULONG onBreakpoint(boost::python::dict &/*bpParameters*/) = 0; -// -// virtual ULONG onException(boost::python::dict &/*exceptData*/) = 0; -// -// virtual ULONG onLoadModule(const dbgModuleClass &/* module */) = 0; -// -// virtual ULONG onUnloadModule(const dbgModuleClass &/* module */) = 0; -// -// virtual ULONG onChangeSessionStatus( ULONG status ) = 0; -// -// virtual ULONG onChangeDebugeeState() = 0; -// -//private: -// -// STDMETHOD_(ULONG, AddRef)() { return 1; } -// STDMETHOD_(ULONG, Release)() { return 1; } -// -// STDMETHOD(GetInterestMask)( -// __out PULONG Mask -// ); -// -// STDMETHOD(Breakpoint)( -// __in PDEBUG_BREAKPOINT Bp -// ); -// -// -// STDMETHOD(Exception)( -// __in PEXCEPTION_RECORD64 Exception, -// __in ULONG FirstChance -// ); -// -// STDMETHOD(LoadModule)( -// __in ULONG64 ImageFileHandle, -// __in ULONG64 BaseOffset, -// __in ULONG ModuleSize, -// __in PCSTR ModuleName, -// __in PCSTR ImageName, -// __in ULONG CheckSum, -// __in ULONG TimeDateStamp -// ); -// -// STDMETHOD(UnloadModule)( -// __in PCSTR ImageBaseName, -// __in ULONG64 BaseOffset -// ); -// -// STDMETHOD(SessionStatus)( -// __in ULONG Status -// ); -// -// STDMETHOD(ChangeDebuggeeState)( -// __in ULONG Flags, -// __in ULONG64 Argument ); -// -//private: -// -// IDebugClient *m_debugClient; -//}; -// -/////////////////////////////////////////////////////////////////////////////////// -// -//class debugEventWrap : public boost::python::wrapper, public debugEvent -//{ -// -//public: -// -// ULONG onBreakpoint(boost::python::dict &bpParameters) { -// return handler("onBreakpoint", bpParameters); -// } -// -// ULONG onException(boost::python::dict &exceptData) { -// return handler("onException", exceptData); -// } -// -// ULONG onLoadModule(const dbgModuleClass &module) { -// return handler("onLoadModule", module ); -// } -// -// ULONG onUnloadModule(const dbgModuleClass &module) { -// return handler("onUnloadModule", module ); -// } -// -// ULONG onChangeSessionStatus( ULONG status ) { -// return handler( "onChangeSessionStatus", status ); -// } -// -// ULONG onChangeDebugeeState() { -// return handler( "onChangeDebugeeState" ); -// } -// -//private: -// -// template -// ULONG handler( const char* handlerName, Arg1Type arg1 ) -// { -// if (boost::python::override pythonHandler = get_override( handlerName )) -// return pythonHandler(arg1); -// -// return DEBUG_STATUS_NO_CHANGE; -// } -// -// ULONG handler( const char* handlerName ) -// { -// if (boost::python::override pythonHandler = get_override( handlerName )) -// return pythonHandler(); -// -// return DEBUG_STATUS_NO_CHANGE; -// } -//}; -// -/////////////////////////////////////////////////////////////////////////////////// - diff --git a/pykd/dbgeventcb.cpp b/pykd/dbgeventcb.cpp deleted file mode 100644 index 5f9c769..0000000 --- a/pykd/dbgeventcb.cpp +++ /dev/null @@ -1,153 +0,0 @@ - -#include "stdafx.h" -//#include "dbgeng.h" -//#include "dbgext.h" -//#include "dbgeventcb.h" -//#include "dbgexcept.h" -//#include "dbgmodule.h" -//#include "dbgsynsym.h" -//#include "dbgbreak.h" -//#include "dbgevent.h" -// -///////////////////////////////////////////////////////////////////////////////////// -// -//DbgEventCallbacksManager::DbgEventCallbacksManager( IDebugClient *client ) -//{ -// m_debugClient = client; -// m_debugClient->AddRef(); -// -// HRESULT hres; -// -// hres = m_debugClient->SetEventCallbacks(this); -// if (FAILED(hres)) -// throw DbgException( "IDebugClient::SetEventCallbacks" ); -//} -// -///////////////////////////////////////////////////////////////////////////////////// -// -//DbgEventCallbacksManager::~DbgEventCallbacksManager() -//{ -// if ( m_debugClient ) -// { -// m_debugClient->SetEventCallbacks( NULL ); -// m_debugClient->Release(); -// } -//} -// -// -///////////////////////////////////////////////////////////////////////////////////// -// -//HRESULT DbgEventCallbacksManager::GetInterestMask( -// __out PULONG Mask -//) -//{ -// *Mask = -// DEBUG_EVENT_CHANGE_SYMBOL_STATE | -// DEBUG_EVENT_BREAKPOINT; -//// DEBUG_EVENT_LOAD_MODULE | -//// DEBUG_EVENT_UNLOAD_MODULE -// return S_OK; -//} -// -///////////////////////////////////////////////////////////////////////////////////// -// -//HRESULT DbgEventCallbacksManager::ChangeSymbolState( -// __in ULONG Flags, -// __in ULONG64 Argument -//) -//{ -// if ((DEBUG_CSS_LOADS & Flags)) -// { -// if (Argument) -// { -// DEBUG_MODULE_PARAMETERS dbgModuleParameters; -// HRESULT hres = dbgExt->symbols3->GetModuleParameters( -// 1, -// &Argument, -// 0, -// &dbgModuleParameters); -// -// if (SUCCEEDED(hres)) -// { -// ModuleInfo moduleInfo(dbgModuleParameters); -// restoreSyntheticSymbolForModule(moduleInfo); -// } -// -// return S_OK; -// } -// -// //// f.e. is case ".reload /f image.exe", if for image.exe no symbols -// restoreSyntheticSymbolForAllModules(); -// -// return S_OK; -// } -// -// return DEBUG_STATUS_NO_CHANGE; -//} -// -///////////////////////////////////////////////////////////////////////////////////// -// -//HRESULT DbgEventCallbacksManager::Breakpoint( -// __in IDebugBreakpoint * bp -//) -//{ -// return dbgBreakpointClass::onBreakpointEvnet( bp ); -//} -// -///////////////////////////////////////////////////////////////////////////////////// -//// -////HRESULT DbgEventCallbacksManager::LoadModule( -//// __in ULONG64 ImageFileHandle, -//// __in ULONG64 BaseOffset, -//// __in ULONG ModuleSize, -//// __in PCSTR ModuleName, -//// __in PCSTR ImageName, -//// __in ULONG CheckSum, -//// __in ULONG TimeDateStamp -////) -////{ -//// try -//// { -//// return debugEvent::moduleLoaded(BaseOffset); -//// } -//// catch (std::exception &) -//// { -//// } -//// return DEBUG_STATUS_NO_CHANGE; -////} -//// -/////////////////////////////////////////////////////////////////////////////////////// -//// -////HRESULT DbgEventCallbacksManager::UnloadModule( -//// __in PCSTR ImageBaseName, -//// __in ULONG64 BaseOffset -////) -////{ -//// try -//// { -//// return debugEvent::moduleUnloaded(BaseOffset); -//// } -//// catch (std::exception &) -//// { -//// } -//// return DEBUG_STATUS_NO_CHANGE; -////} -//// -/////////////////////////////////////////////////////////////////////////////////////// -//// -////HRESULT DbgEventCallbacksManager::SessionStatus( -//// __in ULONG status -////) -////{ -//// try -//// { -//// return debugEvent::sessionStatus( status ); -//// } -//// catch( std::exception& ) -//// { -//// } -//// -//// return DEBUG_STATUS_NO_CHANGE; -////} -//// -/////////////////////////////////////////////////////////////////////////////////////// diff --git a/pykd/dbgeventcb.h b/pykd/dbgeventcb.h deleted file mode 100644 index 9dd194f..0000000 --- a/pykd/dbgeventcb.h +++ /dev/null @@ -1,64 +0,0 @@ - -#pragma once - -//#include -// -//////////////////////////////////////////////////////////////////////////////// -// -//// monitoring and processing debug events -//class DbgEventCallbacksManager : public DebugBaseEventCallbacks -//{ -//public: -// -// DbgEventCallbacksManager( IDebugClient *client = NULL ); -// -// virtual ~DbgEventCallbacksManager(); -// -//private: -// -// ///////////////////////////////////////////////////////////////////////////////// -// // IUnknown interface implementation -// -// STDMETHOD_(ULONG, AddRef)() { return 1; } -// STDMETHOD_(ULONG, Release)() { return 1; } -// -// ///////////////////////////////////////////////////////////////////////////////// -// // IDebugEventCallbacks interface implementation -// -// STDMETHOD(GetInterestMask)( -// __out PULONG Mask -// ); -// -// STDMETHOD(ChangeSymbolState)( -// __in ULONG Flags, -// __in ULONG64 Argument -// ); -// -// STDMETHOD(Breakpoint)( -// __in PDEBUG_BREAKPOINT Bp -// ); -// -///* STDMETHOD(LoadModule)( -// __in ULONG64 ImageFileHandle, -// __in ULONG64 BaseOffset, -// __in ULONG ModuleSize, -// __in PCSTR ModuleName, -// __in PCSTR ImageName, -// __in ULONG CheckSum, -// __in ULONG TimeDateStamp -// ); -// -// STDMETHOD(UnloadModule)( -// __in PCSTR ImageBaseName, -// __in ULONG64 BaseOffset -// ); -// -// STDMETHOD(SessionStatus)( -// __in ULONG status -// ); */ -// -//private: -// IDebugClient *m_debugClient; -//}; -// -//////////////////////////////////////////////////////////////////////////////// \ No newline at end of file diff --git a/pykd/dbgext.h b/pykd/dbgext.h deleted file mode 100644 index 0f09f6e..0000000 --- a/pykd/dbgext.h +++ /dev/null @@ -1,43 +0,0 @@ -#pragma once - -//#include -//#include -// -//class DbgExt { -// -//public: -// -// IDebugClient *client; -// IDebugClient4 *client4; -// IDebugClient5 *client5; -// -// IDebugControl *control; -// IDebugControl4 *control4; -// -// IDebugRegisters *registers; -// -// IDebugSymbols *symbols; -// IDebugSymbols2 *symbols2; -// IDebugSymbols3 *symbols3; -// -// IDebugDataSpaces *dataSpaces; -// IDebugDataSpaces4 *dataSpaces4; -// -// IDebugAdvanced2 *advanced2; -// -// IDebugSystemObjects *system; -// IDebugSystemObjects2 *system2; -// -// DbgExt( IDebugClient4 *client ); -// -// ~DbgExt(); -// -//private: -// -// DbgExt *m_previosExt; -//}; -// -//extern DbgExt *dbgExt; -// -// -//bool isWindbgExt(); diff --git a/pykd/dbgio.cpp b/pykd/dbgio.cpp deleted file mode 100644 index 6ae906e..0000000 --- a/pykd/dbgio.cpp +++ /dev/null @@ -1,34 +0,0 @@ -#include "stdafx.h" - -//#include -//#include -// -//#include "dbgio.h" -//#include "dbgext.h" -// -//using namespace std; -// -/////////////////////////////////////////////////////////////////////////////////// -// -//void dbgPrint::dprint( const boost::python::object& obj, bool dml ) -//{ -// std::wstring str = boost::python::extract( obj ); -// -// HRESULT hres = dbgExt->control4->ControlledOutputWide( dml ? DEBUG_OUTCTL_AMBIENT_DML : DEBUG_OUTCTL_AMBIENT_TEXT, DEBUG_OUTPUT_NORMAL, str.c_str() ); -// -// std::wcout << str; -//} -// -/////////////////////////////////////////////////////////////////////////////////// -// -//void dbgPrint::dprintln( const boost::python::object& obj, bool dml ) -//{ -// std::wstring str = boost::python::extract( obj ); -// str += L"\r\n"; -// -// dbgExt->control4->ControlledOutputWide( dml ? DEBUG_OUTCTL_AMBIENT_DML : DEBUG_OUTCTL_AMBIENT_TEXT, DEBUG_OUTPUT_NORMAL, str.c_str() ); -// -// std::wcout << str; -//} -// -/////////////////////////////////////////////////////////////////////////////////// diff --git a/pykd/dbgio.h b/pykd/dbgio.h deleted file mode 100644 index 1301477..0000000 --- a/pykd/dbgio.h +++ /dev/null @@ -1,224 +0,0 @@ -#pragma once - -//#include -//#include -// -//#include "dbgext.h" -// -/////////////////////////////////////////////////////////////////////////////////// -// -//class dbgPrint { -// -//public: -// -// static void dprint( const boost::python::object& obj, bool dml = false ); -// -// static void dprintln( const boost::python::object& obj, bool dml = false ); -// -//}; -// -///////////////////////////////////////////////////////////////////////////////// -// -//// класс для перехвата вывода в отладчик -// -//class OutputReader : public IDebugOutputCallbacks { -// -//public: -// -// OutputReader( IDebugClient *debugClient ) -// { -// HRESULT hres; -// -// try { -// -// m_debugClient = debugClient; -// m_debugClient->AddRef(); -// -// hres = m_debugClient->GetOutputCallbacks( &m_previousCallback ); -// if ( FAILED( hres ) ) -// { -// throw hres; -// } -// -// hres = m_debugClient->SetOutputCallbacks( this ); -// if ( FAILED( hres ) ) -// { -// throw hres; -// } -// -// } catch( ... ) -// { -// m_debugClient->Release(); -// m_debugClient = NULL; -// } -// } -// -// ~OutputReader() -// { -// if ( m_debugClient ) -// { -// m_debugClient->SetOutputCallbacks( m_previousCallback ); -// m_debugClient->Release(); -// } -// } -// -// const std::string& -// Line() const { -// return m_readLine; -// } -// -//private: -// -// // IUnknown. -// STDMETHOD(QueryInterface)( -// __in REFIID InterfaceId, -// __out PVOID* Interface ) { -// return E_NOINTERFACE; -// } -// -// STDMETHOD_(ULONG, AddRef)() { -// return 1L; -// } -// -// -// STDMETHOD_(ULONG, Release)() { -// return 0L; -// } -// -// STDMETHOD(Output)( -// __in ULONG Mask, -// __in PCSTR Text ) -// { -// if ( Mask == DEBUG_OUTPUT_NORMAL ) -// { -// m_readLine += std::string( Text ); -// } -// -// return S_OK; -// } -// -//private: -// -// std::string m_readLine; -// -// IDebugClient *m_debugClient; -// -// IDebugOutputCallbacks *m_previousCallback; -//}; -// -///////////////////////////////////////////////////////////////////////////////// -// -//class InputReader : public IDebugInputCallbacks { -// -//public: -// -// InputReader( IDebugClient *debugClient ) -// { -// HRESULT hres; -// -// try { -// -// m_debugClient = debugClient; -// m_debugClient->AddRef(); -// -// hres = m_debugClient->GetInputCallbacks( &m_previousCallback ); -// if ( FAILED( hres ) ) -// { -// throw hres; -// } -// -// hres = m_debugClient->SetInputCallbacks( this ); -// if ( FAILED( hres ) ) -// { -// throw hres; -// } -// -// } catch( ... ) -// { -// m_debugClient->Release(); -// m_debugClient = NULL; -// } -// } -// -// ~InputReader() -// { -// if ( m_debugClient ) -// { -// m_debugClient->SetInputCallbacks( m_previousCallback ); -// m_debugClient->Release(); -// } -// } -// -// -//private: -// -// // IUnknown. -// STDMETHOD(QueryInterface)( -// __in REFIID InterfaceId, -// __out PVOID* Interface ) { -// return E_NOINTERFACE; -// } -// -// STDMETHOD_(ULONG, AddRef)() { -// return 1L; -// } -// -// -// STDMETHOD_(ULONG, Release)() { -// return 0L; -// } -// -// STDMETHOD( EndInput )() { -// return S_OK; -// } -// -// STDMETHOD( StartInput )( -// IN ULONG BufferSize ) { -// return S_OK; -// } -// -//private: -// -// IDebugClient *m_debugClient; -// -// IDebugInputCallbacks *m_previousCallback; -// -//}; -// -// -/////////////////////////////////////////////////////////////////////////////////// -// -//class dbgOut { -// -//public: -// -// void -// write( const boost::python::object &str ) { -// dbgPrint::dprint( str ); -// } -// -//}; -// -/////////////////////////////////////////////////////////////////////////////////// -// -//class dbgIn { -// -//public: -// -// std::string -// readline() { -// -// char str[100]; -// ULONG inputSize; -// -// OutputReader outputReader( dbgExt->client ); -// -// dbgExt->control->Input( str, sizeof(str), &inputSize ); -// -// return std::string( str ); -// } -// -//}; -// -/////////////////////////////////////////////////////////////////////////////////// -// diff --git a/pykd/dbgpath.cpp b/pykd/dbgpath.cpp deleted file mode 100644 index 4599d51..0000000 --- a/pykd/dbgpath.cpp +++ /dev/null @@ -1,148 +0,0 @@ -#include "stdafx.h" - -//#include "dbgpath.h" -// -//#include -// -///////////////////////////////////////////////////////////////////////////////// -// -// -// -//DbgPythonPath::DbgPythonPath() -//{ -// DWORD enviromentSize = 0; -// -// enviromentSize = GetEnvironmentVariableA( "PYTHONPATH", NULL, enviromentSize ); -// -// std::vector enviromentBuffer(enviromentSize); -// -// if (!enviromentBuffer.empty()) -// { -// GetEnvironmentVariableA( "PYTHONPATH", &enviromentBuffer[0], enviromentSize ); -// -// typedef boost::escaped_list_separator char_separator_t; -// typedef boost::tokenizer< char_separator_t > char_tokenizer_t; -// -// std::string pytonPath( &enviromentBuffer[0] ); -// -// char_tokenizer_t token( pytonPath, char_separator_t( "", "; \t", "\"" ) ); -// -// for ( char_tokenizer_t::iterator it = token.begin(); it != token.end(); ++it ) -// { -// if ( *it != "" ) -// m_pathList.push_back( *it ); -// } -// } -//} -// -///////////////////////////////////////////////////////////////////////////////// -// -//std::string -//DbgPythonPath::getStr() const -//{ -// std::string str; -// std::vector::const_iterator it = m_pathList.begin(); -// -// for ( ; it != m_pathList.end(); ++it ) -// { -// str += *it; -// str += ";"; -// } -// -// return str; -//} -// -///////////////////////////////////////////////////////////////////////////////// -// -//bool -//DbgPythonPath::findPath( -// const std::string &fileName, -// std::string &fullFileName, -// std::string &filePath ) const -//{ -// std::vector< std::string > extPathList; -// -// boost::python::object sys = boost::python::import( "sys"); -// -// boost::python::list pathList( sys.attr("path") ); -// -// boost::python::ssize_t n = boost::python::len(pathList); -// for(boost::python::ssize_t i=0;i( pathList[i] ) ); -// -// bool pyExt = fileName.rfind( ".py" ) == fileName.length() - 3; -// -// // 1. Ищем в рабочей директории -// DWORD bufSize = -// SearchPathA( -// NULL, -// fileName.c_str(), -// pyExt ? NULL : ".py", -// 0, -// NULL, -// NULL ); -// -// if ( bufSize > 0 ) -// { -// bufSize += 1; -// std::vector fullFileNameCStr(bufSize); -// char *partFileNameCStr = NULL; -// -// SearchPathA( -// NULL, -// fileName.c_str(), -// pyExt ? NULL : ".py", -// bufSize, -// &fullFileNameCStr[0], -// &partFileNameCStr ); -// -// fullFileName = std::string( &fullFileNameCStr[0] ); -// if ( !fullFileName.empty() ) -// { -// filePath = std::string( &fullFileNameCStr[0], partFileNameCStr ); -// return true; -// } -// } -// -// // 2. Ищем во всех директориях, указанных в m_pathList -// -// std::vector::const_iterator it = extPathList.begin(); -// -// for ( ; it != extPathList.end(); ++it ) -// { -// DWORD bufSize = -// SearchPathA( -// (*it).c_str(), -// fileName.c_str(), -// pyExt ? NULL : ".py", -// 0, -// NULL, -// NULL ); -// -// if ( bufSize > 0 ) -// { -// bufSize += 1; -// std::vector fullFileNameCStr(bufSize); -// char *partFileNameCStr = NULL; -// -// bufSize = SearchPathA( -// (*it).c_str(), -// fileName.c_str(), -// pyExt ? NULL : ".py", -// bufSize, -// &fullFileNameCStr[0], -// &partFileNameCStr ); -// -// fullFileName = std::string( &fullFileNameCStr[0] ); -// if ( !fullFileName.empty() ) -// { -// filePath = std::string( &fullFileNameCStr[0], partFileNameCStr ); -// return true; -// } -// } -// } -// -// return false; -//} -// -//////////////////////////////////////////////////////////////////////////////// diff --git a/pykd/dbgpath.h b/pykd/dbgpath.h deleted file mode 100644 index f73eb57..0000000 --- a/pykd/dbgpath.h +++ /dev/null @@ -1,32 +0,0 @@ -#pragma once - -//#include -// -///////////////////////////////////////////////////////////////////////////////// -// -//class DbgPythonPath -//{ -//public: -// -// DbgPythonPath(); -// -// std::string -// getStr() const; -// -// bool -// findPath( -// const std::string &fileName, -// std::string &fullFileName, -// std::string &filePath ) const; -// -// -//private: -// -// std::vector< std::string > m_pathList; -// -//}; -// -////extern DbgPythonPath& dbgPythonPath; -// -// -///////////////////////////////////////////////////////////////////////////////// \ No newline at end of file diff --git a/pykd/dbgprocess.cpp b/pykd/dbgprocess.cpp deleted file mode 100644 index c67f2a2..0000000 --- a/pykd/dbgprocess.cpp +++ /dev/null @@ -1,289 +0,0 @@ -#include "stdafx.h" - -//#include -//#include -// -//#include "dbgprocess.h" -//#include "dbgext.h" -//#include "dbgexcept.h" -//#include "dbgtype.h" -// -/////////////////////////////////////////////////////////////////////////////////// -// -//boost::python::object -//getThreadList() -//{ -// HRESULT hres; -// ULONG i; -// ULONG oldThreadId = 0; -// -// ULONG threadCount; -// hres = dbgExt->system->GetNumberThreads( &threadCount ); -// if ( FAILED( hres ) ) -// throw DbgException( "IDebugSystemObjects::GetNumberThreads failed" ); -// -// boost::scoped_array ids(new ULONG[threadCount]); -// hres = dbgExt->system->GetThreadIdsByIndex( 0, threadCount, ids.get(), NULL ); -// if ( FAILED( hres ) ) -// throw DbgException( "IDebugSystemObjects::GetThreadIdsByIndex failed" ); -// -// hres = dbgExt->system->GetCurrentThreadId( &oldThreadId ); -// -// boost::python::list threadList; -// -// for ( i = 0; i < threadCount; ++i ) -// { -// dbgExt->system->SetCurrentThreadId( ids[i] ); -// -// ULONG64 threadOffset; -// hres = dbgExt->system->GetCurrentThreadDataOffset( &threadOffset ); -// -// if ( FAILED( hres ) ) -// { -// dbgExt->system->SetCurrentThreadId( oldThreadId ); -// throw DbgException( "IDebugSystemObjects::GetCurrentThreadDataOffset failed" ); -// } -// -// threadList.append( threadOffset ); -// } -// -// return threadList; -//} -// -/////////////////////////////////////////////////////////////////////////////////// -// -//void -//setImplicitThread( -// ULONG64 newThreadAddr ) -//{ -// HRESULT hres; -// -// newThreadAddr = addr64(newThreadAddr); -// hres = dbgExt->system2->SetImplicitThreadDataOffset( newThreadAddr ); -// if ( FAILED( hres ) ) -// throw DbgException( "IDebugSystemObjects2::SetImplicitThreadDataOffset failed" ); -//} -// -/////////////////////////////////////////////////////////////////////////////////// -// -//ULONG64 -//getImplicitThread() -//{ -// HRESULT hres; -// ULONG64 threadOffset = -1; -// -// hres = dbgExt->system2->GetImplicitThreadDataOffset( &threadOffset ); -// if ( FAILED( hres ) ) -// throw DbgException( "IDebugSystemObjects2::GetImplicitThreadDataOffset failed" ); -// -// return threadOffset; -//} -// -/////////////////////////////////////////////////////////////////////////////////// -// -//boost::python::object -//getCurrentStack() -//{ -// HRESULT hres; -// ULONG currentScope = 0; -// -// hres = dbgExt->symbols3->GetCurrentScopeFrameIndex( ¤tScope ); -// if ( FAILED( hres ) ) -// throw DbgException( "IDebugSymbol3::GetCurrentScopeFrameIndex failed" ); -// -// boost::scoped_array frames(new DEBUG_STACK_FRAME [ 1000 ]); -// -// ULONG filledFrames; -// hres = dbgExt->control->GetStackTrace( 0, 0, 0, frames.get(), 1000, &filledFrames ); -// if ( FAILED( hres ) ) -// throw DbgException( "IDebugControl::GetStackTrace failed" ); -// -// boost::python::list frameList; -// -// for ( ULONG i = 0; i < filledFrames; ++i ) -// { -// dbgStackFrameClass frame( frames[i] ); -// -// boost::python::object frameObj( frame ); -// -// hres = dbgExt->symbols->SetScope( NULL, &frames[i], NULL, sizeof(DEBUG_STACK_FRAME) ); -// if ( SUCCEEDED( hres ) ) -// frameObj.attr( "locals" ) = getLocals(); -// -// frameList.append( frameObj ); -// } -// -// dbgExt->symbols3->SetScopeFrameByIndex( currentScope ); -// -// return frameList; -//} -// -/////////////////////////////////////////////////////////////////////////////////// -// -//std::string -//getProcessorMode() -//{ -// HRESULT hres; -// -// ULONG processorMode; -// hres = dbgExt->control->GetEffectiveProcessorType( &processorMode ); -// if ( FAILED( hres ) ) -// throw DbgException( "IDebugControl::GetEffectiveProcessorType failed" ); -// -// switch( processorMode ) -// { -// case IMAGE_FILE_MACHINE_I386: -// return "X86"; -// -// case IMAGE_FILE_MACHINE_ARM: -// return "ARM"; -// -// case IMAGE_FILE_MACHINE_IA64: -// return "IA64"; -// -// case IMAGE_FILE_MACHINE_AMD64: -// return "X64"; -// } -// -// throw DbgException( "Unknown CPU type" ); -// -//} -// -/////////////////////////////////////////////////////////////////////////////////// -// -//void -//setProcessorMode( -// const std::string &mode ) -//{ -// HRESULT hres; -// ULONG processorMode = ~0; -// -// if ( mode == "X86" ) -// processorMode = IMAGE_FILE_MACHINE_I386; -// else if ( mode == "ARM" ) -// processorMode = IMAGE_FILE_MACHINE_ARM; -// else if ( mode == "IA64" ) -// processorMode = IMAGE_FILE_MACHINE_IA64; -// else if ( mode == "X64" ) -// processorMode = IMAGE_FILE_MACHINE_AMD64; -// else -// throw DbgException( "Unknown processor type" ); -// -// hres = dbgExt->control->SetEffectiveProcessorType( processorMode ); -// if ( FAILED( hres ) ) -// throw DbgException( "IDebugControl::SetEffectiveProcessorType failed" ); -// -//} -// -/////////////////////////////////////////////////////////////////////////////////// -// -//ULONG64 -//getCurrentProcess() -//{ -// HRESULT hres; -// ULONG64 processAddr = 0; -// -// hres = dbgExt->system2->GetImplicitProcessDataOffset( &processAddr ); -// if ( FAILED( hres ) ) -// throw DbgException( "IDebugSystemObjects2::GetImplicitProcessDataOffset failed" ); -// -// return processAddr; -//} -// -/////////////////////////////////////////////////////////////////////////////////// -// -//VOID -//setCurrentProcess( -// ULONG64 processAddr ) -//{ -// HRESULT hres; -// -// processAddr = addr64(processAddr); -// hres = dbgExt->system2->SetImplicitProcessDataOffset( processAddr ); -// if ( FAILED( hres ) ) -// throw DbgException( "IDebugSystemObjects2::SetImplicitProcessDataOffset failed" ); -//} -// -/////////////////////////////////////////////////////////////////////////////////// -// -//dbgStackFrameClass::dbgStackFrameClass( const DEBUG_STACK_FRAME &stackFrame ) -//{ -// memcpy( static_cast( this ), &stackFrame, sizeof(DEBUG_STACK_FRAME) ); -//} -// -/////////////////////////////////////////////////////////////////////////////////// -// -//std::string -//dbgStackFrameClass::print() const -//{ -// boost::format fmt(dbgExt->control->IsPointer64Bit() == S_OK ? "%1$4d %2$16x" : "%1$4d %2$08x"); -// fmt % FrameNumber % ReturnOffset; -// return fmt.str(); -//} -// -/////////////////////////////////////////////////////////////////////////////////// -// -//boost::python::object -//getLocals() -//{ -// HRESULT hres; -// CComPtr localSymbols; -// CComPtr localSymbols2; -// -// hres = dbgExt->symbols->GetScopeSymbolGroup( DEBUG_SCOPE_GROUP_ARGUMENTS|DEBUG_SCOPE_GROUP_LOCALS, NULL, &localSymbols ); -// if ( FAILED( hres ) ) -// throw DbgException( "IDebugSymbols::GetScopeSymbolGroup failed" ); -// -// hres = localSymbols->QueryInterface( __uuidof(IDebugSymbolGroup2), (void**) &localSymbols2 ); -// if ( FAILED( hres ) ) -// throw DbgException( "IDebugSymbols::QueryInterface failed to get IDebugSymbolGroup2" ); -// -// ULONG localNumber; -// hres = localSymbols->GetNumberSymbols( &localNumber ); -// -// boost::python::dict arr; -// -// for ( ULONG i = 0; i < localNumber; ++i ) -// { -// char varName[0x100]; -// -// hres = localSymbols->GetSymbolName( i, varName, sizeof(varName), NULL ); -// if ( FAILED( hres ) ) -// throw DbgException( "IDebugSymbolGroup::GetSymbolName failed" ); -// -// DEBUG_SYMBOL_PARAMETERS symbolParam = {}; -// hres = localSymbols->GetSymbolParameters( i, 1, &symbolParam ); -// if ( FAILED( hres ) ) -// throw DbgException( "IDebugSymbolGroup::GetSymbolParameters failed" ); -// -// char typeName[0x100]; -// hres = dbgExt->symbols->GetTypeName( symbolParam.Module, symbolParam.TypeId, typeName, sizeof(typeName), NULL ); -// if ( FAILED( hres ) ) -// throw DbgException( "IDebugSymbols::GetTypeName failed" ); -// -// char moduleName[0x100]; -// hres = dbgExt->symbols2->GetModuleNameString( -// DEBUG_MODNAME_MODULE, -// DEBUG_ANY_ID, -// symbolParam.Module, -// moduleName, -// sizeof(moduleName), -// NULL ); -// if ( FAILED( hres ) ) -// throw DbgException( "IDebugSymbols2::GetModuleNameString failed" ); -// -// -// ULONG64 varOffset; -// hres = localSymbols2->GetSymbolOffset( i, &varOffset ); -// if ( FAILED( hres ) ) -// throw DbgException( "IDebugSymbolGroup2::GetSymbolOffset failed" ); -// -// arr[ varName ] = TypedVar( moduleName, typeName, varOffset ); -// } -// -// return arr; -//} -// -/////////////////////////////////////////////////////////////////////////////////// - - diff --git a/pykd/dbgprocess.h b/pykd/dbgprocess.h deleted file mode 100644 index 1fb0052..0000000 --- a/pykd/dbgprocess.h +++ /dev/null @@ -1,54 +0,0 @@ -#pragma once - -//#include -// -/////////////////////////////////////////////////////////////////////////////////// -// -//boost::python::object -//getThreadList(); -// -//void -//setImplicitThread( -// ULONG64 newThreadAddr ); -// -//ULONG64 -//getImplicitThread(); -// -//boost::python::object -//getCurrentStack(); -// -//boost::python::object -//getLocals(); -// -// -//class dbgStackFrameClass : public DEBUG_STACK_FRAME { -// -//public: -// -// dbgStackFrameClass() -// { -// memset( static_cast( this ), 0, sizeof(DEBUG_STACK_FRAME) ); -// } -// -// dbgStackFrameClass( const DEBUG_STACK_FRAME &stackFrame ); -// -// std::string -// print() const; -//}; -// -////boost::python::object -//std::string -//getProcessorMode(); -// -//void -//setProcessorMode( -// const std::string &mode ); -// -//ULONG64 -//getCurrentProcess(); -// -//VOID -//setCurrentProcess( -// ULONG64 processAddr ); -// -/////////////////////////////////////////////////////////////////////////////////// \ No newline at end of file diff --git a/pykd/dbgreg.cpp b/pykd/dbgreg.cpp deleted file mode 100644 index 0c530d7..0000000 --- a/pykd/dbgreg.cpp +++ /dev/null @@ -1,162 +0,0 @@ -#include "stdafx.h" - -//#include "dbgext.h" -//#include "dbgreg.h" -//#include "dbgexcept.h" -// -//using namespace std; -// -///////////////////////////////////////////////////////////////////////////////////// -// -//cpuReg::cpuReg( std::string regName ) -//{ -// HRESULT hres; -// -// m_name = regName; -// m_lived = false; -// -// hres = dbgExt->registers->GetIndexByName( m_name.c_str(), &m_index ); -// if ( FAILED( hres ) ) -// throw DbgException( "IDebugRegister::GetIndexByName failed" ); -// -// reloadValue(); -//} -// -///////////////////////////////////////////////////////////////////////////////////// -// -//cpuReg::cpuReg( ULONG index ) -//{ -// HRESULT hres; -// -// m_index = index; -// m_lived = false; -// -// ULONG nameSize = 0; -// -// hres = -// dbgExt->registers->GetDescription( -// m_index, -// NULL, -// 0, -// &nameSize, -// NULL ); -// -// if ( FAILED( hres ) ) -// throw DbgException( "IDebugRegister::GetDescription failed" ); -// -// std::vector nameBuffer(nameSize); -// -// hres = -// dbgExt->registers->GetDescription( -// m_index, -// &nameBuffer[0], -// nameSize, -// NULL, -// NULL ); -// -// if ( FAILED( hres ) ) -// throw DbgException( "IDebugRegister::GetDescription failed" ); -// -// m_name = std::string( &nameBuffer[0] ); -// -// reloadValue(); -//} -// -///////////////////////////////////////////////////////////////////////////////////// -// -//void cpuReg::reloadValue() const -//{ -// HRESULT hres; -// -// DEBUG_VALUE debugValue; -// hres = dbgExt->registers->GetValue( m_index, &debugValue ); -// if ( FAILED( hres ) ) -// throw DbgException( "IDebugRegister::GetValue failed" ); -// -// switch( debugValue.Type ) -// { -// case DEBUG_VALUE_INT8: -// m_value = debugValue.I8; -// break; -// -// case DEBUG_VALUE_INT16: -// m_value = debugValue.I16; -// break; -// -// case DEBUG_VALUE_INT32: -// m_value = debugValue.I32; -// break; -// -// case DEBUG_VALUE_INT64: -// m_value = debugValue.I64; -// break; -// } -//} -// -///////////////////////////////////////////////////////////////////////////////////// -// -//boost::python::object -//loadRegister( const std::string ®isterName ) -//{ -// HRESULT hres; -// -// ULONG registerIndex = 0; -// -// hres = dbgExt->registers->GetIndexByName( registerName.c_str(), ®isterIndex ); -// if ( FAILED( hres ) ) -// throw DbgException( "IDebugRegister::GetIndexByName failed" ); -// -// DEBUG_VALUE debugValue; -// hres = dbgExt->registers->GetValue( registerIndex, &debugValue ); -// if ( FAILED( hres ) ) -// throw DbgException( "IDebugRegister::GetValue failed" ); -// -// switch( debugValue.Type ) -// { -// case DEBUG_VALUE_INT8: -// return boost::python::long_( debugValue.I8 ); -// break; -// -// case DEBUG_VALUE_INT16: -// return boost::python::long_( debugValue.I16 ); -// break; -// -// case DEBUG_VALUE_INT32: -// return boost::python::long_( debugValue.I32 ); -// break; -// -// case DEBUG_VALUE_INT64: -// return boost::python::long_(debugValue.I64 ); -// break; -// } -// -// throw DbgException( "Invalid register value" ); -//} -// -///////////////////////////////////////////////////////////////////////////////////// -// -//ULONG64 -//loadMSR( ULONG msr ) -//{ -// HRESULT hres; -// ULONG64 value; -// -// hres = dbgExt->dataSpaces->ReadMsr( msr, &value ); -// if ( FAILED( hres ) ) -// throw DbgException( "IDebugDataSpaces::ReadMsr failed" ); -// -// return value; -//} -// -///////////////////////////////////////////////////////////////////////////////////// -// -//void setMSR( ULONG msr, ULONG64 value) -//{ -// HRESULT hres; -// -// hres = dbgExt->dataSpaces->WriteMsr(msr, value); -// if ( FAILED( hres ) ) -// throw DbgException( "IDebugDataSpaces::WriteMsr failed" ); -//} -// -///////////////////////////////////////////////////////////////////////////////////// diff --git a/pykd/dbgreg.h b/pykd/dbgreg.h deleted file mode 100644 index 856a1b6..0000000 --- a/pykd/dbgreg.h +++ /dev/null @@ -1,61 +0,0 @@ -#pragma once - -//#include -//#include -// -//#include "intbase.h" -// -/////////////////////////////////////////////////////////////////////////////////// -// -//class cpuReg : public intBase { -// -//public : -// -// cpuReg( std::string regName ); -// -// cpuReg( ULONG index ); -// -// std::string -// name() const { -// return m_name; -// } -// -// ULONG -// index() const { -// return m_index; -// } -// -// void beLive() { -// m_lived = true; -// } -// -// ULONG64 value() const -// { -// if ( m_lived ) -// reloadValue(); -// -// return intBase::value(); -// } -// -//private: -// -// void reloadValue() const; -// -// std::string m_name; -// -// ULONG m_index; -// -// bool m_lived; -//}; -// -/////////////////////////////////////////////////////////////////////////////////// -// -//boost::python::object -//loadRegister( const std::string ®isterName ); -// -//ULONG64 -//loadMSR( ULONG msr ); -// -//void setMSR( ULONG msr, ULONG64 val); -// -/////////////////////////////////////////////////////////////////////////////////// \ No newline at end of file diff --git a/pykd/dbgsym.cpp b/pykd/dbgsym.cpp deleted file mode 100644 index 0fcfcee..0000000 --- a/pykd/dbgsym.cpp +++ /dev/null @@ -1,78 +0,0 @@ -#include "stdafx.h" - -//#include "dbgext.h" -//#include "dbgsym.h" -//#include "dbgexcept.h" -//#include "dbgmem.h" -// -/////////////////////////////////////////////////////////////////////////////////// -// -//boost::python::object -//findSymbolForAddress( ULONG64 addr ) -//{ -// HRESULT hres; -// -// try { -// -// addr = addr64( addr ); -// -// ULONG moduleIndex; -// ULONG64 moduleBase; -// hres = dbgExt->symbols->GetModuleByOffset( addr, 0, &moduleIndex, &moduleBase ); -// -// if ( FAILED( hres ) ) -// { -// return boost::python::object(); -// } -// -// char moduleName[0x100]; -// hres = dbgExt->symbols2->GetModuleNameString( DEBUG_MODNAME_MODULE, moduleIndex, moduleBase, -// moduleName, sizeof( moduleName ), NULL ); -// -// if ( FAILED( hres ) ) -// throw DbgException( "IDebugSymbol2::GetModuleNameString failed" ); -// -// char symbolName[0x100]; -// ULONG64 displace = 0; -// hres = dbgExt->symbols->GetNameByOffset( addr, symbolName, sizeof(symbolName), NULL, &displace ); -// if ( FAILED( hres ) ) -// throw DbgException( "IDebugSymbol::GetNameByOffset failed" ); -// -// std::stringstream ss; -// displace == 0 ? ss << symbolName : ss << symbolName << '+' << std::hex << displace; -// -// return boost::python::object( ss.str() ); -// -// } -// 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 boost::python::object(); -//} -// -/////////////////////////////////////////////////////////////////////////////////// -// -//ULONG64 -//findAddressForSymbol( const std::string &moduleName, const std::string &symbolName ) -//{ -// HRESULT hres; -// -// std::string ModuleSymName = moduleName; -// ModuleSymName += "!"; -// ModuleSymName += symbolName; -// -// ULONG64 offset = 0ULL; -// hres = dbgExt->symbols->GetOffsetByName( ModuleSymName.c_str(), &offset ); -// if ( SUCCEEDED( hres ) ) -// return offset; -// -// throw DbgException( "failed to find offset for symbol" ); -//} -// -/////////////////////////////////////////////////////////////////////////////////// \ No newline at end of file diff --git a/pykd/dbgsym.h b/pykd/dbgsym.h deleted file mode 100644 index 7ce45a2..0000000 --- a/pykd/dbgsym.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -//#include -// -/////////////////////////////////////////////////////////////////////////////////// -// -//boost::python::object -//findSymbolForAddress( ULONG64 addr ); -// -//ULONG64 -//findAddressForSymbol( const std::string &moduleName, const std::string &symbolName ); -// -/////////////////////////////////////////////////////////////////////////////////// diff --git a/pykd/dbgsynsym.cpp b/pykd/dbgsynsym.cpp deleted file mode 100644 index 6dcede1..0000000 --- a/pykd/dbgsynsym.cpp +++ /dev/null @@ -1,651 +0,0 @@ -#include "stdafx.h" - -//#include -//#include -//#include -//#include -// -//#include "dbgext.h" -//#include "dbgmem.h" -//#include "dbgmodule.h" -//#include "dbgexcept.h" -//#include "dbgsynsym.h" -// -/////////////////////////////////////////////////////////////////////////////////// -// -//struct SyntheticSymbol -//{ -// std::string m_name; -// ULONG m_size; -// -// SyntheticSymbol() -// : m_size(0) -// { -// } -// SyntheticSymbol( -// const std::string &name -// ) : m_name(name) -// , m_size(0) -// { -// } -// SyntheticSymbol( -// const SyntheticSymbol &rhs -// ) : m_name(rhs.m_name) -// , m_size(rhs.m_size) -// { -// } -// -// bool operator ==(const SyntheticSymbol &rhs) const -// { -// return m_name == rhs.m_name; -// } -//}; -// -/////////////////////////////////////////////////////////////////////////////////// -// -//// map of one module synthetic symbols -//typedef std::map SynSymbolsForModule; -// -//// global synthetic symbols map by modules -//typedef std::map SynSymbolsMap; -// -//// synchro-object for global synthetic symbols map -//typedef boost::interprocess::interprocess_recursive_mutex SynSymbolsMapLockType; -//typedef boost::interprocess::interprocess_mutex SynSymbolsMapLockWriteType; -// -//// scoped lock synchro-object for global synthetic symbols map -//typedef boost::interprocess::scoped_lock SynSymbolsMapScopedLock; -//typedef boost::interprocess::scoped_lock SynSymbolsMapScopedLockWrite; -// -//static struct _GlobalSyntheticSymbolMap : public SynSymbolsMap -//{ -// SynSymbolsMapLockType m_Lock; -// SynSymbolsMapLockWriteType m_LockWrite; -//} g_SyntheticSymbolMap; -// -//#define _SynSymbolsMapScopedLock() \ -// SynSymbolsMapScopedLock _lock(g_SyntheticSymbolMap.m_Lock) -//#define _SynSymbolsMapScopedLockWrite() \ -// _SynSymbolsMapScopedLock(); \ -// SynSymbolsMapScopedLockWrite _lockw(g_SyntheticSymbolMap.m_LockWrite) -// -// -/////////////////////////////////////////////////////////////////////////////////// -// -//bool addSyntheticSymbol( -// ULONG64 addr, -// ULONG size, -// const std::string &symName -//) -//{ -// try -// { -// -// DEBUG_MODULE_AND_ID dbgModuleAndId = { 0 }; -// addr = addr64(addr); -// HRESULT hres = -// dbgExt->symbols3->AddSyntheticSymbol( -// addr, -// size, -// symName.c_str(), -// DEBUG_ADDSYNTHSYM_DEFAULT, -// &dbgModuleAndId); -// if ( FAILED( hres ) ) -// throw DbgException( "call IDebugSymbol3::AddSyntheticSymbol(...) failed" ); -// -// DEBUG_MODULE_PARAMETERS dbgModuleParameters; -// hres = dbgExt->symbols->GetModuleParameters( -// 1, -// &dbgModuleAndId.ModuleBase, -// 0, -// &dbgModuleParameters); -// if ( FAILED( hres ) ) -// { -// dbgExt->symbols3->RemoveSyntheticSymbol(&dbgModuleAndId); -// throw DbgException( "call IDebugSymbol3::GetModuleParameters(...) failed" ); -// } -// -// _SynSymbolsMapScopedLockWrite(); -// -// ModuleInfo moduleInfo(dbgModuleParameters); -// SynSymbolsForModule &mapSynSymbolsForModule = -// g_SyntheticSymbolMap[moduleInfo]; -// -// ULONG64 addrSymbolOffset = addr - moduleInfo.m_base; -// SyntheticSymbol &synSymbol = mapSynSymbolsForModule[addrSymbolOffset]; -// -// synSymbol.m_name = symName; -// synSymbol.m_size = size; -// -// 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; -//} -// -/////////////////////////////////////////////////////////////////////////////////// -// -//bool addSyntheticSymbolForModule( -// ULONG64 offset, -// ULONG size, -// const std::string &symName, -// const ModuleInfo &moduleInfo -//) -//{ -// try -// { -// DEBUG_MODULE_AND_ID dbgModuleAndId = { 0 }; -// offset = addr64(offset); -// HRESULT hres = -// dbgExt->symbols3->AddSyntheticSymbol( -// offset + moduleInfo.m_base, -// size, -// symName.c_str(), -// DEBUG_ADDSYNTHSYM_DEFAULT, -// &dbgModuleAndId); -// if ( FAILED( hres ) ) -// throw DbgException( "call IDebugSymbol3::AddSyntheticSymbol(...) failed" ); -// -// { -// DEBUG_MODULE_PARAMETERS dbgModuleParameters; -// hres = dbgExt->symbols->GetModuleParameters( -// 1, -// &dbgModuleAndId.ModuleBase, -// 0, -// &dbgModuleParameters); -// if ( FAILED( hres ) ) -// { -// dbgExt->symbols3->RemoveSyntheticSymbol(&dbgModuleAndId); -// throw DbgException( "call IDebugSymbol3::GetModuleParameters(...) failed" ); -// } -// ModuleInfo gettedModuleInfo(dbgModuleParameters); -// if (!(gettedModuleInfo == moduleInfo)) -// { -// // module mismatch -// dbgExt->control->Output( DEBUG_OUTPUT_ERROR, "pykd!" __FUNCTION__ " mismatch modules\n" ); -// dbgExt->symbols3->RemoveSyntheticSymbol(&dbgModuleAndId); -// return false; -// } -// } -// -// _SynSymbolsMapScopedLockWrite(); -// -// SynSymbolsForModule &mapSynSymbolsForModule = -// g_SyntheticSymbolMap[moduleInfo]; -// -// SyntheticSymbol &synSymbol = mapSynSymbolsForModule[offset]; -// -// synSymbol.m_name = symName; -// synSymbol.m_size = size; -// -// 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; -//} -// -/////////////////////////////////////////////////////////////////////////////////// -// -//struct SynSymbolNameCmp -//{ -// SynSymbolNameCmp(const std::string &symName ) : m_symName(symName) { } -// bool operator() (const std::pair &rhs) const -// { -// return m_symName == rhs.second.m_name; -// } -// const std::string &m_symName; -//}; -// -/////////////////////////////////////////////////////////////////////////////////// -// -//ULONG64 getSyntheticSymbol( -// const ModuleInfo &moduleInfo, -// const std::string &symName -//) -//{ -// ULONG64 nAddress = 0; -// -// try -// { -// _SynSymbolsMapScopedLock(); -// -// // try find module -// SynSymbolsMap::const_iterator itSynSymbols = -// g_SyntheticSymbolMap.find( moduleInfo ); -// if (itSynSymbols != g_SyntheticSymbolMap.end()) -// { -// // try find symbol by name -// const SynSymbolsForModule &mapSynSymbolsForModule = itSynSymbols->second; -// SynSymbolNameCmp nameCmp(symName); -// -// // FIXME: get first matched by name -// SynSymbolsForModule::const_iterator itSynSymbol = -// find_if( -// mapSynSymbolsForModule.begin(), -// mapSynSymbolsForModule.end(), -// nameCmp); -// if (itSynSymbol != mapSynSymbolsForModule.end()) -// nAddress = moduleInfo.m_base + itSynSymbol->first; -// } -// } -// 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 nAddress; -//} -// -/////////////////////////////////////////////////////////////////////////////////// -// -//// remove synthetic symbols by array of DEBUG_MODULE_AND_ID -//inline ULONG RemoveSyntheticSymbols( -// const std::vector &arrSymbols -//) -//{ -// ULONG nResult = 0; -// for (ULONG i = 0; i < arrSymbols.size(); ++i) -// { -// HRESULT hres = -// dbgExt->symbols3->RemoveSyntheticSymbol( -// const_cast(&arrSymbols[i])); -// if (FAILED(hres)) -// continue; -// ++nResult; -// } -// return nResult; -//} -// -/////////////////////////////////////////////////////////////////////////////////// -// -//static ULONG RemoveSynSymbolsByAddress(ULONG64 addr) -//{ -// ULONG nEntries = 0; -// dbgExt->symbols3->GetSymbolEntriesByOffset( -// addr, -// 0, -// NULL, -// NULL, -// 0, -// &nEntries); -// if (nEntries) -// { -// std::vector arrSymbols(nEntries); -// HRESULT hres = dbgExt->symbols3->GetSymbolEntriesByOffset( -// addr, -// 0, -// &arrSymbols[0], -// NULL, -// (ULONG)arrSymbols.size(), -// NULL); -// if (SUCCEEDED(hres)) -// return RemoveSyntheticSymbols(arrSymbols); -// } -// return 0; -//} -// -/////////////////////////////////////////////////////////////////////////////////// -// -//static void DeleteSynSymbolsForModule( -// const std::pair &synSymbolsForModule -//) -//{ -// DEBUG_MODULE_PARAMETERS dbgModuleParameters; -// HRESULT hres = dbgExt->symbols->GetModuleParameters( -// 1, -// const_cast(&synSymbolsForModule.first.m_base), -// 0, -// &dbgModuleParameters); -// if ( FAILED( hres ) ) -// return; -// ModuleInfo gettedModuleInfo(dbgModuleParameters); -// if (gettedModuleInfo == synSymbolsForModule.first) -// { -// // no clear - global map will be cleared on exit -// SynSymbolsForModule::const_iterator itSynSymbol = -// synSymbolsForModule.second.begin(); -// while (itSynSymbol != synSymbolsForModule.second.end()) -// { -// RemoveSynSymbolsByAddress( -// gettedModuleInfo.m_base + itSynSymbol->first); -// ++itSynSymbol; -// } -// } -//} -// -/////////////////////////////////////////////////////////////////////////////////// -// -//void delAllSyntheticSymbols() -//{ -// try -// { -// _SynSymbolsMapScopedLockWrite(); -// -// for_each( -// g_SyntheticSymbolMap.begin(), -// g_SyntheticSymbolMap.end(), -// DeleteSynSymbolsForModule); -// g_SyntheticSymbolMap.clear(); -// } -// 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" ); -// } -//} -// -/////////////////////////////////////////////////////////////////////////////////// -// -//void delAllSyntheticSymbolsForModule( -// const ModuleInfo &moduleInfo -//) -//{ -// try -// { -// _SynSymbolsMapScopedLockWrite(); -// -// SynSymbolsMap::iterator itSynSymbols = -// g_SyntheticSymbolMap.find(moduleInfo); -// if (itSynSymbols != g_SyntheticSymbolMap.end()) -// { -// std::pair synSymbolsForModule( -// moduleInfo, itSynSymbols->second); -// DeleteSynSymbolsForModule(synSymbolsForModule); -// g_SyntheticSymbolMap.erase(itSynSymbols); -// } -// } -// 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" ); -// } -//} -// -/////////////////////////////////////////////////////////////////////////////////// -// -//ULONG delSyntheticSymbolForModuleNoLock( -// ULONG64 offset, -// const ModuleInfo &moduleInfo -//) -//{ -// SynSymbolsMap::iterator itSynSymbols = -// g_SyntheticSymbolMap.find(moduleInfo); -// if (itSynSymbols != g_SyntheticSymbolMap.end()) -// { -// offset = addr64(offset); -// SynSymbolsForModule::iterator itSynSymbol = -// itSynSymbols->second.find( offset ); -// if (itSynSymbol != itSynSymbols->second.end()) -// { -// ULONG nResult = -// RemoveSynSymbolsByAddress(moduleInfo.m_base + offset); -// itSynSymbols->second.erase(itSynSymbol); -// return nResult; -// } -// } -// return 0; -//} -// -/////////////////////////////////////////////////////////////////////////////////// -// -//ULONG delSyntheticSymbol( -// ULONG64 addr -//) -//{ -// try -// { -// // query module information -// addr = addr64(addr); -// ULONG64 ptrModuleBase; -// HRESULT hres = -// dbgExt->symbols->GetModuleByOffset(addr, 0, NULL, &ptrModuleBase); -// if ( SUCCEEDED(hres) ) -// { -// DEBUG_MODULE_PARAMETERS dbgModuleParameters; -// hres = -// dbgExt->symbols->GetModuleParameters( -// 1, -// &ptrModuleBase, -// 0, -// &dbgModuleParameters); -// if ( SUCCEEDED(hres) ) -// { -// _SynSymbolsMapScopedLockWrite(); -// -// ModuleInfo moduleInfo(dbgModuleParameters); -// return -// delSyntheticSymbolForModuleNoLock( -// addr - moduleInfo.m_base, -// moduleInfo); -// } -// } -// } -// 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 0; -//} -// -/////////////////////////////////////////////////////////////////////////////////// -// -//ULONG delSyntheticSymbolForModule( -// ULONG64 offset, -// const ModuleInfo &moduleInfo -//) -//{ -// try -// { -// _SynSymbolsMapScopedLockWrite(); -// return delSyntheticSymbolForModuleNoLock(offset, moduleInfo); -// } -// 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 0; -//} -// -/////////////////////////////////////////////////////////////////////////////////// -// -//// remove synthetic symbols from global map -//inline void RemoveSyntheticSymbolsFromMap( -// const std::vector &arrSymbols -//) -//{ -// for (ULONG i = 0; i < arrSymbols.size(); ++i) -// { -// DEBUG_SYMBOL_ENTRY dbgSymbolEntry; -// HRESULT hres = dbgExt->symbols3->GetSymbolEntryInformation( -// const_cast(&arrSymbols[i]), -// &dbgSymbolEntry); -// if (FAILED(hres)) -// continue; -// -// DEBUG_MODULE_PARAMETERS dbgModuleParameters; -// hres = dbgExt->symbols->GetModuleParameters( -// 1, -// &dbgSymbolEntry.ModuleBase, -// 0, -// &dbgModuleParameters); -// if (FAILED(hres)) -// continue; -// -// ModuleInfo moduleInfo(dbgModuleParameters); -// SynSymbolsMap::iterator itSynSymbols = -// g_SyntheticSymbolMap.find(moduleInfo); -// if (itSynSymbols != g_SyntheticSymbolMap.end()) -// { -// ULONG64 offset = dbgSymbolEntry.Offset - dbgSymbolEntry.ModuleBase; -// SynSymbolsForModule::iterator itSynSymbol = -// itSynSymbols->second.find( offset ); -// if (itSynSymbol != itSynSymbols->second.end()) -// itSynSymbols->second.erase(itSynSymbol); -// } -// } -//} -// -/////////////////////////////////////////////////////////////////////////////////// -// -//ULONG delSyntheticSymbolsMask( -// const std::string &moduleName, -// const std::string &symName -//) -//{ -// ULONG nResult = 0; -// -// try -// { -// std::string symMask = moduleName + "!" + symName; -// ULONG nEntries = 0; -// dbgExt->symbols3->GetSymbolEntriesByName( -// symMask.c_str(), -// 0, -// NULL, -// 0, -// &nEntries); -// if (nEntries) -// { -// std::vector arrSymbols(nEntries); -// HRESULT hres = dbgExt->symbols3->GetSymbolEntriesByName( -// symMask.c_str(), -// 0, -// &arrSymbols[0], -// (ULONG)arrSymbols.size(), -// NULL); -// if (FAILED(hres)) -// throw DbgException( "call IDebugSymbol3::GetSymbolEntriesByOffset(...) failed" ); -// -// { -// _SynSymbolsMapScopedLockWrite(); -// RemoveSyntheticSymbolsFromMap(arrSymbols); -// } -// -// return RemoveSyntheticSymbols(arrSymbols); -// } -// } -// 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 nResult; -//} -// -/////////////////////////////////////////////////////////////////////////////////// -// -//static void restoreSyntheticSymbolForModuleNoLock( -// const ModuleInfo &moduleInfo -//) -//{ -// SynSymbolsMap::const_iterator itSynSymbols = -// g_SyntheticSymbolMap.find( moduleInfo ); -// if (itSynSymbols != g_SyntheticSymbolMap.end()) -// { -// SynSymbolsForModule::const_iterator itSynSymbol = -// itSynSymbols->second.begin(); -// while (itSynSymbol != itSynSymbols->second.end()) -// { -// DEBUG_MODULE_AND_ID dbgModuleAndId; -// dbgExt->symbols3->AddSyntheticSymbol( -// moduleInfo.m_base + itSynSymbol->first, -// itSynSymbol->second.m_size, -// itSynSymbol->second.m_name.c_str(), -// DEBUG_ADDSYNTHSYM_DEFAULT, -// &dbgModuleAndId); -// -// ++itSynSymbol; -// } -// } -//} -// -/////////////////////////////////////////////////////////////////////////////////// -// -//void restoreSyntheticSymbolForModule( -// const ModuleInfo &moduleInfo -//) -//{ -// _SynSymbolsMapScopedLock(); -// -// // see (**1) -// restoreSyntheticSymbolForModuleNoLock(moduleInfo); -//} -// -/////////////////////////////////////////////////////////////////////////////////// -// -//void restoreSyntheticSymbolForAllModules() -//{ -// try -// { -// _SynSymbolsMapScopedLock(); -// -// if (g_SyntheticSymbolMap.empty()) -// return; -// -// ULONG nLoaded; -// ULONG nUnloaded; -// -// HRESULT hres = dbgExt->symbols3->GetNumberModules(&nLoaded, &nUnloaded); -// if (SUCCEEDED(hres) && (nLoaded || nUnloaded)) -// { -// std::vector arrModules(nLoaded + nUnloaded); -// hres = -// dbgExt->symbols3->GetModuleParameters( -// (ULONG)arrModules.size(), -// NULL, -// 0, -// &arrModules[0]); -// if (SUCCEEDED(hres)) -// { -// for (ULONG i = 0; i < arrModules.size(); ++i) -// { -// ModuleInfo moduleInfo(arrModules[i]); -// restoreSyntheticSymbolForModuleNoLock(moduleInfo); -// } -// } -// } -// } -// catch (...) -// { -// } -//} -// -/////////////////////////////////////////////////////////////////////////////////// diff --git a/pykd/dbgsynsym.h b/pykd/dbgsynsym.h deleted file mode 100644 index b2e9f49..0000000 --- a/pykd/dbgsynsym.h +++ /dev/null @@ -1,56 +0,0 @@ - -#pragma once - -/////////////////////////////////////////////////////////////////////////////////// -//// Global functions -// -//bool addSyntheticSymbol( -// ULONG64 addr, -// ULONG size, -// const std::string &symName -//); -// -//void delAllSyntheticSymbols(); -// -//ULONG delSyntheticSymbol( -// ULONG64 addr -//); -// -//ULONG delSyntheticSymbolsMask( -// const std::string &moduleName, -// const std::string &symName -//); -// -/////////////////////////////////////////////////////////////////////////////////// -//// Functions for dbgModuleClass -// -//ULONG64 getSyntheticSymbol( -// const ModuleInfo &moduleInfo, -// const std::string &symName -//); -// -//bool addSyntheticSymbolForModule( -// ULONG64 offset, -// ULONG size, -// const std::string &symName, -// const ModuleInfo &moduleInfo -//); -// -//ULONG delSyntheticSymbolForModule( -// ULONG64 offset, -// const ModuleInfo &moduleInfo -//); -// -//void delAllSyntheticSymbolsForModule( -// const ModuleInfo &moduleInfo -//); -// -/////////////////////////////////////////////////////////////////////////////////// -//// External callbacks -// -//void restoreSyntheticSymbolForModule( -// const ModuleInfo &moduleInfo ); -// -//void restoreSyntheticSymbolForAllModules(); -// -/////////////////////////////////////////////////////////////////////////////////// diff --git a/pykd/dbgsystem.cpp b/pykd/dbgsystem.cpp deleted file mode 100644 index ac17891..0000000 --- a/pykd/dbgsystem.cpp +++ /dev/null @@ -1,210 +0,0 @@ -#include "stdafx.h" - -//#include -//#include "dbgext.h" -//#include "dbgexcept.h" -//#include "dbgsystem.h" -//#include "dbgio.h" -// -///////////////////////////////////////////////////////////////////////////////////// -// -//bool -//is64bitSystem() -//{ -// HRESULT hres; -// -// try { -// -// hres = dbgExt->control->IsPointer64Bit(); -// -// return hres == S_OK; -// -// } -// 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; -//} -// -///////////////////////////////////////////////////////////////////////////////////// -// -//int -//ptrSize() -//{ -// return is64bitSystem() ? 8 : 4; -//} -// -///////////////////////////////////////////////////////////////////////////////////// -// -//std::string -//dbgSymPath() -//{ -// HRESULT hres; -// std::string pathStr; -// -// try { -// -// ULONG size; -// dbgExt->symbols->GetSymbolPath( NULL, 0, &size ); -// -// std::vector path(size); -// hres = dbgExt->symbols->GetSymbolPath( &path[0], size, NULL ); -// if ( FAILED( hres ) ) -// throw DbgException( "IDebugSymbols::GetSymbolPath failed" ); -// -// pathStr = &path[0]; -// -// } -// 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 pathStr; -//} -// -// -///////////////////////////////////////////////////////////////////////////////////// -// -//std::string -//getPdbFile( ULONG64 moduleBase ) -//{ -// HRESULT hres; -// -// try { -// -// -// IMAGEHLP_MODULEW64 imageHelpInfo = { 0 }; -// -// hres = -// dbgExt->advanced2->GetSymbolInformation( -// DEBUG_SYMINFO_IMAGEHLP_MODULEW64, -// moduleBase, -// 0, -// &imageHelpInfo, -// sizeof( imageHelpInfo ), -// NULL, -// NULL, -// 0, -// NULL ); -// -// char fileName[ 256 ]; -// WideCharToMultiByte( CP_ACP, 0, imageHelpInfo.LoadedPdbName, 256, fileName, 256, NULL, NULL ); -// -// return std::string( fileName ); -// -// } -// 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 std::string(); -//} -// -///////////////////////////////////////////////////////////////////////////////////// -// -//void -//reloadModule( const char * moduleName ) -//{ -// HRESULT hres; -// -// try { -// -// // подавить вывод сообщений об отсутствии символов -// OutputReader outputReader( dbgExt->client ); -// -// hres = dbgExt->symbols->Reload( moduleName ); -// -// //if ( FAILED( hres ) ) -// // throw DbgException( "IDebugSymbol::Reload failed" ); -// } -// 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" ); -// } -//} -// -///////////////////////////////////////////////////////////////////////////////////// -// -//bool -//isKernelDebugging() -//{ -// HRESULT hres; -// bool result = false; -// -// try { -// -// ULONG debugClass, debugQualifier; -// -// hres = dbgExt->control->GetDebuggeeType( &debugClass, &debugQualifier ); -// -// if ( FAILED( hres ) ) -// throw DbgException( "IDebugControl::GetDebuggeeType failed" ); -// -// result = debugClass == DEBUG_CLASS_KERNEL; -// -// } -// 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 result; -//} -// -///////////////////////////////////////////////////////////////////////////////////// -// -//bool -//isDumpAnalyzing() -//{ -// HRESULT hres; -// bool result = false; -// -// try { -// -// ULONG debugClass, debugQualifier; -// -// hres = dbgExt->control->GetDebuggeeType( &debugClass, &debugQualifier ); -// -// if ( FAILED( hres ) ) -// throw DbgException( "IDebugControl::GetDebuggeeType failed" ); -// -// result = debugQualifier >= DEBUG_DUMP_SMALL; -// -// } -// 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 result; -//} -// -///////////////////////////////////////////////////////////////////////////////////// diff --git a/pykd/dbgsystem.h b/pykd/dbgsystem.h deleted file mode 100644 index 41a0c27..0000000 --- a/pykd/dbgsystem.h +++ /dev/null @@ -1,31 +0,0 @@ -#pragma once - -//#include -// -/////////////////////////////////////////////////////////////////////////////////// -// -//bool -//is64bitSystem(); -// -//int -//ptrSize(); -// -//std::string -//dbgSymPath(); -// -//std::string -//getPdbFile( ULONG64 moduleBase ); -// -//std::string -//getImageFile( ULONG64 moduleBase ); -// -//void -//reloadModule( const char * moduleName ); -// -//bool -//isKernelDebugging(); -// -//bool -//isDumpAnalyzing(); -// -/////////////////////////////////////////////////////////////////////////////////// \ No newline at end of file diff --git a/pykd/dbgtype.cpp b/pykd/dbgtype.cpp deleted file mode 100644 index 280e3f0..0000000 --- a/pykd/dbgtype.cpp +++ /dev/null @@ -1,1113 +0,0 @@ -#include "stdafx.h" - -//#include -// -//#include -// -//#include "dbgext.h" -//#include "dbgtype.h" -//#include "dbgexcept.h" -//#include "dbgmem.h" -//#include "dbgsystem.h" -//#include "dbgmem.h" -// -//using namespace std; -// -///////////////////////////////////////////////////////////////////////////////////// -// -//TypeInfo::TypeInfoMap TypeInfo::g_typeInfoCache; -// -///////////////////////////////////////////////////////////////////////////////////// -// -//TypeInfo::TypeInfo( const std::string &moduleName, const std::string &typeName ) -// : m_align(0) -// , m_alignReq(1) -//{ -// HRESULT hres; -// bool baseType = checkBaseType(typeName); -// -// TypeInfoMap::iterator findIt = baseType ? -// g_typeInfoCache.find( std::make_pair("",typeName) ) : -// g_typeInfoCache.find( std::make_pair(moduleName,typeName) ); -// -// if ( findIt != g_typeInfoCache.end() ) -// { -// *this = findIt->second; -// return; -// } -// -// m_typeName = typeName; -// -// m_isPointer = false; -// m_isBaseType = false; -// m_isFreezed = true; -// m_parentOffset = 0; -// -// if ( !baseType ) -// m_moduleName = moduleName; -// -// do { -// -// if ( typeName.find("*") < typeName.size() ) -// { -// m_isPointer = true; -// m_size = ptrSize(); -// break; -// } -// -// if ( baseType ) -// { -// m_isBaseType = true; -// m_size = getBaseTypeSize( typeName ); -// break; -// } -// -// ULONG64 moduleBase = 0; -// hres = dbgExt->symbols->GetModuleByModuleName( moduleName.c_str(), 0, NULL, &moduleBase ); -// if ( FAILED( hres ) ) -// throw TypeException(); -// -// ULONG typeId = 0; -// hres = dbgExt->symbols->GetTypeId( moduleBase, m_typeName.c_str(), &typeId ); -// if ( FAILED( hres ) ) -// throw TypeException(); -// -// hres = dbgExt->symbols->GetTypeSize( moduleBase, typeId, &m_size ); -// if ( FAILED( hres ) ) -// throw TypeException(); -// -// for ( ULONG i = 0; ; ++i ) -// { -// char fieldName[100]; -// hres = dbgExt->symbols2->GetFieldName( moduleBase, typeId, i, fieldName, sizeof(fieldName), NULL ); -// if ( FAILED( hres ) ) -// break; -// -// ULONG fieldTypeId; -// ULONG fieldOffset; -// hres = dbgExt->symbols3->GetFieldTypeAndOffset( moduleBase, typeId, fieldName, &fieldTypeId, &fieldOffset ); -// -// if ( FAILED( hres ) ) -// throw TypeException(); -// -// ULONG fieldSize; -// hres = dbgExt->symbols->GetTypeSize( moduleBase, fieldTypeId, &fieldSize ); -// if ( FAILED( hres ) ) -// throw TypeException(); -// -// char fieldTypeName[100]; -// hres = dbgExt->symbols->GetTypeName( moduleBase, fieldTypeId, fieldTypeName, sizeof(fieldTypeName), NULL ); -// if ( FAILED( hres ) ) -// throw TypeException(); -// -// std::string fieldTypeNameStr( fieldTypeName ); -// -// if ( fieldTypeNameStr == "__unnamed" -// || fieldTypeNameStr.find("") < fieldTypeNameStr.size() ) -// { -// addField( fieldName, TypeInfo( moduleName, moduleBase, fieldTypeId ), fieldSize, fieldOffset ); -// } -// else -// { -// addField( fieldName, TypeInfo( moduleName, fieldTypeName ), fieldSize, fieldOffset ); -// } -// } -// -// } while( FALSE ); -// -// m_arraySize = m_size; -// -// g_typeInfoCache.insert( std::make_pair( std::make_pair( m_moduleName, m_typeName), *this) ); -//} -// -///////////////////////////////////////////////////////////////////////////////////// -// -//TypeInfo::TypeInfo( const std::string &moduleName, ULONG64 moduleBase, ULONG typeId ) -// : m_align(0) -// , m_alignReq(1) -//{ -// HRESULT hres; -// -// m_isPointer = false; -// m_isBaseType = false; -// m_isFreezed = true; -// m_parentOffset = 0; -// -// hres = dbgExt->symbols->GetTypeSize( moduleBase, typeId, &m_size ); -// if ( FAILED( hres ) ) -// throw TypeException(); -// -// for ( ULONG i = 0; ; ++i ) -// { -// char fieldName[100]; -// hres = dbgExt->symbols2->GetFieldName( moduleBase, typeId, i, fieldName, sizeof(fieldName), NULL ); -// if ( FAILED( hres ) ) -// break; -// -// ULONG fieldTypeId; -// ULONG fieldOffset; -// hres = dbgExt->symbols3->GetFieldTypeAndOffset( moduleBase, typeId, fieldName, &fieldTypeId, &fieldOffset ); -// -// if ( FAILED( hres ) ) -// throw TypeException(); -// -// ULONG fieldSize; -// hres = dbgExt->symbols->GetTypeSize( moduleBase, fieldTypeId, &fieldSize ); -// if ( FAILED( hres ) ) -// throw TypeException(); -// -// char fieldTypeName[100]; -// hres = dbgExt->symbols->GetTypeName( moduleBase, fieldTypeId, fieldTypeName, sizeof(fieldTypeName), NULL ); -// if ( FAILED( hres ) ) -// throw TypeException(); -// -// std::string fieldTypeNameStr( fieldTypeName ); -// -// if ( fieldTypeNameStr == "__unnamed" -// || fieldTypeNameStr.find("") < fieldTypeNameStr.size() ) -// { -// addField( fieldName, TypeInfo( moduleName, moduleBase, fieldTypeId ), fieldSize, fieldOffset ); -// } -// else -// { -// addField( fieldName, TypeInfo( moduleName, fieldTypeName ), fieldSize, fieldOffset ); -// } -// } -// -// m_arraySize = m_size; -//} -// -///////////////////////////////////////////////////////////////////////////////////// -// -//const TypeInfo& -//TypeInfo::get( const std::string &moduleName, const std::string &typeName ) -//{ -// TypeInfoMap::iterator findIt = g_typeInfoCache.find( std::make_pair(moduleName,typeName) ); -// -// if ( findIt != g_typeInfoCache.end() ) -// return findIt->second; -// -// TypeInfo type( moduleName, typeName ); -// -// return g_typeInfoCache.insert( std::make_pair( std::make_pair( moduleName, typeName), type) ).first->second; -//} -// -///////////////////////////////////////////////////////////////////////////////////// -// -//std::string -//TypeInfo::print() const -//{ -// std::stringstream sstream; -// -// if ( m_typeName.size() != 0 ) -// { -// if ( m_moduleName.size() != 0 ) -// sstream << m_moduleName << "!"; -// -// sstream << m_typeName; -// } -// else -// sstream << "unnamed"; -// -// if ( m_arraySize > m_size ) -// { -// sstream << " size = " << dec << m_arraySize << "(0x" << hex << m_arraySize << ") " << dec << "[" << m_arraySize/m_size << "]"; -// } -// else -// { -// sstream << " size = " << dec << m_size << "(0x" << hex << m_size << ")" << endl; -// } -// -// TypeFieldList::const_iterator it = m_fields.begin(); -// for(;it != m_fields.end(); ++it ) -// { -// sstream << "\t" << it->print() << std::endl; -// } -// -// return sstream.str(); -//} -// -///////////////////////////////////////////////////////////////////////////////////// -// -//TypeInfo -//TypeInfo::getField( const std::string &fieldName ) const -//{ -// TypeFieldList::const_iterator it = m_fields.begin(); -// for(;it != m_fields.end(); ++it ) -// { -// if ( it->name == fieldName ) -// { -// TypeInfo tinf = it->type; -// -// tinf.m_parentOffset = m_parentOffset + it->offset; -// tinf.m_arraySize = it->size; -// -// return tinf; -// } -// } -// -// throw TypeException(); -//} -// -///////////////////////////////////////////////////////////////////////////////////// -// -//TypeInfo -//TypeInfo::getFieldAt( size_t index ) const -//{ -// TypeInfo tinf = m_fields[index].type; -// -// tinf.m_parentOffset = m_parentOffset + m_fields[index].offset; -// tinf.m_arraySize = m_fields[index].size; -// -// return tinf; -//} -// -///////////////////////////////////////////////////////////////////////////////////// -// -//boost::python::object -//TypeInfo::getFieldByIndex( boost::python::object &obj ) const -//{ -// if ( PyInt_Check( obj.ptr() ) ) -// { -// long index = PyInt_AsLong(obj.ptr()); -// -// if ( index > (long)m_fields.size() ) -// throw IndexException(); -// -// if ( index < 0 ) -// { -// index = (long)m_fields.size() - abs(index); -// if ( index < 0 ) -// throw IndexException(); -// } -// -// TypeInfo tinf = m_fields[index].type; -// tinf.m_parentOffset = m_fields[index].offset; -// return boost::python::object( tinf ); -// } -// else -// { -// boost::python::slice sl( boost::python::detail::borrowed_reference( obj.ptr() ) ); -// -// boost::python::slice::range< TypeFieldList::const_iterator > bounds; -// -// bounds = sl.get_indicies( m_fields.begin(), m_fields.end() ); -// -// boost::python::list valList; -// -// do { -// -// TypeInfo tinf = bounds.start->type; -// tinf.m_parentOffset = bounds.start->offset; -// -// valList.append( tinf ); -// -// if ( bounds.start == bounds.stop) -// break; -// -// std::advance( bounds.start, bounds.step); -// -// } while( true ); -// -// return valList; -// } -// -// throw IndexException(); -// -// return boost::python::object(); -//} -// -///////////////////////////////////////////////////////////////////////////////////// -// -//void -//TypeInfo::appendField( const TypeInfo &typeInfo, const std::string &fieldName, ULONG count ) -//{ -// if ( m_isFreezed ) -// throw TypeException(); -// -// if ( count == 0 ) -// throw TypeException(); -// -// if ( count == 1 && typeInfo.m_typeName.find("[]") != std::string::npos ) -// throw TypeException(); -// -// TypeFieldList::const_iterator it = m_fields.begin(); -// for(;it != m_fields.end(); ++it ) -// { -// if ( it->name == fieldName ) -// throw TypeException(); -// } -// -// if ( count > 1 && typeInfo.m_typeName.find("[]") == std::string::npos ) -// { -// TypeInfo arrayInfo( typeInfo ); -// arrayInfo.m_typeName += "[]"; -// appendField( arrayInfo, fieldName, count ); -// return; -// } -// -// ULONG offset = m_size; -// offset += offset % ( m_align ? m_align : typeInfo.getAlignReq() ); -// -// const ULONG addSize = typeInfo.size() * count; -// addField( fieldName, typeInfo, addSize, offset ); -// m_size = offset + addSize; -// m_arraySize = offset + addSize; -//} -// -///////////////////////////////////////////////////////////////////////////////////// -// -//boost::python::object -//TypeInfo::loadVar( ULONG64 targetOffset, ULONG count ) const -//{ -// if ( count == 0 ) -// throw TypeException(); -// -// if ( count == 1 ) -// { -// boost::python::object obj( TypedVar( *this, targetOffset ) ); -// -// return obj; -// } -// else -// { -// boost::python::list lst; -// -// for( ULONG i = 0; i < count; ++i ) -// lst.append( TypedVar( *this, targetOffset + m_size*i ) ); -// -// return lst; -// } -//} -// -///////////////////////////////////////////////////////////////////////////////////// -// -//template< typename valType> -//boost::python::object -//valueLoader( void* address, size_t size ) -//{ -// if ( size == sizeof(valType) ) -// { -// valType v = *(valType*)address; -// -// return boost::python::object( v ); -// } -// else -// { -// boost::python::list arr; -// -// for ( unsigned int i = 0; i < size / sizeof(valType); ++i ) -// { -// valType v = *( (valType*)address + i ); -// arr.append( v ); -// } -// -// return arr; -// } -// -// throw TypeException(); -//} -// -//template<> -//boost::python::object -//valueLoader( void* address, size_t size ) -//{ -// if ( size == sizeof(char) ) -// { -// int v = *(char*)address; -// -// return boost::python::object( v ); -// } -// else -// { -// boost::python::list arr; -// -// for ( unsigned int i = 0; i < size / sizeof(char); ++i ) -// { -// int v = *( (char*)address + i ); -// arr.append( v ); -// } -// -// return arr; -// } -// -// throw TypeException(); -//} -// -// -//template<> -//boost::python::object -//valueLoader( void* address, size_t size ) -//{ -// -// if ( is64bitSystem() ) -// { -// if ( size == sizeof(ULONG64) ) -// { -// return boost::python::object( *(PULONG64)address ); -// } -// else -// { -// boost::python::list arr; -// -// for ( unsigned int i = 0; i < size / sizeof(ULONG64); ++i ) -// { -// ULONG64 v = *( (PULONG64)address + i ); -// arr.append( v ); -// } -// -// return arr; -// } -// } -// else -// { -// if ( size == sizeof(ULONG) ) -// { -// return boost::python::object( addr64( *(PULONG)address ) ); -// } -// else -// { -// boost::python::list arr; -// -// for ( unsigned int i = 0; i < size / sizeof(ULONG); ++i ) -// { -// ULONG64 v = addr64(*( (PULONG)address + i ) ); -// arr.append( v ); -// } -// -// return arr; -// } -// } -// -// throw TypeException(); -//} -// -//template<> -//boost::python::object -//valueLoader( void* address, size_t size ) -//{ -// return boost::python::object(); -//} -// -// -// -//template -//std::string -//valuePrinter( void* address, size_t size ) -//{ -// std::stringstream sstr; -// -// if ( size == sizeof(valType) ) -// { -// valType v = *(valType*)address; -// -// sstr << v << hex << " (0x" << v << ")"; -// } -// else -// { -// -// for ( unsigned int i = 0; i < size / sizeof(valType); ++i ) -// { -// valType v = *( (valType*)address + i ); -// sstr << endl << "\t[" << dec << i << "] " << dec << v << " (" << hex << v << ")"; -// } -// } -// -// return sstr.str(); -//} -// -//template<> -//std::string -//valuePrinter( void* address, size_t size ) -//{ -// if ( is64bitSystem() ) -// { -// return valuePrinter( address, size ); -// } -// -// return valuePrinter( address, size ); -//} -// -//template <> -//std::string -//valuePrinter( void* address, size_t size ) -//{ -// std::stringstream sstr; -// -// if ( size == sizeof(unsigned char) ) -// { -// unsigned int v = *(unsigned char*)address; -// -// sstr << v; -// } -// else -// { -// -// for ( unsigned int i = 0; i < size / sizeof(unsigned char); ++i ) -// { -// unsigned int v = *( (unsigned char*)address + i ); -// sstr << endl << "\t[" << dec << i << "] " << dec << v << " (" << hex << v << ")"; -// } -// } -// -// return sstr.str(); -//} -// -// -//template <> -//std::string -//valuePrinter( void* address, size_t size ) -//{ -// std::stringstream sstr; -// -// if ( size == sizeof(unsigned char) ) -// { -// int v = *(char*)address; -// -// sstr << v; -// } -// else -// { -// -// for ( unsigned int i = 0; i < size / sizeof(unsigned char); ++i ) -// { -// int v = *( (char*)address + i ); -// sstr << endl << "\t[" << dec << i << "] " << dec << v << " (" << hex << v << ")"; -// } -// } -// -// return sstr.str(); -//} -// -// -//template<> -//std::string -//valuePrinter( void* address, size_t size ) -//{ -// return ""; -//} -// -// -//const char* TypeInfo::basicTypeNames[] = { -// "unsigned char", -// "char", -// "unsigned short", -// "short", -// "unsigned long", -// "long", -// "int", -// "unsigned int", -// "", -// "void", -// "double", -// "int64", -// "unsigned int64", -// "ptr" -//}; -// -// -//size_t TypeInfo::basicTypeSizes[] = { -// sizeof( unsigned char ), -// sizeof( char ), -// sizeof( unsigned short ), -// sizeof( short ), -// sizeof( unsigned long ), -// sizeof( long ), -// sizeof( int ), -// sizeof( unsigned int ), -// sizeof( void* ), -// 0, -// sizeof( double ), -// sizeof( __int64 ), -// sizeof( unsigned __int64 ) -//}; -// -// -//TypeInfo::basicTypeLoader TypeInfo::basicTypeLoaders[] = { -// valueLoader, -// valueLoader, -// valueLoader, -// valueLoader, -// valueLoader, -// valueLoader, -// valueLoader, -// valueLoader, -// valueLoader, -// valueLoader, -// valueLoader, -// valueLoader<__int64>, -// valueLoader -// }; -// -//TypeInfo::basicTypePrinter TypeInfo::basicTypePrinters[] = { -// valuePrinter, -// valuePrinter, -// valuePrinter, -// valuePrinter, -// valuePrinter, -// valuePrinter, -// valuePrinter, -// valuePrinter, -// valuePrinter, -// valuePrinter, -// valuePrinter, -// valuePrinter<__int64>, -// valuePrinter -//}; -// -//bool -//TypeInfo::checkBaseType( const std::string &typeName ) -//{ -// for ( int i = 0; i < sizeof( basicTypeNames ) / sizeof( char* ); ++i ) -// { -// if ( typeName == basicTypeNames[i] ) -// return true; -// -// if ( typeName == ( std::string( basicTypeNames[i] ) + "*" ) ) -// return true; -// -// if ( typeName == ( std::string( basicTypeNames[i] ) + "[]" ) ) -// return true; -// -// if ( typeName == ( std::string( basicTypeNames[i] ) + "*[]" ) ) -// return true; -// } -// -// return false; -//} -// -///////////////////////////////////////////////////////////////////////////////////// -// -//ULONG -//TypeInfo::getBaseTypeSize( const std::string &typeName ) -//{ -// for ( int i = 0; i < sizeof( basicTypeSizes ) / sizeof( size_t ); ++i ) -// { -// if ( typeName == basicTypeNames[i] || -// typeName == ( std::string( basicTypeNames[i] ) + "[]" ) ) -// { -// return (ULONG)basicTypeSizes[i]; -// } -// } -// -// return 0; -//} -// -///////////////////////////////////////////////////////////////////////////////////// -// -//boost::python::object -//TypeInfo::load( void* buffer, size_t bufferLength ) const -//{ -// if ( bufferLength < m_size ) -// throw TypeException(); -// -// if ( m_isPointer ) -// { -// return valueLoader( buffer, bufferLength ); -// } -// -// if ( m_isBaseType ) -// { -// for ( int i = 0; i < sizeof( basicTypeNames ) / sizeof( char* ); ++i ) -// { -// if ( m_typeName == basicTypeNames[i] ) -// return basicTypeLoaders[i]( buffer, m_size ); -// -// if ( m_typeName == ( std::string( basicTypeNames[i] ) + "*" ) ) -// return valueLoader( buffer, ptrSize() ); -// -// if ( m_typeName == ( std::string( basicTypeNames[i] ) + "[]" ) ) -// return basicTypeLoaders[i]( buffer, m_arraySize ); -// -// if ( m_typeName == ( std::string( basicTypeNames[i] ) + "*[]" ) ) -// return valueLoader( buffer, ptrSize()*count() ); -// } -// } -// -// if ( isEnum() ) -// { -// return valueLoader( buffer, bufferLength ); -// } -// -// throw TypeException(); -//} -// -///////////////////////////////////////////////////////////////////////////////////// -// -//template<> -//std::string -//TypeInfo::TypeField::print() const -//{ -// std::stringstream sstr; -// -// sstr << hex << "+" << offset << " "; -// sstr << type.m_typeName << " "; -// sstr << name; -// -// return sstr.str(); -//} -// -///////////////////////////////////////////////////////////////////////////////////// -// -//std::string -//TypeInfo::printField( size_t index, void* buffer, size_t bufferLength ) const -//{ -// stringstream sstr; -// const TypeField &field = m_fields[index]; -// const TypeInfo &fieldType = field.type; -// ULONG offset = field.offset; -// ULONG count = field.size / fieldType.size(); -// -// if ( fieldType.m_isPointer ) -// { -// sstr << hex << "+" << offset; -// sstr << " " << field.name; -// sstr << " " << fieldType.name(); -// sstr << " " << hex << valuePrinter( (char*)buffer + offset, field.size ); -// sstr << endl; -// return sstr.str(); -// } -// -// if ( fieldType.m_isBaseType ) -// { -// for ( int i = 0; i < sizeof( basicTypeNames ) / sizeof( char* ); ++i ) -// { -// if ( fieldType.m_typeName == basicTypeNames[i] || -// fieldType.m_typeName == ( std::string( basicTypeNames[i] ) + "[]" ) ) -// { -// sstr << hex << "+" << offset; -// sstr << " " << field.name; -// sstr << " " << fieldType.name(); -// sstr << " " << basicTypePrinters[i]( (char*)buffer + offset, field.size ); -// sstr << endl; -// return sstr.str(); -// } -// } -// -// throw TypeException(); -// } -// -// if ( count == 1 ) -// { -// sstr << hex << "+" << offset; -// sstr << " " << field.name; -// sstr << " " << fieldType.name(); -// sstr << endl; -// } -// else -// { -// sstr << hex << "+" << offset; -// sstr << " " << field.name; -// sstr << " " << fieldType.name() << "[" << dec << count << "]"; -// sstr << endl; -// } -// -// return sstr.str(); -//} -// -///////////////////////////////////////////////////////////////////////////////////// -// -//TypedVar::TypedVar( ULONG64 targetOffset ) : -// m_targetOffset( addr64(targetOffset) ) -//{ -// HRESULT hres; -// -// ULONG typeId; -// ULONG64 module; -// hres = dbgExt->symbols->GetOffsetTypeId( m_targetOffset, &typeId, &module ); -// if ( FAILED( hres ) ) -// throw TypeException(); -// -// char moduleName[0x100]; -// hres = dbgExt->symbols2->GetModuleNameString( DEBUG_MODNAME_MODULE, DEBUG_ANY_ID, module, -// moduleName, sizeof( moduleName ), NULL ); -// if ( FAILED( hres ) ) -// throw TypeException(); -// -// m_typeInfo = TypeInfo( moduleName , addr64(module), typeId ); -//} -// -///////////////////////////////////////////////////////////////////////////////////// -// -//TypedVar::TypedVar( const std::string &symbolName ) -//{ -// HRESULT hres; -// -// ULONG typeId; -// ULONG64 module; -// hres = dbgExt->symbols->GetSymbolTypeId( symbolName.c_str(), &typeId, &module ); -// if ( FAILED( hres ) ) -// throw TypeException(); -// -// char moduleName[0x100]; -// hres = dbgExt->symbols2->GetModuleNameString( DEBUG_MODNAME_MODULE, DEBUG_ANY_ID, module, -// moduleName, sizeof( moduleName ), NULL ); -// if ( FAILED( hres ) ) -// throw TypeException(); -// -// m_typeInfo = TypeInfo( moduleName , addr64(module), typeId ); -//} -// -///////////////////////////////////////////////////////////////////////////////////// -// -//TypedVar::TypedVar( const TypeInfo &typeInfo, ULONG64 targetOffset, char* buffer, size_t bufferLength ) : -// m_typeInfo( typeInfo ), -// m_targetOffset( addr64(targetOffset) ) -//{ -// if ( bufferLength < typeInfo.size() ) -// throw TypeException(); -// -// m_buffer.insert( m_buffer.begin(), buffer, buffer + bufferLength ); -//} -// -///////////////////////////////////////////////////////////////////////////////////// -// -//boost::python::object -//TypedVar::getFieldWrap( PyObject* self, const std::string &fieldName ) -//{ -// boost::python::object pyobj( boost::python::handle<>( boost::python::borrowed(self) ) ); -// -// TypedVar &tv = boost::python::extract( pyobj ); -// -// return tv.getField( pyobj, fieldName ); -//} -// -//void TypedVar::reallocBuffer() -//{ -// const size_t fullSize = m_typeInfo.fullSize(); -// if (m_buffer.size() < fullSize) -// { -// assert(fullSize); -// m_buffer.resize( fullSize ); -// loadMemory( m_targetOffset, (PVOID)&m_buffer[0], (ULONG)m_buffer.size() ); -// } -//} -// -//boost::python::object -//TypedVar::getField( boost::python::object &pyobj, const std::string &fieldName ) -//{ -// reallocBuffer(); -// -// TypeInfo typeInfo = m_typeInfo.getField( fieldName ); -// -// // относительный оффсет -// ULONG offset = typeInfo.getFieldOffset() - m_typeInfo.getFieldOffset(); -// -// if ( typeInfo.isBaseType() || typeInfo.isPtr() || typeInfo.isEnum() ) -// { -// pyobj.attr(fieldName.c_str()) = typeInfo.load( &(m_buffer.begin() + offset)[0], typeInfo.fullSize() ); -// } -// else -// { -// if ( typeInfo.count() == 1 ) -// { -// if (m_buffer.size()) -// { -// pyobj.attr(fieldName.c_str()) = -// boost::python::object( -// TypedVar( -// typeInfo, -// m_targetOffset + offset, -// &m_buffer[0] + offset, -// typeInfo.size() ) ); -// } -// } -// else -// { -// boost::python::list arr; -// -// for ( unsigned int i = 0; i < typeInfo.count(); ++i ) -// { -// if (m_buffer.size()) -// { -// arr.append( -// boost::python::object( -// TypedVar( -// typeInfo, -// m_targetOffset + offset + i*typeInfo.size(), -// &m_buffer[0] + offset + i*typeInfo.size(), -// typeInfo.size() ) ) ); -// } -// } -// -// pyobj.attr(fieldName.c_str()) = arr; -// } -// } -// -// return pyobj.attr(fieldName.c_str()); -//} -// -/////////////////////////////////////////////////////////////////////////////////////// -// -//std::string -//TypedVar::data() -//{ -// reallocBuffer(); -// return std::string( getVectorBuffer(m_buffer), m_buffer.size() ); -//} -// -/////////////////////////////////////////////////////////////////////////////////////// -// -//std::string -//TypedVar::print() -//{ -// reallocBuffer(); -// -// stringstream sstr; -// -// if ( m_typeInfo.name().size() != 0 ) -// { -// if ( m_typeInfo.moduleName().size() ) -// sstr << m_typeInfo.moduleName() << "!"; -// -// sstr << m_typeInfo.name(); -// } -// else -// sstr << "unnamed"; -// -// sstr << " address = " << hex << "0x" << getTargetOffset(); -// sstr << " size = " << dec << m_typeInfo.fullSize() << " (0x" << hex << m_typeInfo.fullSize() << ")" << endl; -// -// -// for ( size_t i = 0; i < m_typeInfo.getFieldCount(); ++i ) -// { -// sstr << m_typeInfo.printField( i, (PVOID)getVectorBuffer(m_buffer), (ULONG)m_buffer.size() ); -// -// //TypeInfo fieldType = m_typeInfo.getFieldAt( i ); -// -// //// относительный оффсет -// //ULONG offset = fieldType.getFieldOffset() - m_typeInfo.getFieldOffset(); -// -// //if ( fieldType.isBaseType() || fieldType.isPtr() ) -// //{ -// // sstr << hex << "+" << offset << " " << fieldType.name(); -// // sstr << fieldType.printValue( &(m_buffer.begin() + offset)[0], fieldType.fullSize() ); -// //} -// //else -// //{ -// // if ( fieldType.count() == 1 ) -// // { -// // sstr << hex << "+" << offset << " " << fieldType.name() << endl; -// // } -// // else -// // { -// // sstr << hex << "+" << offset << " " << fieldType.name() << "[" << dec << "]" << endl; -// // } -// //} -// } -// -// return sstr.str(); -//} -// -/////////////////////////////////////////////////////////////////////////////////////// -// -//ULONG TypeInfo::getAlignReq() const -//{ -// if (isBaseType()) -// return size(); -// -// if (isPtr()) -// return ptrSize(); -// -// return m_alignReq; -//} -// -/////////////////////////////////////////////////////////////////////////////////////// -// -//void TypeInfo::addField( -// const std::string &name_, -// const TypeInfo &type_, -// ULONG size_, -// ULONG offset_ -//) -//{ -// m_alignReq = max(m_alignReq, type_.getAlignReq()); -// m_fields.push_back( TypeField( name_, type_, size_, offset_ ) ); -//} -// -/////////////////////////////////////////////////////////////////////////////////////// -// -//ULONG -//sizeofType( const std::string &moduleName, const std::string &typeName ) -//{ -// return TypeInfo::get( moduleName, typeName ).size(); -//} -// -///////////////////////////////////////////////////////////////////////////////////// -// -//boost::python::object -//containingRecord( ULONG64 address, const std::string &moduleName, const std::string &typeName, const std::string &fieldName ) -//{ -// address = addr64(address); -// -// HRESULT hres; -// ULONG64 moduleBase; -// -// hres = dbgExt->symbols->GetModuleByModuleName( moduleName.c_str(), 0, NULL, &moduleBase ); -// if ( FAILED( hres ) ) -// throw TypeException(); -// -// ULONG typeId; -// hres = dbgExt->symbols->GetTypeId( moduleBase, typeName.c_str(), &typeId ); -// if ( FAILED( hres ) ) -// throw TypeException(); -// -// ULONG fieldTypeId; -// ULONG fieldOffset; -// hres = dbgExt->symbols3->GetFieldTypeAndOffset( moduleBase, typeId, fieldName.c_str(), &fieldTypeId, &fieldOffset ); -// if ( FAILED( hres ) ) -// throw TypeException(); -// -// TypedVar var( moduleName, typeName, address - fieldOffset ); -// -// return boost::python::object( var ); -//} -// -///////////////////////////////////////////////////////////////////////////////////// -// -//boost::python::object -//loadTypedVarList( ULONG64 address, const std::string &moduleName, const std::string &typeName, const std::string &listEntryName ) -//{ -// address = addr64(address); -// -// ULONG64 entryAddress = 0; -// -// const TypeInfo &typeInfo = TypeInfo::get( moduleName, typeName ); -// -// boost::python::list objList; -// -// -// TypeInfo fieldType = typeInfo.getField( listEntryName ); -// -// if ( fieldType.name() == ( typeName + "*" ) ) -// { -// for( entryAddress = loadPtrByPtr( address ); entryAddress != address && entryAddress != NULL; entryAddress = loadPtrByPtr( entryAddress + fieldType.getFieldOffset() ) ) -// objList.append( TypedVar( moduleName, typeName, entryAddress ) ); -// } -// else -// { -// for( entryAddress = loadPtrByPtr( address ); entryAddress != address && entryAddress != NULL; entryAddress = loadPtrByPtr( entryAddress ) ) -// objList.append( containingRecord( entryAddress, moduleName, typeName, listEntryName ) ); -// } -// -// return objList; -//} -// -/////////////////////////////////////////////////////////////////////////////////// -// -//boost::python::object -//loadTypedVarArray( ULONG64 address, const std::string &moduleName, const std::string &typeName, long number ) -//{ -// address = addr64(address); -// -// const TypeInfo &typeInfo = TypeInfo::get( moduleName, typeName ); -// -// boost::python::list objList; -// -// for( long i = 0; i < number; ++i ) -// objList.append( TypedVar(typeInfo, address + i * typeInfo.size() ) ); -// -// return objList; -//} -// -/////////////////////////////////////////////////////////////////////////////////// diff --git a/pykd/dbgtype.h b/pykd/dbgtype.h deleted file mode 100644 index 3af00ab..0000000 --- a/pykd/dbgtype.h +++ /dev/null @@ -1,295 +0,0 @@ -#pragma once - -//#include -//#include -// -//#include "dbgmem.h" -//#include "dbgsystem.h" -// -//#include -// -///////////////////////////////////////////////////////////////////////////////////// -// -//class TypedVar; -//class TypeInfo; -// -///////////////////////////////////////////////////////////////////////////////////// -// -//class TypeInfo { -// -//public: -// -// TypeInfo() : -// m_size(0), -// m_arraySize( 0 ), -// m_parentOffset( 0 ), -// m_align( 0 ), -// m_isFreezed( false ), -// m_isBaseType( false ), -// m_isPointer( false ), -// m_alignReq(1) -// {} -// -// TypeInfo( const std::string customName, ULONG align = 0) : -// m_typeName( customName ), -// m_size( 0 ), -// m_arraySize( 0 ), -// m_parentOffset( 0 ), -// m_isFreezed( false ), -// m_align( align ), -// m_isBaseType( false ), -// m_isPointer( false ), -// m_alignReq(1) -// {} -// -// TypeInfo( const std::string &moduleName, const std::string &typeName ); -// -// TypeInfo( const std::string &moduleName, ULONG64 moduleBase, ULONG typeId ); -// -// static -// const TypeInfo& -// get( const std::string &moduleName, const std::string &typeName ); -// -// ULONG -// size() const { -// return m_size; -// } -// -// ULONG -// count() const { -// assert( m_size != 0 && m_arraySize >= m_size ); -// return m_arraySize / m_size; -// } -// -// ULONG -// fullSize() const { -// return m_arraySize; -// } -// -// const std::string -// name() const { -// return m_typeName; -// } -// -// const std::string -// moduleName() const { -// return m_moduleName; -// } -// -// boost::python::object -// load( void* buffer, size_t bufferLength ) const; -// -// std::string -// printField( size_t index, void* buffer, size_t bufferLength ) const; -// -// std::string -// print() const; -// -// TypeInfo -// getField( const std::string &fieldName ) const; -// -// TypeInfo -// getFieldAt( size_t index ) const; -// -// ULONG -// getFieldOffset() const { -// return m_parentOffset; -// } -// -// boost::python::object -// getFieldByIndex( boost::python::object &index ) const; -// -// size_t -// getFieldCount() const { -// return m_fields.size(); -// } -// -// void -// appendField( const TypeInfo &typeInfo, const std::string &fieldName, ULONG count = 1 ); -// -// bool -// isBaseType() const { -// return m_isBaseType; -// } -// -// bool -// isPtr() const { -// return m_isPointer; -// } -// -// bool -// isEnum() const { -// return !m_isBaseType && !m_isPointer && m_fields.size() == 0 && m_size == 4; -// } -// -// boost::python::object -// loadVar( ULONG64 targetOffset, ULONG count = 1) const; -// -// void setAlignReq(ULONG alignReq) { -// m_alignReq = alignReq; -// } -// -//public: -// -// typedef std::map< std::pair, TypeInfo> TypeInfoMap; -// -// template< typename TTypeInfo> -// struct TypeFieldT { -// -// std::string name; -// -// ULONG offset; -// -// ULONG size; -// -// TTypeInfo type; -// -// TypeFieldT( const std::string &name_, const TTypeInfo &type_, ULONG size_, ULONG offset_ ) : -// name( name_ ), -// size( size_ ), -// offset( offset_ ), -// type( type_ ) -// {} -// -// std::string print() const; -// }; -// -// typedef TypeFieldT TypeField; -// -// typedef std::vector TypeFieldList; -// -//private: -// -// ULONG getAlignReq() const; -// -// void addField( -// const std::string &name_, -// const TypeInfo &type_, -// ULONG size_, -// ULONG offset_ -// ); -// -// typedef -// boost::python::object -// (*basicTypeLoader)( void* address, size_t size ); -// -// typedef -// std::string -// (*basicTypePrinter)( void* address, size_t size ); -// -// static TypeInfoMap g_typeInfoCache; -// -// static const char* basicTypeNames[]; -// -// static size_t basicTypeSizes[]; -// -// static basicTypeLoader basicTypeLoaders[]; -// -// static basicTypePrinter basicTypePrinters[]; -// -// ULONG m_size; -// -// ULONG m_arraySize; -// -// std::string m_typeName; -// -// std::string m_moduleName; -// -// TypeFieldList m_fields; -// -// bool m_isPointer; -// -// bool m_isBaseType; -// -// bool m_isFreezed; -// -// ULONG m_align; -// -// ULONG m_alignReq; -// -// ULONG m_parentOffset; -// -// static bool checkBaseType( const std::string &typeName ); -// -// static ULONG getBaseTypeSize( const std::string &typeName ); -//}; -// -// -///////////////////////////////////////////////////////////////////////////////////// -// -//class TypedVar { -// -//public: -// -// TypedVar() : -// m_targetOffset ( 0 ) -// {} -// -// TypedVar( const TypeInfo &typeInfo, ULONG64 targetOffset ) : -// m_typeInfo( typeInfo ), -// m_targetOffset( addr64(targetOffset) ) -// {} -// -// TypedVar( const std::string &moduleName, const std::string &typeName, ULONG64 targetOffset ) : -// m_typeInfo( moduleName, typeName ), -// m_targetOffset( addr64(targetOffset) ) -// {} -// -// TypedVar( ULONG64 targetOffset ); -// -// TypedVar( const std::string &symbolName ); -// -// ULONG64 -// getAddress() const { -// return m_targetOffset; -// } -// -// ULONG -// getSize() const { -// return m_typeInfo.fullSize(); -// } -// -// static -// boost::python::object -// getFieldWrap( PyObject* self, const std::string &fieldName ); -// -// boost::python::object -// getField( boost::python::object &pyobj, const std::string &fieldName ); -// -// ULONG64 getTargetOffset() const { -// return m_targetOffset; -// } -// -// std::string data(); -// -// std::string print(); -// -//private: -// -// void reallocBuffer(); -// -// TypedVar( const TypeInfo &typeInfo, ULONG64 targetOffset, char* buffer, size_t bufferLength ); -// -// ULONG64 m_targetOffset; -// -// TypeInfo m_typeInfo; -// -// std::vector m_buffer; -//}; -// -///////////////////////////////////////////////////////////////////////////////////// -// -//boost::python::object -//loadTypedVarList( ULONG64 address, const std::string &moduleName, const std::string &typeName, const std::string &listEntryName ); -// -//boost::python::object -//loadTypedVarArray( ULONG64 address, const std::string &moduleName, const std::string &typeName, long number ); -// -//boost::python::object -//containingRecord( ULONG64 address, const std::string &moduleName, const std::string &typeName, const std::string &fieldName ); -// -//ULONG -//sizeofType( const std::string &moduleName, const std::string &typeName ); -// -///////////////////////////////////////////////////////////////////////////////////// -// diff --git a/pykd/disasm.cpp b/pykd/disasm.cpp deleted file mode 100644 index 51b2679..0000000 --- a/pykd/disasm.cpp +++ /dev/null @@ -1,49 +0,0 @@ -#include "stdafx.h" -//#include "dbgext.h" -//#include "disasm.h" -//#include "dbgexcept.h" -//#include "dbgmem.h" -// -/////////////////////////////////////////////////////////////////////////////////// -// -//void disasm::doDisasm() -//{ -// HRESULT hres; -// char buffer[0x100]; -// ULONG disasmSize = 0; -// ULONG64 offset = addr64(m_currentOffset); -// ULONG64 endOffset = 0; -// -// if ( m_beginOffset == 0 ) -// { -// ULONG64 currentOffset = 0; -// -// hres = dbgExt->registers->GetInstructionOffset( ¤tOffset ); -// if ( FAILED( hres ) ) -// throw DbgException( "IDebugRegisters::GetInstructionOffset failed" ); -// -// offset += currentOffset; -// } -// -// hres = -// dbgExt->control->Disassemble( -// offset, -// DEBUG_DISASM_EFFECTIVE_ADDRESS, -// buffer, -// sizeof(buffer), -// &disasmSize, -// &endOffset ); -// -// if ( FAILED( hres ) ) -// throw DbgException( "IDebugControl::Disassemble failed" ); -// -// hres = dbgExt->control->GetDisassembleEffectiveOffset( &m_ea ); -// if ( FAILED( hres ) ) -// m_ea = 0; -// -// m_length = (ULONG)(endOffset - offset); -// -// m_disasm = std::string( buffer, disasmSize - 2); -//} -// -/////////////////////////////////////////////////////////////////////////////////// \ No newline at end of file diff --git a/pykd/disasm.h b/pykd/disasm.h deleted file mode 100644 index 6b78285..0000000 --- a/pykd/disasm.h +++ /dev/null @@ -1,54 +0,0 @@ -#pragma once - -/////////////////////////////////////////////////////////////////////////////////// -// -//class disasm { -// -//public: -// -// disasm( ULONG64 offset = 0) : -// m_beginOffset( offset ), -// m_currentOffset( offset ) { -// doDisasm(); -// } -// -// std::string next() { -// m_currentOffset += m_length; -// doDisasm(); -// return m_disasm; -// } -// -// -// std::string instruction() const { -// return m_disasm; -// } -// -// ULONG64 begin() const { -// return m_beginOffset; -// } -// -// ULONG64 current() const { -// return m_currentOffset; -// } -// -// ULONG length() const { -// return m_length; -// } -// -// ULONG64 ea() const { -// return m_ea; -// } -// -//private: -// -// void doDisasm(); -// -// ULONG64 m_beginOffset; -// ULONG64 m_currentOffset; -// ULONG64 m_ea; -// ULONG m_length; -// -// std::string m_disasm; -//}; -// -/////////////////////////////////////////////////////////////////////////////////// diff --git a/pykd/pyaux.h b/pykd/pyaux.h deleted file mode 100644 index 1fb5987..0000000 --- a/pykd/pyaux.h +++ /dev/null @@ -1,57 +0,0 @@ -#pragma once - -///////////////////////////////////////////////////////////////////////////////// -// -//typedef PyThreadState *PyThreadStatePtr; -//extern __declspec( thread ) PyThreadStatePtr ptrPyThreadState; -// -//// --> call back -//// { PyThread_StateSave state( winext->getThreadState() ); -//// do_callback(); -//// } -//// -//// Если колбек был вызван и при этом у текщего потока сохранен контекст ( был вызов setExecutionStatus ) -//// то перед выполнением питоновского кода нужно восстановить контекст, а после возврата управления, -//// снова сохранить его -// -//class PyThread_StateSave { -// -//public: -// -// PyThread_StateSave() -// : m_bRestored(false) -// { -// if (ptrPyThreadState) -// { -// PyEval_RestoreThread( ptrPyThreadState ); -// m_bRestored = true; -// } -// } -// -// ~PyThread_StateSave() { -// if ( m_bRestored ) -// ptrPyThreadState = PyEval_SaveThread(); -// } -// -//private: -// bool m_bRestored; -//}; -// -//// { PyThread_StateRestore state; -//// long_or_block_opreration(); -//// } -// -//class PyThread_StateRestore -//{ -//public: -// -// PyThread_StateRestore() { -// ptrPyThreadState = PyEval_SaveThread(); -// } -// -// ~PyThread_StateRestore() { -// PyEval_RestoreThread( ptrPyThreadState ); -// } -//}; -// -///////////////////////////////////////////////////////////////////////////////// \ No newline at end of file diff --git a/pykd/pykd_2008.vcproj b/pykd/pykd_2008.vcproj index d72a7b8..7435307 100644 --- a/pykd/pykd_2008.vcproj +++ b/pykd/pykd_2008.vcproj @@ -451,6 +451,10 @@ RelativePath=".\diawrapper.h" > + +