forked from qt-creator/qt-creator
CdbExt: Add python scripting
Introducing the script extension command that allows to run basic python code. Change-Id: I356ca5408474be0206b1c77cf2a0ecf6640ec651 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -33,6 +33,10 @@
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#ifdef WITH_PYTHON
|
||||
#include <Python.h>
|
||||
#endif
|
||||
|
||||
// wdbgexts.h declares 'extern WINDBG_EXTENSION_APIS ExtensionApis;'
|
||||
// and it's inline functions rely on its existence.
|
||||
WINDBG_EXTENSION_APIS ExtensionApis = {sizeof(WINDBG_EXTENSION_APIS), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
@@ -155,6 +159,10 @@ HRESULT ExtensionContext::initialize(PULONG Version, PULONG Flags)
|
||||
*Version = DEBUG_EXTENSION_VERSION(1, 0);
|
||||
*Flags = 0;
|
||||
|
||||
#ifdef WITH_PYTHON
|
||||
Py_Initialize();
|
||||
#endif
|
||||
|
||||
IInterfacePointer<CIDebugClient> client;
|
||||
if (!client.create())
|
||||
return client.hr();
|
||||
@@ -503,6 +511,9 @@ HRESULT CALLBACK DebugExtensionInitialize(PULONG Version, PULONG Flags)
|
||||
|
||||
void CALLBACK DebugExtensionUninitialize(void)
|
||||
{
|
||||
#ifdef WITH_PYTHON
|
||||
Py_Finalize();
|
||||
#endif
|
||||
}
|
||||
|
||||
void CALLBACK DebugExtensionNotify(ULONG Notify, ULONG64)
|
||||
|
||||
Reference in New Issue
Block a user