mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-29 11:53:23 +08:00
[pykd] added: cpuReg class based on intBase
[pykd] updated: debugEvent class git-svn-id: https://pykd.svn.codeplex.com/svn@68108 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
parent
2bc8e5760f
commit
679b315aac
@ -1,112 +1,265 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
// Load/Unload module events
|
//// Load/Unload module events
|
||||||
/////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include <memory>
|
|
||||||
#include <dbgeng.h>
|
|
||||||
|
|
||||||
#include "dbgmodule.h"
|
|
||||||
#include "dbgio.h"
|
|
||||||
#include "dbgevent.h"
|
#include "dbgevent.h"
|
||||||
|
#include "dbgio.h"
|
||||||
|
#include "dbgexcept.h"
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
debugEvent::modCallbacksColl debugEvent::modCallbacks;
|
|
||||||
debugEvent::modCallbacksLock debugEvent::modCallbacksMtx;
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
debugEvent::debugEvent()
|
debugEvent::debugEvent()
|
||||||
{
|
{
|
||||||
modCallbacksScopedLock lock(modCallbacksMtx);
|
HRESULT hres;
|
||||||
modCallbacks.insert(this);
|
|
||||||
|
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()
|
debugEvent::~debugEvent()
|
||||||
{
|
{
|
||||||
modCallbacksScopedLock lock(modCallbacksMtx);
|
m_debugClient->SetEventCallbacks( NULL );
|
||||||
modCallbacks.erase(this);
|
|
||||||
|
m_debugClient->Release();
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
ULONG debugEvent::moduleLoaded(__in ULONG64 addr)
|
HRESULT debugEvent::GetInterestMask(
|
||||||
|
__out PULONG Mask
|
||||||
|
)
|
||||||
{
|
{
|
||||||
modCallbacksScopedLock lock(modCallbacksMtx);
|
*Mask = 0;
|
||||||
if (modCallbacks.empty())
|
|
||||||
return DEBUG_STATUS_NO_CHANGE;
|
|
||||||
|
|
||||||
ULONG64 moduleBase;
|
*Mask |= DEBUG_EVENT_LOAD_MODULE;
|
||||||
ULONG moduleSize;
|
*Mask |= DEBUG_EVENT_UNLOAD_MODULE;
|
||||||
std::string moduleName;
|
*Mask |= DEBUG_EVENT_SESSION_STATUS;
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
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<OutputReader> silentMode( new OutputReader(dbgExt->client) );
|
std::auto_ptr<OutputReader> silentMode( new OutputReader(dbgExt->client) );
|
||||||
queryModuleParams(addr, moduleName, moduleBase, moduleSize);
|
|
||||||
|
ULONG64 moduleBase;
|
||||||
|
ULONG moduleSize;
|
||||||
|
std::string moduleName;
|
||||||
|
|
||||||
|
queryModuleParams(BaseOffset, moduleName, moduleBase, moduleSize);
|
||||||
dbgModuleClass module(moduleName, moduleBase, moduleSize);
|
dbgModuleClass module(moduleName, moduleBase, moduleSize);
|
||||||
silentMode.reset();
|
silentMode.reset();
|
||||||
|
|
||||||
modCallbacksColl::iterator itCallback = modCallbacks.begin();
|
return onLoadModule( module );
|
||||||
while (itCallback != modCallbacks.end())
|
|
||||||
{
|
|
||||||
const ULONG retValue = (*itCallback)->onLoadModule(module);
|
|
||||||
if (DEBUG_STATUS_NO_CHANGE != retValue)
|
|
||||||
return retValue;
|
|
||||||
|
|
||||||
++itCallback;
|
|
||||||
}
|
|
||||||
return DEBUG_STATUS_NO_CHANGE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
ULONG debugEvent::moduleUnloaded(__in ULONG64 addr)
|
HRESULT debugEvent::UnloadModule(
|
||||||
|
__in PCSTR ImageBaseName,
|
||||||
|
__in ULONG64 BaseOffset
|
||||||
|
)
|
||||||
{
|
{
|
||||||
modCallbacksScopedLock lock(modCallbacksMtx);
|
|
||||||
if (modCallbacks.empty())
|
|
||||||
return DEBUG_STATUS_NO_CHANGE;
|
|
||||||
|
|
||||||
ULONG64 moduleBase;
|
|
||||||
ULONG moduleSize;
|
|
||||||
std::string moduleName;
|
|
||||||
|
|
||||||
std::auto_ptr<OutputReader> silentMode( new OutputReader(dbgExt->client) );
|
std::auto_ptr<OutputReader> silentMode( new OutputReader(dbgExt->client) );
|
||||||
queryModuleParams(addr, moduleName, moduleBase, moduleSize);
|
|
||||||
|
ULONG64 moduleBase;
|
||||||
|
ULONG moduleSize;
|
||||||
|
std::string moduleName;
|
||||||
|
|
||||||
|
queryModuleParams(BaseOffset, moduleName, moduleBase, moduleSize);
|
||||||
dbgModuleClass module(moduleName, moduleBase, moduleSize);
|
dbgModuleClass module(moduleName, moduleBase, moduleSize);
|
||||||
silentMode.reset();
|
silentMode.reset();
|
||||||
|
|
||||||
modCallbacksColl::iterator itCallback = modCallbacks.begin();
|
return onUnloadModule( module );
|
||||||
while (itCallback != modCallbacks.end())
|
|
||||||
{
|
|
||||||
const ULONG retValue = (*itCallback)->onUnloadModule(module);
|
|
||||||
if (DEBUG_STATUS_NO_CHANGE != retValue)
|
|
||||||
return retValue;
|
|
||||||
|
|
||||||
++itCallback;
|
|
||||||
}
|
|
||||||
return DEBUG_STATUS_NO_CHANGE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
ULONG debugEventWrap::onLoadModule(const dbgModuleClass &module)
|
HRESULT debugEvent::SessionStatus(
|
||||||
|
__in ULONG Status
|
||||||
|
)
|
||||||
{
|
{
|
||||||
if (boost::python::override override = get_override("onLoadModule"))
|
return onChangeSessionStatus( Status );
|
||||||
return override(module);
|
|
||||||
|
|
||||||
return debugEvent::onLoadModule(module);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
ULONG debugEventWrap::onUnloadModule(const dbgModuleClass &module)
|
HRESULT debugEvent::ChangeDebuggeeState(
|
||||||
|
__in ULONG Flags,
|
||||||
|
__in ULONG64 Argument
|
||||||
|
)
|
||||||
{
|
{
|
||||||
if (boost::python::override override = get_override("onUnloadModule"))
|
return onChangeDebugeeState();
|
||||||
return override(module);
|
|
||||||
|
|
||||||
return debugEvent::onUnloadModule(module);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// STDMETHOD(GetInterestMask)(
|
||||||
|
// __out PULONG Mask
|
||||||
|
// );
|
||||||
|
//
|
||||||
|
// 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
|
||||||
|
// );
|
||||||
|
//
|
||||||
|
//public:
|
||||||
|
//
|
||||||
|
// ULONG onLoadModule(const dbgModuleClass &module);
|
||||||
|
//
|
||||||
|
// ULONG onUnloadModule(const dbgModuleClass &module);
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//#include <memory>
|
||||||
|
//#include <dbgeng.h>
|
||||||
|
//
|
||||||
|
//#include "dbgmodule.h"
|
||||||
|
//#include "dbgio.h"
|
||||||
|
//#include "dbgevent.h"
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
//debugEvent::modCallbacksColl debugEvent::modCallbacks;
|
||||||
|
//debugEvent::modCallbacksLock debugEvent::modCallbacksMtx;
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
//debugEvent::debugEvent()
|
||||||
|
//{
|
||||||
|
// modCallbacksScopedLock lock(modCallbacksMtx);
|
||||||
|
// modCallbacks.insert(this);
|
||||||
|
//}
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
//debugEvent::~debugEvent()
|
||||||
|
//{
|
||||||
|
// modCallbacksScopedLock lock(modCallbacksMtx);
|
||||||
|
// modCallbacks.erase(this);
|
||||||
|
//}
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
//ULONG debugEvent::moduleLoaded(__in ULONG64 addr)
|
||||||
|
//{
|
||||||
|
// modCallbacksScopedLock lock(modCallbacksMtx);
|
||||||
|
// if (modCallbacks.empty())
|
||||||
|
// return DEBUG_STATUS_NO_CHANGE;
|
||||||
|
//
|
||||||
|
// ULONG64 moduleBase;
|
||||||
|
// ULONG moduleSize;
|
||||||
|
// std::string moduleName;
|
||||||
|
//
|
||||||
|
// std::auto_ptr<OutputReader> silentMode( new OutputReader(dbgExt->client) );
|
||||||
|
// queryModuleParams(addr, moduleName, moduleBase, moduleSize);
|
||||||
|
// dbgModuleClass module(moduleName, moduleBase, moduleSize);
|
||||||
|
// silentMode.reset();
|
||||||
|
//
|
||||||
|
// modCallbacksColl::iterator itCallback = modCallbacks.begin();
|
||||||
|
// while (itCallback != modCallbacks.end())
|
||||||
|
// {
|
||||||
|
// const ULONG retValue = (*itCallback)->onLoadModule(module);
|
||||||
|
// if (DEBUG_STATUS_NO_CHANGE != retValue)
|
||||||
|
// return retValue;
|
||||||
|
//
|
||||||
|
// ++itCallback;
|
||||||
|
// }
|
||||||
|
// return DEBUG_STATUS_NO_CHANGE;
|
||||||
|
//}
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
//ULONG debugEvent::moduleUnloaded(__in ULONG64 addr)
|
||||||
|
//{
|
||||||
|
// modCallbacksScopedLock lock(modCallbacksMtx);
|
||||||
|
// if (modCallbacks.empty())
|
||||||
|
// return DEBUG_STATUS_NO_CHANGE;
|
||||||
|
//
|
||||||
|
// ULONG64 moduleBase;
|
||||||
|
// ULONG moduleSize;
|
||||||
|
// std::string moduleName;
|
||||||
|
//
|
||||||
|
// std::auto_ptr<OutputReader> silentMode( new OutputReader(dbgExt->client) );
|
||||||
|
// queryModuleParams(addr, moduleName, moduleBase, moduleSize);
|
||||||
|
// dbgModuleClass module(moduleName, moduleBase, moduleSize);
|
||||||
|
// silentMode.reset();
|
||||||
|
//
|
||||||
|
// modCallbacksColl::iterator itCallback = modCallbacks.begin();
|
||||||
|
// while (itCallback != modCallbacks.end())
|
||||||
|
// {
|
||||||
|
// const ULONG retValue = (*itCallback)->onUnloadModule(module);
|
||||||
|
// if (DEBUG_STATUS_NO_CHANGE != retValue)
|
||||||
|
// return retValue;
|
||||||
|
//
|
||||||
|
// ++itCallback;
|
||||||
|
// }
|
||||||
|
// return DEBUG_STATUS_NO_CHANGE;
|
||||||
|
//}
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
//ULONG debugEvent::sessionStatus(__in ULONG status )
|
||||||
|
//{
|
||||||
|
//
|
||||||
|
//}
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
//ULONG debugEventWrap::onLoadModule(const dbgModuleClass &module)
|
||||||
|
//{
|
||||||
|
// if (boost::python::override override = get_override("onLoadModule"))
|
||||||
|
// return override(module);
|
||||||
|
//
|
||||||
|
// return debugEvent::onLoadModule(module);
|
||||||
|
//}
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
//ULONG debugEventWrap::onUnloadModule(const dbgModuleClass &module)
|
||||||
|
//{
|
||||||
|
// if (boost::python::override override = get_override("onUnloadModule"))
|
||||||
|
// return override(module);
|
||||||
|
//
|
||||||
|
// return debugEvent::onUnloadModule(module);
|
||||||
|
//}
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
187
pykd/dbgevent.h
187
pykd/dbgevent.h
@ -1,54 +1,169 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
// Load/Unload module events
|
// user-customizing debug event handler
|
||||||
/////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include <set>
|
#include "dbgeventcb.h"
|
||||||
|
#include "dbgmodule.h"
|
||||||
|
|
||||||
#include <boost/interprocess/sync/interprocess_recursive_mutex.hpp>
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
#include <boost/interprocess/sync/scoped_lock.hpp>
|
|
||||||
|
|
||||||
interface debugEvent
|
class debugEvent : public DebugBaseEventCallbacks
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
debugEvent();
|
debugEvent();
|
||||||
|
|
||||||
virtual ~debugEvent();
|
virtual ~debugEvent();
|
||||||
|
|
||||||
virtual ULONG onLoadModule(const dbgModuleClass &/* module */)
|
virtual ULONG onLoadModule(const dbgModuleClass &/* module */) = 0;
|
||||||
{
|
|
||||||
return DEBUG_STATUS_NO_CHANGE;
|
|
||||||
}
|
|
||||||
virtual ULONG onUnloadModule(const dbgModuleClass &/* module */)
|
|
||||||
{
|
|
||||||
return DEBUG_STATUS_NO_CHANGE;
|
|
||||||
}
|
|
||||||
|
|
||||||
// call from debug engine
|
|
||||||
static ULONG moduleLoaded(__in ULONG64 addr);
|
|
||||||
static ULONG moduleUnloaded(__in ULONG64 addr);
|
|
||||||
|
|
||||||
|
virtual ULONG onUnloadModule(const dbgModuleClass &/* module */) = 0;
|
||||||
|
|
||||||
|
virtual ULONG onChangeSessionStatus( ULONG status ) = 0;
|
||||||
|
|
||||||
|
virtual ULONG onChangeDebugeeState() = 0;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
typedef std::set<debugEvent *> modCallbacksColl;
|
STDMETHOD_(ULONG, AddRef)() { return 1; }
|
||||||
static modCallbacksColl modCallbacks;
|
STDMETHOD_(ULONG, Release)() { return 1; }
|
||||||
|
|
||||||
typedef boost::interprocess::interprocess_recursive_mutex modCallbacksLock;
|
STDMETHOD(GetInterestMask)(
|
||||||
static modCallbacksLock modCallbacksMtx;
|
__out PULONG Mask
|
||||||
typedef boost::interprocess::scoped_lock<modCallbacksLock> modCallbacksScopedLock;
|
);
|
||||||
};
|
|
||||||
|
STDMETHOD(LoadModule)(
|
||||||
|
__in ULONG64 ImageFileHandle,
|
||||||
|
__in ULONG64 BaseOffset,
|
||||||
|
__in ULONG ModuleSize,
|
||||||
|
__in PCSTR ModuleName,
|
||||||
|
__in PCSTR ImageName,
|
||||||
|
__in ULONG CheckSum,
|
||||||
|
__in ULONG TimeDateStamp
|
||||||
|
);
|
||||||
|
|
||||||
// python wrapper for debugEvent
|
STDMETHOD(UnloadModule)(
|
||||||
struct debugEventWrap : debugEvent, boost::python::wrapper<debugEvent>
|
__in PCSTR ImageBaseName,
|
||||||
{
|
__in ULONG64 BaseOffset
|
||||||
ULONG onLoadModule(const dbgModuleClass &module);
|
);
|
||||||
ULONG onLoadModuleDef(const dbgModuleClass &module)
|
|
||||||
{
|
STDMETHOD(SessionStatus)(
|
||||||
return debugEvent::onLoadModule(module);
|
__in ULONG Status
|
||||||
}
|
);
|
||||||
|
|
||||||
|
STDMETHOD(ChangeDebuggeeState)(
|
||||||
|
__in ULONG Flags,
|
||||||
|
__in ULONG64 Argument );
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
ULONG onUnloadModule(const dbgModuleClass &module);
|
IDebugClient *m_debugClient;
|
||||||
ULONG onUnloadModuleDef(const dbgModuleClass &module)
|
|
||||||
{
|
|
||||||
return debugEvent::onUnloadModule(module);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
class debugEventWrap : public boost::python::wrapper<debugEvent>, public debugEvent
|
||||||
|
{
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
|
||||||
|
ULONG onLoadModule(const dbgModuleClass &module) {
|
||||||
|
return handler<const dbgModuleClass &>("onLoadModule", module );
|
||||||
|
}
|
||||||
|
|
||||||
|
ULONG onUnloadModule(const dbgModuleClass &module) {
|
||||||
|
return handler<const dbgModuleClass &>("onUnloadModule", module );
|
||||||
|
}
|
||||||
|
|
||||||
|
ULONG onChangeSessionStatus( ULONG status ) {
|
||||||
|
return handler( "onChangeSessionStatus", status );
|
||||||
|
}
|
||||||
|
|
||||||
|
ULONG onChangeDebugeeState() {
|
||||||
|
return handler( "onChangeDebugeeState" );
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
template<typename Arg1Type>
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
//#include <set>
|
||||||
|
//
|
||||||
|
//#include <boost/interprocess/sync/interprocess_recursive_mutex.hpp>
|
||||||
|
//#include <boost/interprocess/sync/scoped_lock.hpp>
|
||||||
|
//
|
||||||
|
//class debugEvent
|
||||||
|
//{
|
||||||
|
// debugEvent();
|
||||||
|
// virtual ~debugEvent();
|
||||||
|
//
|
||||||
|
// virtual ULONG onLoadModule(const dbgModuleClass &/* module */)
|
||||||
|
// {
|
||||||
|
// return DEBUG_STATUS_NO_CHANGE;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// virtual ULONG onUnloadModule(const dbgModuleClass &/* module */)
|
||||||
|
// {
|
||||||
|
// return DEBUG_STATUS_NO_CHANGE;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// virtual ULONG onChangeSessionState( ULONG state )
|
||||||
|
// {
|
||||||
|
// return DEBUG_STATUS_NO_CHANGE;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// // call from debug engine
|
||||||
|
// static ULONG moduleLoaded(__in ULONG64 addr);
|
||||||
|
// static ULONG moduleUnloaded(__in ULONG64 addr);
|
||||||
|
// static ULONG sessionStatus(__in ULONG status );
|
||||||
|
//
|
||||||
|
//private:
|
||||||
|
//
|
||||||
|
// typedef std::set<debugEvent *> modCallbacksColl;
|
||||||
|
// static modCallbacksColl modCallbacks;
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// //typedef boost::interprocess::interprocess_recursive_mutex modCallbacksLock;
|
||||||
|
// //static modCallbacksLock modCallbacksMtx;
|
||||||
|
// //typedef boost::interprocess::scoped_lock<modCallbacksLock> modCallbacksScopedLock;
|
||||||
|
//};
|
||||||
|
//
|
||||||
|
//// python wrapper for debugEvent
|
||||||
|
//struct debugEventWrap : debugEvent, boost::python::wrapper<debugEvent>
|
||||||
|
//{
|
||||||
|
// ULONG onLoadModule(const dbgModuleClass &module);
|
||||||
|
// ULONG onLoadModuleDef(const dbgModuleClass &module)
|
||||||
|
// {
|
||||||
|
// return debugEvent::onLoadModule(module);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// ULONG onUnloadModule(const dbgModuleClass &module);
|
||||||
|
// ULONG onUnloadModuleDef(const dbgModuleClass &module)
|
||||||
|
// {
|
||||||
|
// return debugEvent::onUnloadModule(module);
|
||||||
|
// }
|
||||||
|
//};
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -13,26 +13,14 @@
|
|||||||
|
|
||||||
DbgEventCallbacksManager::DbgEventCallbacksManager( IDebugClient *client )
|
DbgEventCallbacksManager::DbgEventCallbacksManager( IDebugClient *client )
|
||||||
{
|
{
|
||||||
|
m_debugClient = client;
|
||||||
|
m_debugClient->AddRef();
|
||||||
|
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
m_debugClient = client;
|
hres = m_debugClient->SetEventCallbacks(this);
|
||||||
m_debugClient->AddRef();
|
if (FAILED(hres))
|
||||||
|
throw DbgException( "IDebugClient::SetEventCallbacks" );
|
||||||
hres = m_debugClient->SetEventCallbacks(this);
|
|
||||||
if (FAILED(hres))
|
|
||||||
throw DbgException( "IDebugClient::SetEventCallbacks" );
|
|
||||||
|
|
||||||
}
|
|
||||||
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" );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
@ -46,6 +34,7 @@ DbgEventCallbacksManager::~DbgEventCallbacksManager()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
HRESULT DbgEventCallbacksManager::GetInterestMask(
|
HRESULT DbgEventCallbacksManager::GetInterestMask(
|
||||||
@ -54,9 +43,9 @@ HRESULT DbgEventCallbacksManager::GetInterestMask(
|
|||||||
{
|
{
|
||||||
*Mask =
|
*Mask =
|
||||||
DEBUG_EVENT_CHANGE_SYMBOL_STATE |
|
DEBUG_EVENT_CHANGE_SYMBOL_STATE |
|
||||||
DEBUG_EVENT_BREAKPOINT |
|
DEBUG_EVENT_BREAKPOINT;
|
||||||
DEBUG_EVENT_LOAD_MODULE |
|
// DEBUG_EVENT_LOAD_MODULE |
|
||||||
DEBUG_EVENT_UNLOAD_MODULE;
|
// DEBUG_EVENT_UNLOAD_MODULE
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,7 +82,7 @@ HRESULT DbgEventCallbacksManager::ChangeSymbolState(
|
|||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
return S_OK;
|
return DEBUG_STATUS_NO_CHANGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
@ -106,42 +95,59 @@ HRESULT DbgEventCallbacksManager::Breakpoint(
|
|||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
HRESULT DbgEventCallbacksManager::LoadModule(
|
//HRESULT DbgEventCallbacksManager::LoadModule(
|
||||||
__in ULONG64 ImageFileHandle,
|
// __in ULONG64 ImageFileHandle,
|
||||||
__in ULONG64 BaseOffset,
|
// __in ULONG64 BaseOffset,
|
||||||
__in ULONG ModuleSize,
|
// __in ULONG ModuleSize,
|
||||||
__in PCSTR ModuleName,
|
// __in PCSTR ModuleName,
|
||||||
__in PCSTR ImageName,
|
// __in PCSTR ImageName,
|
||||||
__in ULONG CheckSum,
|
// __in ULONG CheckSum,
|
||||||
__in ULONG TimeDateStamp
|
// __in ULONG TimeDateStamp
|
||||||
)
|
//)
|
||||||
{
|
//{
|
||||||
try
|
// try
|
||||||
{
|
// {
|
||||||
return debugEvent::moduleLoaded(BaseOffset);
|
// return debugEvent::moduleLoaded(BaseOffset);
|
||||||
}
|
// }
|
||||||
catch (std::exception &)
|
// catch (std::exception &)
|
||||||
{
|
// {
|
||||||
}
|
// }
|
||||||
return DEBUG_STATUS_NO_CHANGE;
|
// return DEBUG_STATUS_NO_CHANGE;
|
||||||
}
|
//}
|
||||||
|
//
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
HRESULT DbgEventCallbacksManager::UnloadModule(
|
//HRESULT DbgEventCallbacksManager::UnloadModule(
|
||||||
__in PCSTR ImageBaseName,
|
// __in PCSTR ImageBaseName,
|
||||||
__in ULONG64 BaseOffset
|
// __in ULONG64 BaseOffset
|
||||||
)
|
//)
|
||||||
{
|
//{
|
||||||
try
|
// try
|
||||||
{
|
// {
|
||||||
return debugEvent::moduleUnloaded(BaseOffset);
|
// return debugEvent::moduleUnloaded(BaseOffset);
|
||||||
}
|
// }
|
||||||
catch (std::exception &)
|
// catch (std::exception &)
|
||||||
{
|
// {
|
||||||
}
|
// }
|
||||||
return DEBUG_STATUS_NO_CHANGE;
|
// return DEBUG_STATUS_NO_CHANGE;
|
||||||
}
|
//}
|
||||||
|
//
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
//HRESULT DbgEventCallbacksManager::SessionStatus(
|
||||||
|
// __in ULONG status
|
||||||
|
//)
|
||||||
|
//{
|
||||||
|
// try
|
||||||
|
// {
|
||||||
|
// return debugEvent::sessionStatus( status );
|
||||||
|
// }
|
||||||
|
// catch( std::exception& )
|
||||||
|
// {
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// return DEBUG_STATUS_NO_CHANGE;
|
||||||
|
//}
|
||||||
|
//
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <dbgeng.h>
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// monitoring and processing debug events
|
// monitoring and processing debug events
|
||||||
@ -11,7 +13,7 @@ public:
|
|||||||
DbgEventCallbacksManager( IDebugClient *client = NULL );
|
DbgEventCallbacksManager( IDebugClient *client = NULL );
|
||||||
|
|
||||||
virtual ~DbgEventCallbacksManager();
|
virtual ~DbgEventCallbacksManager();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
@ -36,7 +38,7 @@ private:
|
|||||||
__in PDEBUG_BREAKPOINT Bp
|
__in PDEBUG_BREAKPOINT Bp
|
||||||
);
|
);
|
||||||
|
|
||||||
STDMETHOD(LoadModule)(
|
/* STDMETHOD(LoadModule)(
|
||||||
__in ULONG64 ImageFileHandle,
|
__in ULONG64 ImageFileHandle,
|
||||||
__in ULONG64 BaseOffset,
|
__in ULONG64 BaseOffset,
|
||||||
__in ULONG ModuleSize,
|
__in ULONG ModuleSize,
|
||||||
@ -50,6 +52,10 @@ private:
|
|||||||
__in PCSTR ImageBaseName,
|
__in PCSTR ImageBaseName,
|
||||||
__in ULONG64 BaseOffset
|
__in ULONG64 BaseOffset
|
||||||
);
|
);
|
||||||
|
|
||||||
|
STDMETHOD(SessionStatus)(
|
||||||
|
__in ULONG status
|
||||||
|
); */
|
||||||
|
|
||||||
private:
|
private:
|
||||||
IDebugClient *m_debugClient;
|
IDebugClient *m_debugClient;
|
||||||
|
107
pykd/dbgext.cpp
107
pykd/dbgext.cpp
@ -27,6 +27,7 @@
|
|||||||
#include "dbgevent.h"
|
#include "dbgevent.h"
|
||||||
#include "dbgbreak.h"
|
#include "dbgbreak.h"
|
||||||
#include "dbgio.h"
|
#include "dbgio.h"
|
||||||
|
#include "intbase.h"
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
@ -211,6 +212,7 @@ BOOST_PYTHON_MODULE( pykd )
|
|||||||
boost::python::def( "delSynSymbolsMask", &delSyntheticSymbolsMask,
|
boost::python::def( "delSynSymbolsMask", &delSyntheticSymbolsMask,
|
||||||
"Delete synthetic symbols by mask of module and symbol name");
|
"Delete synthetic symbols by mask of module and symbol name");
|
||||||
|
|
||||||
|
|
||||||
boost::python::class_<TypeInfo>( "typeInfo",
|
boost::python::class_<TypeInfo>( "typeInfo",
|
||||||
"Class representing non-primitive type info: structure, union, etc. attributes is a fields of non-primitive type" )
|
"Class representing non-primitive type info: structure, union, etc. attributes is a fields of non-primitive type" )
|
||||||
.def(boost::python::init<std::string,std::string>( boost::python::args("module", "type"), "constructor" ) )
|
.def(boost::python::init<std::string,std::string>( boost::python::args("module", "type"), "constructor" ) )
|
||||||
@ -258,7 +260,7 @@ BOOST_PYTHON_MODULE( pykd )
|
|||||||
.def("data", &TypedVar::data,
|
.def("data", &TypedVar::data,
|
||||||
"Return raw string object with data stream" )
|
"Return raw string object with data stream" )
|
||||||
.def("__getattr__", &TypedVar::getFieldWrap,
|
.def("__getattr__", &TypedVar::getFieldWrap,
|
||||||
"Return field of structure as a object attribute" )
|
"Return field of structure as an object attribute" )
|
||||||
.def("__str__", &TypedVar::print,
|
.def("__str__", &TypedVar::print,
|
||||||
"Return a nice string represention: print names and offsets of fields" );
|
"Return a nice string represention: print names and offsets of fields" );
|
||||||
|
|
||||||
@ -337,10 +339,10 @@ BOOST_PYTHON_MODULE( pykd )
|
|||||||
|
|
||||||
boost::python::class_<debugEventWrap, boost::noncopyable>( "debugEvent",
|
boost::python::class_<debugEventWrap, boost::noncopyable>( "debugEvent",
|
||||||
"Base class for debug events handlers" )
|
"Base class for debug events handlers" )
|
||||||
.def( "onLoadModule", &debugEvent::onLoadModule, &debugEventWrap::onLoadModuleDef,
|
.def( "onLoadModule", &debugEventWrap::onLoadModule,
|
||||||
"Load module event. Parameter is instance of dbgModuleClass. "
|
"Load module event. Parameter is instance of dbgModuleClass. "
|
||||||
"For ignore event method must return DEBUG_STATUS_NO_CHANGE value" )
|
"For ignore event method must return DEBUG_STATUS_NO_CHANGE value" )
|
||||||
.def( "onUnloadModule", &debugEvent::onUnloadModule, &debugEventWrap::onUnloadModuleDef,
|
.def( "onUnloadModule", &debugEventWrap::onUnloadModule,
|
||||||
"Unload module event. Parameter is instance of dbgModuleClass. "
|
"Unload module event. Parameter is instance of dbgModuleClass. "
|
||||||
"For ignore event method must return DEBUG_STATUS_NO_CHANGE value" );
|
"For ignore event method must return DEBUG_STATUS_NO_CHANGE value" );
|
||||||
|
|
||||||
@ -376,7 +378,103 @@ BOOST_PYTHON_MODULE( pykd )
|
|||||||
boost::python::register_exception_translator<TypeException>( &TypeException::exceptionTranslate );
|
boost::python::register_exception_translator<TypeException>( &TypeException::exceptionTranslate );
|
||||||
boost::python::register_exception_translator<IndexException>( &IndexException::translate);
|
boost::python::register_exception_translator<IndexException>( &IndexException::translate);
|
||||||
boost::python::register_exception_translator<MemoryException>( &MemoryException::translate );
|
boost::python::register_exception_translator<MemoryException>( &MemoryException::translate );
|
||||||
|
|
||||||
|
boost::python::class_<intBase>(
|
||||||
|
"intBase",
|
||||||
|
"intBase")
|
||||||
|
.def( boost::python::init<>() )
|
||||||
|
.def( boost::python::init<ULONG64>( boost::python::args("value"), "constructor" ) )
|
||||||
|
|
||||||
|
.def( "value", &intBase::value )
|
||||||
|
.def( int_( boost::python::self ) )
|
||||||
|
//.def( boost::python::self = long() )
|
||||||
|
|
||||||
|
.def( boost::python::self + long() )
|
||||||
|
.def( long() + boost::python::self )
|
||||||
|
.def( boost::python::self += long() )
|
||||||
|
.def( boost::python::self + boost::python::self )
|
||||||
|
.def( boost::python::self += boost::python::self )
|
||||||
|
|
||||||
|
.def( boost::python::self - long() )
|
||||||
|
.def( long() - boost::python::self )
|
||||||
|
.def( boost::python::self -= long() )
|
||||||
|
.def( boost::python::self - boost::python::self )
|
||||||
|
.def( boost::python::self -= boost::python::self )
|
||||||
|
|
||||||
|
.def( boost::python::self * long() )
|
||||||
|
.def( long() * boost::python::self )
|
||||||
|
.def( boost::python::self *= long() )
|
||||||
|
.def( boost::python::self * boost::python::self )
|
||||||
|
.def( boost::python::self *= boost::python::self )
|
||||||
|
|
||||||
|
.def( boost::python::self / long() )
|
||||||
|
.def( long() / boost::python::self )
|
||||||
|
.def( boost::python::self /= long() )
|
||||||
|
.def( boost::python::self / boost::python::self )
|
||||||
|
.def( boost::python::self /= boost::python::self )
|
||||||
|
|
||||||
|
.def( boost::python::self % long() )
|
||||||
|
.def( long() % boost::python::self )
|
||||||
|
.def( boost::python::self %= long() )
|
||||||
|
.def( boost::python::self % boost::python::self )
|
||||||
|
.def( boost::python::self %= boost::python::self )
|
||||||
|
|
||||||
|
.def( boost::python::self & long() )
|
||||||
|
.def( long() & boost::python::self )
|
||||||
|
.def( boost::python::self &= long() )
|
||||||
|
.def( boost::python::self & boost::python::self )
|
||||||
|
.def( boost::python::self &= boost::python::self )
|
||||||
|
|
||||||
|
.def( boost::python::self | long() )
|
||||||
|
.def( long() | boost::python::self )
|
||||||
|
.def( boost::python::self |= long() )
|
||||||
|
.def( boost::python::self | boost::python::self )
|
||||||
|
.def( boost::python::self |= boost::python::self )
|
||||||
|
|
||||||
|
.def( boost::python::self ^ long() )
|
||||||
|
.def( long() ^ boost::python::self )
|
||||||
|
.def( boost::python::self ^= long() )
|
||||||
|
.def( boost::python::self ^ boost::python::self )
|
||||||
|
.def( boost::python::self ^= boost::python::self )
|
||||||
|
|
||||||
|
.def( boost::python::self << long() )
|
||||||
|
.def( boost::python::self <<= long() )
|
||||||
|
|
||||||
|
.def( boost::python::self >> long() )
|
||||||
|
.def( boost::python::self >>= long() )
|
||||||
|
|
||||||
|
.def( boost::python::self < long() )
|
||||||
|
.def( boost::python::self < boost::python::self )
|
||||||
|
|
||||||
|
.def( boost::python::self <= long() )
|
||||||
|
.def( boost::python::self <= boost::python::self )
|
||||||
|
|
||||||
|
.def( boost::python::self == long() )
|
||||||
|
.def( boost::python::self == boost::python::self )
|
||||||
|
|
||||||
|
.def( boost::python::self >= long() )
|
||||||
|
.def( boost::python::self >= boost::python::self )
|
||||||
|
|
||||||
|
.def( boost::python::self > long() )
|
||||||
|
.def( boost::python::self > boost::python::self )
|
||||||
|
|
||||||
|
.def( boost::python::self != long() )
|
||||||
|
.def( boost::python::self != boost::python::self )
|
||||||
|
|
||||||
|
.def( ~boost::python::self )
|
||||||
|
.def( !boost::python::self )
|
||||||
|
|
||||||
|
.def( "__str__", &intBase::str )
|
||||||
|
.def( "__hex__", &intBase::hex );
|
||||||
|
|
||||||
|
boost::python::class_<cpuReg, boost::python::bases<intBase> >(
|
||||||
|
"cpuReg",
|
||||||
|
"CPU regsiter class",
|
||||||
|
boost::python::no_init )
|
||||||
|
.def( boost::python::init<std::string>(boost::python::args("name"), "constructor" ) )
|
||||||
|
.def( "name", &cpuReg::name, "The name of the regsiter" )
|
||||||
|
.def( "beLive", &cpuReg::beLive, "Turn the object to live: its value will be following thr target register value" );
|
||||||
|
|
||||||
|
|
||||||
// debug status
|
// debug status
|
||||||
DEF_PY_CONST(DEBUG_STATUS_NO_CHANGE);
|
DEF_PY_CONST(DEBUG_STATUS_NO_CHANGE);
|
||||||
@ -636,6 +734,9 @@ DbgExt::~DbgExt()
|
|||||||
if ( client4 )
|
if ( client4 )
|
||||||
client4->Release();
|
client4->Release();
|
||||||
|
|
||||||
|
if ( client5 )
|
||||||
|
client5->Release();
|
||||||
|
|
||||||
if ( control )
|
if ( control )
|
||||||
control->Release();
|
control->Release();
|
||||||
|
|
||||||
|
@ -8,6 +8,52 @@ using namespace std;
|
|||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
cpuReg::cpuReg( std::string regName )
|
||||||
|
{
|
||||||
|
m_name = regName;
|
||||||
|
m_lived = false;
|
||||||
|
|
||||||
|
reloadValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void cpuReg::reloadValue() const
|
||||||
|
{
|
||||||
|
HRESULT hres;
|
||||||
|
ULONG registerIndex = 0;
|
||||||
|
|
||||||
|
hres = dbgExt->registers->GetIndexByName( m_name.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:
|
||||||
|
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
|
boost::python::object
|
||||||
loadRegister( const std::string ®isterName )
|
loadRegister( const std::string ®isterName )
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,43 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <list>
|
||||||
|
|
||||||
|
#include "intbase.h"
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
class cpuReg : public intBase {
|
||||||
|
|
||||||
|
public :
|
||||||
|
|
||||||
|
cpuReg( std::string regName );
|
||||||
|
|
||||||
|
std::string
|
||||||
|
name() const {
|
||||||
|
return m_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
void beLive() {
|
||||||
|
m_lived = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
ULONG64 value() const
|
||||||
|
{
|
||||||
|
if ( m_lived )
|
||||||
|
reloadValue();
|
||||||
|
|
||||||
|
return intBase::value();
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
void reloadValue() const;
|
||||||
|
|
||||||
|
std::string m_name;
|
||||||
|
|
||||||
|
bool m_lived;
|
||||||
|
};
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
300
pykd/dbgtype.h
300
pykd/dbgtype.h
@ -267,303 +267,3 @@ sizeofType( const std::string &moduleName, const std::string &typeName );
|
|||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//public:
|
|
||||||
//
|
|
||||||
// typedVarClass() : m_addr(0)
|
|
||||||
// {}
|
|
||||||
//
|
|
||||||
// typedVarClass( const TypeInfo &typeInfo, ULONG64 addr) :
|
|
||||||
// m_typeInfo( typeInfo ),
|
|
||||||
// m_addr( addr )
|
|
||||||
// {}
|
|
||||||
//
|
|
||||||
// ULONG64
|
|
||||||
// getAddress() const {
|
|
||||||
// return m_addr;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// //virtual void
|
|
||||||
// //printField( const TypeInfo::TypeField &field, std::stringstream &sstr ) const override;
|
|
||||||
//
|
|
||||||
// //virtual void
|
|
||||||
// //printSelf( std::stringstream &sstr ) const override
|
|
||||||
// //{
|
|
||||||
// // sstr << std::hex << "0x" << getAddress() << std::dec << " ";
|
|
||||||
// //}
|
|
||||||
//
|
|
||||||
//private:
|
|
||||||
//
|
|
||||||
// TypeInfo m_typeInfo;
|
|
||||||
//
|
|
||||||
// ULONG64 m_addr;
|
|
||||||
//};
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
//boost::python::object
|
|
||||||
//loadTypedVar( const std::string &moduleName, const std::string &typeName, ULONG64 address );
|
|
||||||
//
|
|
||||||
//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 );
|
|
||||||
//
|
|
||||||
//boost::python::object
|
|
||||||
//getTypeClass( const std::string &moduleName, const std::string &typeName );
|
|
||||||
//
|
|
||||||
//ULONG
|
|
||||||
//sizeofType( const std::string &moduleName, const std::string &typeName );
|
|
||||||
//
|
|
||||||
//
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
//class TypeInfo {
|
|
||||||
//
|
|
||||||
//public:
|
|
||||||
//
|
|
||||||
// template< typename TTypeInfo>
|
|
||||||
// struct TypeFieldT {
|
|
||||||
// ULONG size;
|
|
||||||
// ULONG offset;
|
|
||||||
// TTypeInfo type;
|
|
||||||
// std::string name;
|
|
||||||
//
|
|
||||||
// TypeFieldT( const std::string &name_, const TTypeInfo &type_, ULONG size_, ULONG offset_ ) :
|
|
||||||
// name( name_ ),
|
|
||||||
// size( size_ ),
|
|
||||||
// offset( offset_ ),
|
|
||||||
// type( type_ )
|
|
||||||
// {}
|
|
||||||
// };
|
|
||||||
//
|
|
||||||
// struct TypeName {
|
|
||||||
// std::string module;
|
|
||||||
// std::string symbol;
|
|
||||||
//
|
|
||||||
// TypeName( const std::string &module_, const std::string &symbol_ ) :
|
|
||||||
// module( module_ ),
|
|
||||||
// symbol( symbol_ )
|
|
||||||
// {}
|
|
||||||
//
|
|
||||||
// bool
|
|
||||||
// operator < ( const TypeName &typeName ) const {
|
|
||||||
//
|
|
||||||
// if ( typeName.module < module )
|
|
||||||
// return true;
|
|
||||||
//
|
|
||||||
// if ( typeName.module > module )
|
|
||||||
// return false;
|
|
||||||
//
|
|
||||||
// return typeName.symbol < symbol;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// };
|
|
||||||
//
|
|
||||||
// typedef TypeFieldT<TypeInfo> TypeField;
|
|
||||||
//
|
|
||||||
// typedef std::map<TypeName, TypeInfo> TypeInfoMap;
|
|
||||||
//
|
|
||||||
// typedef std::list<TypeField> TypeFieldList;
|
|
||||||
//
|
|
||||||
//public:
|
|
||||||
//
|
|
||||||
// TypeInfo() :
|
|
||||||
// m_size( 0 ),
|
|
||||||
// m_baseType( false ),
|
|
||||||
// m_pointer( false )
|
|
||||||
// {}
|
|
||||||
//
|
|
||||||
// TypeInfo( const std::string &typeName ) :
|
|
||||||
// m_size( 0 ),
|
|
||||||
// m_baseType( false ),
|
|
||||||
// m_pointer( false ),
|
|
||||||
// m_typeName( typeName )
|
|
||||||
// {}
|
|
||||||
//
|
|
||||||
// boost::python::object
|
|
||||||
// load( ULONG64 targetAddr, PVOID cacheBuffer = NULL, ULONG offset = 0 ) const;
|
|
||||||
//
|
|
||||||
// boost::python::object
|
|
||||||
// build( ULONG offset = 0 ) const;
|
|
||||||
//
|
|
||||||
// ULONG64
|
|
||||||
// size() const
|
|
||||||
// {
|
|
||||||
// return m_size;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// const std::string&
|
|
||||||
// name() const
|
|
||||||
// {
|
|
||||||
// return m_typeName;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// const TypeFieldList&
|
|
||||||
// getFields() const {
|
|
||||||
// return m_fields;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// bool
|
|
||||||
// isComplex() const {
|
|
||||||
// return !m_baseType;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// bool
|
|
||||||
// isPtr() const {
|
|
||||||
// return m_pointer;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// static const TypeInfo*
|
|
||||||
// get( const std::string &moduleName, const std::string &typeName );
|
|
||||||
//
|
|
||||||
//private:
|
|
||||||
//
|
|
||||||
// static TypeInfoMap g_typeInfoCache;
|
|
||||||
//
|
|
||||||
// boost::python::object
|
|
||||||
// loadBaseType( PVOID addr ) const;
|
|
||||||
//
|
|
||||||
// boost::python::object
|
|
||||||
// ptrLoader( PVOID addr ) const {
|
|
||||||
// if ( is64bitSystem() )
|
|
||||||
// return boost::python::object( *(PULONG64)addr );
|
|
||||||
// else
|
|
||||||
// return boost::python::object( addr64( *(PULONG)addr ) );
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// void
|
|
||||||
// setupBaseType();
|
|
||||||
//
|
|
||||||
// static bool
|
|
||||||
// getById( const std::string &moduleName, ULONG typeId, TypeInfo& typeInfo );
|
|
||||||
//
|
|
||||||
//private:
|
|
||||||
//
|
|
||||||
// bool m_baseType;
|
|
||||||
// bool m_pointer;
|
|
||||||
// TypeFieldList m_fields;
|
|
||||||
// std::string m_typeName;
|
|
||||||
// ULONG m_size;
|
|
||||||
//};
|
|
||||||
//
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
//class typeClass
|
|
||||||
//{
|
|
||||||
//public:
|
|
||||||
//
|
|
||||||
// typeClass()
|
|
||||||
// : m_offset(0)
|
|
||||||
// {
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// typeClass(
|
|
||||||
// const TypeInfo &typeInfo,
|
|
||||||
// ULONG offset
|
|
||||||
// ) : m_typeInfo(typeInfo)
|
|
||||||
// , m_offset(offset)
|
|
||||||
// {
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// // sizeof(TYPE)
|
|
||||||
// ULONG size() const
|
|
||||||
// {
|
|
||||||
// return (ULONG)m_typeInfo.size();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// void setPyObj( const boost::python::object &obj )
|
|
||||||
// {
|
|
||||||
// m_pyobj = obj;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// // TypeInfo getter
|
|
||||||
// TypeInfo &getTypeInfo()
|
|
||||||
// {
|
|
||||||
// return m_typeInfo;
|
|
||||||
// }
|
|
||||||
// const TypeInfo &getTypeInfo() const
|
|
||||||
// {
|
|
||||||
// return m_typeInfo;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// // boost::python::object getter
|
|
||||||
// boost::python::object &getPyObj()
|
|
||||||
// {
|
|
||||||
// return m_pyobj;
|
|
||||||
// }
|
|
||||||
// const boost::python::object &getPyObj() const
|
|
||||||
// {
|
|
||||||
// return m_pyobj;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// std::string print() const;
|
|
||||||
//
|
|
||||||
// virtual void printField(
|
|
||||||
// const TypeInfo::TypeField &field,
|
|
||||||
// std::stringstream &sstr
|
|
||||||
// ) const
|
|
||||||
// {
|
|
||||||
// // no data - nothing print
|
|
||||||
// }
|
|
||||||
// virtual void printSelf(
|
|
||||||
// std::stringstream &sstr
|
|
||||||
// ) const
|
|
||||||
// {
|
|
||||||
// // no data - nothing print
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// // field offset getter/setter
|
|
||||||
// ULONG getOffset() const { return m_offset; }
|
|
||||||
//
|
|
||||||
//private:
|
|
||||||
// TypeInfo m_typeInfo;
|
|
||||||
// ULONG m_offset;
|
|
||||||
// boost::python::object m_pyobj;
|
|
||||||
//};
|
|
||||||
//
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
//class typedVarClass : public typeClass {
|
|
||||||
//
|
|
||||||
//public:
|
|
||||||
//
|
|
||||||
// typedVarClass() : m_addr(0)
|
|
||||||
// {}
|
|
||||||
//
|
|
||||||
// typedVarClass( const TypeInfo &typeInfo, ULONG offset, ULONG64 addr) :
|
|
||||||
// typeClass( typeInfo, offset ),
|
|
||||||
// m_addr( addr )
|
|
||||||
// {}
|
|
||||||
//
|
|
||||||
// ULONG64
|
|
||||||
// getAddress() const {
|
|
||||||
// return m_addr;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// virtual void
|
|
||||||
// printField( const TypeInfo::TypeField &field, std::stringstream &sstr ) const override;
|
|
||||||
//
|
|
||||||
// virtual void
|
|
||||||
// printSelf( std::stringstream &sstr ) const override
|
|
||||||
// {
|
|
||||||
// sstr << std::hex << "0x" << getAddress() << std::dec << " ";
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
//private:
|
|
||||||
//
|
|
||||||
// ULONG64 m_addr;
|
|
||||||
//};
|
|
||||||
//
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
|
@ -151,7 +151,7 @@
|
|||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCLinkerTool"
|
Name="VCLinkerTool"
|
||||||
AdditionalDependencies="dbgeng.lib"
|
AdditionalDependencies="dbgeng.lib dbghelp.lib"
|
||||||
OutputFile="$(OutDir)\$(ProjectName).pyd"
|
OutputFile="$(OutDir)\$(ProjectName).pyd"
|
||||||
LinkIncremental="2"
|
LinkIncremental="2"
|
||||||
AdditionalLibraryDirectories=""$(DBG_SDK_ROOT)\lib\amd64";"$(PYTHON_ROOT)\x64\libs";"$(BOOST_ROOT)\stage64\lib""
|
AdditionalLibraryDirectories=""$(DBG_SDK_ROOT)\lib\amd64";"$(PYTHON_ROOT)\x64\libs";"$(BOOST_ROOT)\stage64\lib""
|
||||||
@ -311,7 +311,7 @@
|
|||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCLinkerTool"
|
Name="VCLinkerTool"
|
||||||
AdditionalDependencies="dbgeng.lib"
|
AdditionalDependencies="dbgeng.lib dbghelp.lib"
|
||||||
OutputFile="$(OutDir)\$(ProjectName).pyd"
|
OutputFile="$(OutDir)\$(ProjectName).pyd"
|
||||||
LinkIncremental="1"
|
LinkIncremental="1"
|
||||||
AdditionalLibraryDirectories=""$(DBG_SDK_ROOT)\lib\amd64";"$(PYTHON_ROOT)\x64\libs";"$(BOOST_ROOT)\stage64\lib""
|
AdditionalLibraryDirectories=""$(DBG_SDK_ROOT)\lib\amd64";"$(PYTHON_ROOT)\x64\libs";"$(BOOST_ROOT)\stage64\lib""
|
||||||
@ -550,6 +550,10 @@
|
|||||||
RelativePath=".\dbgtype.h"
|
RelativePath=".\dbgtype.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\intbase.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\resource.h"
|
RelativePath=".\resource.h"
|
||||||
>
|
>
|
||||||
|
Loading…
Reference in New Issue
Block a user