From a1b030201429cf2711c39f1d1e86ea5deca4e65f Mon Sep 17 00:00:00 2001 From: David Schulz Date: Fri, 21 Oct 2016 10:08:46 +0200 Subject: [PATCH] Debugger: Add debug messages to the cdb python module Change-Id: I53f9df68ff7918f63ffb10b8d80192c78cad3cb3 Reviewed-by: Christian Stenger --- src/libs/qtcreatorcdbext/pycdbextmodule.h | 2 ++ src/libs/qtcreatorcdbext/pytype.cpp | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/src/libs/qtcreatorcdbext/pycdbextmodule.h b/src/libs/qtcreatorcdbext/pycdbextmodule.h index 7228c865c17..23c56cc0b1e 100644 --- a/src/libs/qtcreatorcdbext/pycdbextmodule.h +++ b/src/libs/qtcreatorcdbext/pycdbextmodule.h @@ -31,6 +31,8 @@ void initCdbextPythonModule(); PyObject *pyBool(bool); +constexpr bool debugPyCdbextModule = false; + /* TODO's class Field: isBaseClass() -> bool # Whether this is a base class or normal member diff --git a/src/libs/qtcreatorcdbext/pytype.cpp b/src/libs/qtcreatorcdbext/pytype.cpp index 7c943705685..9214c4d9002 100644 --- a/src/libs/qtcreatorcdbext/pytype.cpp +++ b/src/libs/qtcreatorcdbext/pytype.cpp @@ -33,6 +33,9 @@ #include "stringutils.h" #include "symbolgroupvalue.h" +constexpr bool debugPyType = false; +constexpr bool debuggingEnabled() { return debugPyType || debugPyCdbextModule; } + enum TypeCodes { TypeCodeTypedef, TypeCodeStruct, @@ -51,6 +54,8 @@ enum TypeCodes { PyObject *lookupType(const std::string &typeNameIn) { + if (debuggingEnabled()) + DebugPrint() << "lookup type '" << typeNameIn << "'"; std::string typeName = typeNameIn; CIDebugSymbols *symbols = ExtensionCommandContext::instance()->symbols(); std::string fullTypeName = typeName; @@ -281,8 +286,12 @@ PyObject *type_TemplateArgument(Type *self, PyObject *args) PyObject *type_TemplateArguments(Type *self) { std::vector innerTypes = innerTypesOf(getTypeName(self)); + if (debuggingEnabled()) + DebugPrint() << "template arguments of: " << getTypeName(self); auto templateArguments = PyList_New(0); for (const std::string &innerType : innerTypes) { + if (debuggingEnabled()) + DebugPrint() << " template argument: " << innerType; PyObject* childValue; try { int integer = std::stoi(innerType);