[~] viod -> void

[+] variable for PyThread_StateSave

git-svn-id: https://pykd.svn.codeplex.com/svn@69451 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
SND\EreTIk_cp 2011-08-31 17:36:15 +00:00
parent f443f0cbe2
commit e4bbc369f9
5 changed files with 28 additions and 26 deletions

View File

@ -14,7 +14,7 @@ dbgBreakpointClass::breakpointMap dbgBreakpointClass::m_breakMap;
HRESULT dbgBreakpointClass::onBreakpointEvnet( IDebugBreakpoint* bp ) HRESULT dbgBreakpointClass::onBreakpointEvnet( IDebugBreakpoint* bp )
{ {
PyThread_StateSave( dbgExt->getThreadState() ); PyThread_StateSave pyThrdState( dbgExt->getThreadState() );
try { try {

View File

@ -69,8 +69,8 @@ HRESULT debugEvent::LoadModule(
dbgModuleClass module(moduleName, moduleBase, moduleSize); dbgModuleClass module(moduleName, moduleBase, moduleSize);
silentMode.reset(); silentMode.reset();
PyThread_StateSave( dbgExt->getThreadState() ); PyThread_StateSave pyThrdState( dbgExt->getThreadState() );
return onLoadModule( module ); return onLoadModule( module );
} }
@ -91,8 +91,8 @@ HRESULT debugEvent::UnloadModule(
dbgModuleClass module(moduleName, moduleBase, moduleSize); dbgModuleClass module(moduleName, moduleBase, moduleSize);
silentMode.reset(); silentMode.reset();
PyThread_StateSave( dbgExt->getThreadState() ); PyThread_StateSave pyThrdState( dbgExt->getThreadState() );
return onUnloadModule( module ); return onUnloadModule( module );
} }
@ -102,7 +102,7 @@ HRESULT debugEvent::SessionStatus(
__in ULONG Status __in ULONG Status
) )
{ {
PyThread_StateSave( dbgExt->getThreadState() ); PyThread_StateSave pyThrdState( dbgExt->getThreadState() );
return onChangeSessionStatus( Status ); return onChangeSessionStatus( Status );
} }
@ -114,10 +114,10 @@ HRESULT debugEvent::ChangeDebuggeeState(
__in ULONG64 Argument __in ULONG64 Argument
) )
{ {
PyThread_StateSave( dbgExt->getThreadState() ); PyThread_StateSave pyThrdState( dbgExt->getThreadState() );
return onChangeDebugeeState(); return onChangeDebugeeState();
} }
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////

View File

@ -249,7 +249,7 @@ BOOST_PYTHON_MODULE( pykd )
DEF_PY_GLOBAL( "ulong_t", TypeInfo("", "unsigned long") ); DEF_PY_GLOBAL( "ulong_t", TypeInfo("", "unsigned long") );
DEF_PY_GLOBAL( "int_t", TypeInfo("", "int") ); DEF_PY_GLOBAL( "int_t", TypeInfo("", "int") );
DEF_PY_GLOBAL( "uint_t", TypeInfo("", "unsigned int") ); DEF_PY_GLOBAL( "uint_t", TypeInfo("", "unsigned int") );
DEF_PY_GLOBAL( "ptr_t", TypeInfo("", "viod*") ); DEF_PY_GLOBAL( "ptr_t", TypeInfo("", "void*") );
DEF_PY_GLOBAL( "double_t", TypeInfo("", "double") ); DEF_PY_GLOBAL( "double_t", TypeInfo("", "double") );
DEF_PY_GLOBAL( "longlong_t", TypeInfo("", "int64") ); DEF_PY_GLOBAL( "longlong_t", TypeInfo("", "int64") );
DEF_PY_GLOBAL( "ulonglong_t", TypeInfo("", "unsigned int64") ); DEF_PY_GLOBAL( "ulonglong_t", TypeInfo("", "unsigned int64") );
@ -702,10 +702,9 @@ DebugExtensionUninitialize()
WindbgGlobalSession::StopWindbgSession(); WindbgGlobalSession::StopWindbgSession();
} }
DbgExt::DbgExt( IDebugClient4 *masterClient ) DbgExt::DbgExt( IDebugClient4 *masterClient )
: m_threadState(NULL)
{ {
m_threadState = NULL;
client = NULL; client = NULL;
masterClient->QueryInterface( __uuidof(IDebugClient), (void **)&client ); masterClient->QueryInterface( __uuidof(IDebugClient), (void **)&client );
@ -747,7 +746,7 @@ DbgExt::DbgExt( IDebugClient4 *masterClient )
system2 = NULL; system2 = NULL;
masterClient->QueryInterface( __uuidof(IDebugSystemObjects2), (void**)&system2 ); masterClient->QueryInterface( __uuidof(IDebugSystemObjects2), (void**)&system2 );
m_previosExt = dbgExt; m_previosExt = dbgExt;
dbgExt = this; dbgExt = this;
} }
@ -761,7 +760,7 @@ DbgExt::~DbgExt()
client4->Release(); client4->Release();
if ( client5 ) if ( client5 )
client5->Release(); client5->Release();
if ( control ) if ( control )
control->Release(); control->Release();

View File

@ -10,26 +10,26 @@ public:
IDebugClient *client; IDebugClient *client;
IDebugClient4 *client4; IDebugClient4 *client4;
IDebugClient5 *client5; IDebugClient5 *client5;
IDebugControl *control; IDebugControl *control;
IDebugControl4 *control4; IDebugControl4 *control4;
IDebugRegisters *registers; IDebugRegisters *registers;
IDebugSymbols *symbols; IDebugSymbols *symbols;
IDebugSymbols2 *symbols2; IDebugSymbols2 *symbols2;
IDebugSymbols3 *symbols3; IDebugSymbols3 *symbols3;
IDebugDataSpaces *dataSpaces; IDebugDataSpaces *dataSpaces;
IDebugDataSpaces4 *dataSpaces4; IDebugDataSpaces4 *dataSpaces4;
IDebugAdvanced2 *advanced2; IDebugAdvanced2 *advanced2;
IDebugSystemObjects *system; IDebugSystemObjects *system;
IDebugSystemObjects2 *system2; IDebugSystemObjects2 *system2;
DbgExt( IDebugClient4 *client ); DbgExt( IDebugClient4 *client );
~DbgExt(); ~DbgExt();
PyThreadState** PyThreadState**

View File

@ -15,16 +15,19 @@ class PyThread_StateSave {
public: public:
PyThread_StateSave( PyThreadState **state ) { PyThread_StateSave( PyThreadState **state )
: m_state(NULL)
{
if ( *state != NULL ) if ( *state != NULL )
{ {
m_state = state; m_state = state;
PyEval_RestoreThread( *m_state ); PyEval_RestoreThread( *m_state );
} }
} }
~PyThread_StateSave() { ~PyThread_StateSave() {
*m_state =PyEval_SaveThread(); if (m_state)
*m_state =PyEval_SaveThread();
} }
private: private: