mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-21 12:53:23 +08:00
[0.2.x] ~refactoring
git-svn-id: https://pykd.svn.codeplex.com/svn@83102 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
parent
1e38a5d7ab
commit
729b3a0af5
@ -11,12 +11,23 @@
|
|||||||
|
|
||||||
namespace pykd {
|
namespace pykd {
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
class Impl : protected DEBUG_EVENT_CALLBACK {
|
class Impl : protected DEBUG_EVENT_CALLBACK {
|
||||||
public:
|
public:
|
||||||
Impl();
|
Impl() {
|
||||||
~Impl();
|
eventRegisterCallbacks(this);
|
||||||
|
}
|
||||||
|
~Impl() {
|
||||||
|
eventRemoveCallbacks(this);
|
||||||
|
}
|
||||||
|
|
||||||
bool find(const SymCacheModuleKey &cacheKey, SymbolSessionPtr &symSession);
|
bool find(const SymCacheModuleKey &cacheKey, SymbolSessionPtr &symSession);
|
||||||
|
|
||||||
@ -57,32 +68,6 @@ private:
|
|||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
Impl::Impl()
|
|
||||||
{
|
|
||||||
eventRegisterCallbacks(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
Impl::~Impl()
|
|
||||||
{
|
|
||||||
eventRemoveCallbacks(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
DEBUG_CALLBACK_RESULT Impl::OnModuleUnload( ULONG64 modBase, const std::string & )
|
|
||||||
{
|
|
||||||
boost::recursive_mutex::scoped_lock l(m_base2KeyLock);
|
|
||||||
if (modBase)
|
|
||||||
m_base2Key.erase(modBase);
|
|
||||||
else
|
|
||||||
m_base2Key.clear();
|
|
||||||
return DebugCallbackNoChange;
|
|
||||||
}
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
void Impl::onSymbolsUnloaded(ULONG64 modBase)
|
void Impl::onSymbolsUnloaded(ULONG64 modBase)
|
||||||
{
|
{
|
||||||
if (!modBase)
|
if (!modBase)
|
||||||
@ -107,25 +92,6 @@ void Impl::onSymbolsUnloaded(ULONG64 modBase)
|
|||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
namespace
|
|
||||||
{
|
|
||||||
|
|
||||||
Impl &getImpl()
|
|
||||||
{
|
|
||||||
// construct after DebugEngine
|
|
||||||
static Impl g_Impl;
|
|
||||||
return g_Impl;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
bool findSymCacheEntry(const SymCacheModuleKey &cacheKey, SymbolSessionPtr &symSession)
|
|
||||||
{
|
|
||||||
return getImpl().find(cacheKey, symSession);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Impl::find(const SymCacheModuleKey &cacheKey, SymbolSessionPtr &symSession)
|
bool Impl::find(const SymCacheModuleKey &cacheKey, SymbolSessionPtr &symSession)
|
||||||
{
|
{
|
||||||
boost::recursive_mutex::scoped_lock l(m_key2SymLock);
|
boost::recursive_mutex::scoped_lock l(m_key2SymLock);
|
||||||
@ -142,11 +108,6 @@ bool Impl::find(const SymCacheModuleKey &cacheKey, SymbolSessionPtr &symSession)
|
|||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void insertSymCacheEntry(ULONG64 modBase, const SymCacheModuleKey &cacheKey, SymbolSessionPtr symSession)
|
|
||||||
{
|
|
||||||
return getImpl().insert(modBase, cacheKey, symSession);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Impl::insert(ULONG64 modBase, const SymCacheModuleKey &cacheKey, SymbolSessionPtr symSession)
|
void Impl::insert(ULONG64 modBase, const SymCacheModuleKey &cacheKey, SymbolSessionPtr symSession)
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
@ -162,11 +123,6 @@ void Impl::insert(ULONG64 modBase, const SymCacheModuleKey &cacheKey, SymbolSess
|
|||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void eraseSymCacheEntry(const SymCacheModuleKey &cacheKey)
|
|
||||||
{
|
|
||||||
return getImpl().erase(cacheKey);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Impl::erase(const SymCacheModuleKey &cacheKey)
|
void Impl::erase(const SymCacheModuleKey &cacheKey)
|
||||||
{
|
{
|
||||||
boost::recursive_mutex::scoped_lock l(m_key2SymLock);
|
boost::recursive_mutex::scoped_lock l(m_key2SymLock);
|
||||||
@ -175,11 +131,6 @@ void Impl::erase(const SymCacheModuleKey &cacheKey)
|
|||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void clearSymCache()
|
|
||||||
{
|
|
||||||
return getImpl().clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Impl::clear()
|
void Impl::clear()
|
||||||
{
|
{
|
||||||
boost::recursive_mutex::scoped_lock l(m_key2SymLock);
|
boost::recursive_mutex::scoped_lock l(m_key2SymLock);
|
||||||
@ -188,6 +139,59 @@ void Impl::clear()
|
|||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
DEBUG_CALLBACK_RESULT Impl::OnModuleUnload( ULONG64 modBase, const std::string & )
|
||||||
|
{
|
||||||
|
boost::recursive_mutex::scoped_lock l(m_base2KeyLock);
|
||||||
|
if (modBase)
|
||||||
|
m_base2Key.erase(modBase);
|
||||||
|
else
|
||||||
|
m_base2Key.clear();
|
||||||
|
return DebugCallbackNoChange;
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
Impl &getImpl()
|
||||||
|
{
|
||||||
|
// construct after DebugEngine
|
||||||
|
static Impl g_Impl;
|
||||||
|
return g_Impl;
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
bool findSymCacheEntry(const SymCacheModuleKey &cacheKey, SymbolSessionPtr &symSession)
|
||||||
|
{
|
||||||
|
return getImpl().find(cacheKey, symSession);
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void insertSymCacheEntry(ULONG64 modBase, const SymCacheModuleKey &cacheKey, SymbolSessionPtr symSession)
|
||||||
|
{
|
||||||
|
return getImpl().insert(modBase, cacheKey, symSession);
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void eraseSymCacheEntry(const SymCacheModuleKey &cacheKey)
|
||||||
|
{
|
||||||
|
return getImpl().erase(cacheKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void clearSymCache()
|
||||||
|
{
|
||||||
|
return getImpl().clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
} // namespace pykd
|
} // namespace pykd
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
Loading…
Reference in New Issue
Block a user