diff --git a/share/qtcreator/dumper/dumper.cpp b/share/qtcreator/dumper/dumper.cpp index f1782dd60cd..97c00acee44 100644 --- a/share/qtcreator/dumper/dumper.cpp +++ b/share/qtcreator/dumper/dumper.cpp @@ -30,8 +30,9 @@ ** **************************************************************************/ -#include +#include +#if USE_QT_CORE #include #include #include @@ -100,6 +101,9 @@ #endif // QT_BOOTSTRAPPED +#endif // USE_QT_CORE + + #ifdef Q_OS_WIN # include #endif @@ -110,6 +114,8 @@ #include #include +#include + #ifdef QT_BOOTSTRAPPED # define NS "" @@ -251,20 +257,22 @@ static const void *addOffset(const void *p, int offset) return offset + reinterpret_cast(p); } -static const void *skipvtable(const void *p) -{ - return sizeof(void *) + reinterpret_cast(p); -} - static const void *deref(const void *p) { return *reinterpret_cast(p); } +#if USE_QT_CORE +static const void *skipvtable(const void *p) +{ + return sizeof(void *) + reinterpret_cast(p); +} + static const void *dfunc(const void *p) { return deref(skipvtable(p)); } +#endif static bool isEqual(const char *s, const char *t) { @@ -366,6 +374,7 @@ static bool isStringType(const char *type) || isEqual(type, "wstring"); } +#if USE_QT_CORE static bool isMovableType(const char *type) { if (isPointerType(type)) @@ -434,6 +443,7 @@ static bool isMovableType(const char *type) } return false; } +#endif struct QDumper { @@ -1047,6 +1057,7 @@ void qDumpInnerValueHelper(QDumper &d, const char *type, const void *addr, } } +#if USE_QT_CORE static void qDumpInnerValue(QDumper &d, const char *type, const void *addr) { d.putItem("addr", addr); @@ -1057,6 +1068,7 @@ static void qDumpInnerValue(QDumper &d, const char *type, const void *addr) return qDumpInnerValueHelper(d, type, addr); } +#endif static void qDumpInnerValueOrPointer(QDumper &d, const char *type, const char *strippedtype, const void *addr) @@ -1081,6 +1093,8 @@ static void qDumpInnerValueOrPointer(QDumper &d, ////////////////////////////////////////////////////////////////////////////// +#if USE_QT_CORE + #ifndef QT_BOOTSTRAPPED struct ModelIndex { int r; int c; void *p; void *m; }; @@ -3119,6 +3133,8 @@ static void qDumpQWeakPointer(QDumper &d) #endif // QT_VERSION >= 0x040500 #endif // QT_BOOTSTRAPPED +#endif // QT_CORE + static void qDumpStdList(QDumper &d) { const std::list &list = *reinterpret_cast *>(d.data); @@ -3417,6 +3433,37 @@ static void handleProtocolVersion2and3(QDumper &d) if (isEqual(type, "map")) qDumpStdMap(d); break; + case 'e': + if (isEqual(type, "vector")) + qDumpStdVector(d); + else if (isEqual(type, "set")) + qDumpStdSet(d); + break; + case 'i': + if (isEqual(type, "list")) + qDumpStdList(d); + break; + case 's': + if (isEqual(type, "wstring")) + qDumpStdWString(d); + break; + case 't': + if (isEqual(type, "std::vector")) + qDumpStdVector(d); + else if (isEqual(type, "std::vector::bool")) + qDumpStdVectorBool(d); + else if (isEqual(type, "std::list")) + qDumpStdList(d); + else if (isEqual(type, "std::map")) + qDumpStdMap(d); + else if (isEqual(type, "std::set")) + qDumpStdSet(d); + else if (isEqual(type, "std::string") || isEqual(type, "string")) + qDumpStdString(d); + else if (isEqual(type, "std::wstring")) + qDumpStdWString(d); + break; +#if USE_QT_CORE case 'A': # ifndef QT_BOOTSTRAPPED if (isEqual(type, "QAbstractItemModel")) @@ -3441,12 +3488,6 @@ static void handleProtocolVersion2and3(QDumper &d) else if (isEqual(type, "QDir")) qDumpQDir(d); break; - case 'e': - if (isEqual(type, "vector")) - qDumpStdVector(d); - else if (isEqual(type, "set")) - qDumpStdSet(d); - break; case 'F': # ifndef QT_BOOTSTRAPPED if (isEqual(type, "QFile")) @@ -3461,10 +3502,6 @@ static void handleProtocolVersion2and3(QDumper &d) else if (isEqual(type, "QHashNode")) qDumpQHashNode(d); break; - case 'i': - if (isEqual(type, "list")) - qDumpStdList(d); - break; case 'I': # if USE_QT_GUI if (isEqual(type, "QImage")) @@ -3557,26 +3594,6 @@ static void handleProtocolVersion2and3(QDumper &d) else if (isEqual(type, "QSizeF")) qDumpQSizeF(d); break; - case 's': - if (isEqual(type, "wstring")) - qDumpStdWString(d); - break; - case 't': - if (isEqual(type, "std::vector")) - qDumpStdVector(d); - else if (isEqual(type, "std::vector::bool")) - qDumpStdVectorBool(d); - else if (isEqual(type, "std::list")) - qDumpStdList(d); - else if (isEqual(type, "std::map")) - qDumpStdMap(d); - else if (isEqual(type, "std::set")) - qDumpStdSet(d); - else if (isEqual(type, "std::string") || isEqual(type, "string")) - qDumpStdString(d); - else if (isEqual(type, "std::wstring")) - qDumpStdWString(d); - break; case 'T': # ifndef QT_BOOTSTRAPPED if (isEqual(type, "QTextCodec")) @@ -3607,6 +3624,7 @@ static void handleProtocolVersion2and3(QDumper &d) # endif # endif break; +#endif } if (!d.success) @@ -3752,9 +3770,11 @@ void *qDumpObjectData440( } else { +#if USE_QT_CORE # ifndef QT_BOOTSTRAPPED qDebug() << "Unsupported protocol version" << protocolVersion; # endif +#endif } return outBuffer; } diff --git a/share/qtcreator/dumper/dumper.pro b/share/qtcreator/dumper/dumper.pro index 818b03a5d60..f3176a1c047 100644 --- a/share/qtcreator/dumper/dumper.pro +++ b/share/qtcreator/dumper/dumper.pro @@ -4,16 +4,27 @@ linux-* { CONFIG -= release CONFIG += debug } + +HEADERS += dumper.h SOURCES = dumper.cpp + false { + DEFINES += USE_QT_GUI=0 + DEFINES += USE_QT_CORE=0 + QT= + # We need a few convenience macros. + #CONFIG -= qt +} +false { + DEFINES += USE_QT_CORE=1 DEFINES += USE_QT_GUI=0 QT = core + exists($$QMAKE_INCDIR_QT/QtCore/private/qobject_p.h):DEFINES += HAS_QOBJECT_P_H } -else { +true { + DEFINES += USE_QT_CORE=1 DEFINES += USE_QT_GUI=1 - QT = core \ - gui + QT = core gui greaterThan(QT_MAJOR_VERSION, 4):QT *= widgets + exists($$QMAKE_INCDIR_QT/QtCore/private/qobject_p.h):DEFINES += HAS_QOBJECT_P_H } -exists($$QMAKE_INCDIR_QT/QtCore/private/qobject_p.h):DEFINES += HAS_QOBJECT_P_H -HEADERS += dumper.h