pykd/pykd/windbg.h
SND\kernelnet_cp a8ff8e9f84 [0.1.x] added : typeInfo.size()
git-svn-id: https://pykd.svn.codeplex.com/svn@70223 9b283d60-5439-405e-af05-b73fd8c4d996
2017-11-08 17:06:26 +04:00

76 lines
1.5 KiB
C++

#pragma once
namespace pykd {
///////////////////////////////////////////////////////////////////////////////////
class WindbgGlobalSession
{
public:
static
boost::python::object
global() {
return windbgGlobalSession->main.attr("__dict__");
}
static
VOID
StartWindbgSession() {
if ( 1 == InterlockedIncrement( &sessionCount ) )
{
windbgGlobalSession = new WindbgGlobalSession();
}
}
static
VOID
StopWindbgSession() {
if ( 0 == InterlockedDecrement( &sessionCount ) )
{
delete windbgGlobalSession;
windbgGlobalSession = NULL;
}
}
static
bool isInit() {
return windbgGlobalSession != NULL;
}
static
VOID
RestorePyState() {
PyEval_RestoreThread( windbgGlobalSession->pyState );
}
static
VOID
SavePyState() {
windbgGlobalSession->pyState = PyEval_SaveThread();
}
private:
WindbgGlobalSession();
~WindbgGlobalSession() {
}
python::object main;
PyThreadState *pyState;
static volatile LONG sessionCount;
static WindbgGlobalSession *windbgGlobalSession;
};
///////////////////////////////////////////////////////////////////////////////////
}; // namespace pykd