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:
David Schulz
2016-09-19 14:01:29 +02:00
parent a2a766d770
commit 14c65ed6db
4 changed files with 75 additions and 6 deletions

View File

@@ -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)