Debugger: Add debug messages to the cdb python module

Change-Id: I53f9df68ff7918f63ffb10b8d80192c78cad3cb3
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
David Schulz
2016-10-21 10:08:46 +02:00
parent 79c247eb09
commit a1b0302014
2 changed files with 11 additions and 0 deletions

View File

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

View File

@@ -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<std::string> 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);