From 16a1b2c10ecb355cac62df7446fb25bfcf705807 Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 7 Jun 2011 13:30:16 +0200 Subject: [PATCH] debugger: adjust dummy test ObjectPrivate layout for Qt 4.8 changes Change-Id: I35914e79dce4894a5ec7f0ee656b86e4ce13e2a9 Reviewed-on: http://codereview.qt.nokia.com/365 Reviewed-by: Qt Sanity Bot Reviewed-by: hjk --- share/qtcreator/gdbmacros/gdbmacros.cpp | 17 +-- share/qtcreator/gdbmacros/gdbmacros_p.h | 151 ++++++++++++++++-------- 2 files changed, 111 insertions(+), 57 deletions(-) diff --git a/share/qtcreator/gdbmacros/gdbmacros.cpp b/share/qtcreator/gdbmacros/gdbmacros.cpp index e89d40071ce..aff1119dfff 100644 --- a/share/qtcreator/gdbmacros/gdbmacros.cpp +++ b/share/qtcreator/gdbmacros/gdbmacros.cpp @@ -2454,7 +2454,9 @@ static const char *qConnectionType(uint type) return output; } -#if QT_VERSION >= 0x040400 +#if QT_VERSION < 0x040400 + +#else static const ConnectionList &qConnectionList(const QObject *ob, int signalNumber) { static const ConnectionList emptyList; @@ -2515,7 +2517,8 @@ static void qDumpQObjectSignal(QDumper &d) d.endItem(); d.putItem("type", ""); if (conn.receiver) - d.putItem("value", conn.receiver->metaObject()->method(conn.method).signature()); + d.putItem("value", conn.receiver->metaObject() + ->method(conn.method_()).signature()); else d.putItem("value", ""); d.putItem("numchild", "0"); @@ -2592,7 +2595,7 @@ static void qDumpQObjectSlot(QDumper &d) for (SenderList senderList = p->senders; senderList != 0; senderList = senderList->next, ++s) { const QObject *sender = senderList->sender; - int signal = senderList->method; // FIXME: 'method' is wrong. + int signal = senderList->method_(); // FIXME: 'method' is wrong. #else for (int s = 0; s != p->senders.size(); ++s) { const QObject *sender = senderAt(p->senders, s); @@ -2601,7 +2604,7 @@ static void qDumpQObjectSlot(QDumper &d) const ConnectionList &connList = qConnectionList(sender, signal); for (int i = 0; i != connList.size(); ++i) { const Connection &conn = connectionAt(connList, i); - if (conn.receiver == ob && conn.method == slotNumber) { + if (conn.receiver == ob && conn.method_() == slotNumber) { ++numchild; const QMetaMethod &method = sender->metaObject()->method(signal); qDumpQObjectConnectionPart(d, ob, sender, s, " sender"); @@ -2619,7 +2622,7 @@ static void qDumpQObjectSlot(QDumper &d) d.endItem(); d.putItem("type", ""); d.beginItem("value"); - d.put("<").put(qConnectionType(conn.method)); + d.put("<").put(qConnectionType(conn.method_())); d.put(" connection>"); d.endItem(); d.putItem("numchild", "0"); @@ -2668,7 +2671,7 @@ static void qDumpQObjectSlotList(QDumper &d) for (SenderList senderList = p->senders; senderList != 0; senderList = senderList->next, ++s) { const QObject *sender = senderList->sender; - int signal = senderList->method; // FIXME: 'method' is wrong. + int signal = senderList->method_(); // FIXME: 'method' is wrong. #else for (int s = 0; s != p->senders.size(); ++s) { const QObject *sender = senderAt(p->senders, s); @@ -2677,7 +2680,7 @@ static void qDumpQObjectSlotList(QDumper &d) const ConnectionList &connList = qConnectionList(sender, signal); for (int c = 0; c != connList.size(); ++c) { const Connection &conn = connectionAt(connList, c); - if (conn.receiver == ob && conn.method == k) + if (conn.receiver == ob && conn.method_() == k) ++numchild; } } diff --git a/share/qtcreator/gdbmacros/gdbmacros_p.h b/share/qtcreator/gdbmacros/gdbmacros_p.h index 8aca8b09b48..35b24edbff4 100644 --- a/share/qtcreator/gdbmacros/gdbmacros_p.h +++ b/share/qtcreator/gdbmacros/gdbmacros_p.h @@ -35,6 +35,7 @@ #include #include +#include #ifndef QT_BOOTSTRAPPED @@ -58,58 +59,92 @@ QT_BEGIN_NAMESPACE struct Sender { QObject *sender; int signal; int ref; }; #if QT_VERSION < 0x040600 -struct Connection -{ - QObject *receiver; - int method; - uint connectionType : 3; // 0 == auto, 1 == direct, 2 == queued, 4 == blocking - QBasicAtomicPointer argumentTypes; -}; - -typedef QList ConnectionList; -typedef QList SenderList; - -static inline const Connection &connectionAt(const ConnectionList &l, int i) { return l.at(i); } -static inline const QObject *senderAt(const SenderList &l, int i) { return l.at(i).sender; } -static inline int signalAt(const SenderList &l, int i) { return l.at(i).signal; } -#else -struct Connection -{ - QObject *sender; - QObject *receiver; - int method; - uint connectionType : 3; // 0 == auto, 1 == direct, 2 == queued, 4 == blocking - QBasicAtomicPointer argumentTypes; - Connection *nextConnectionList; - //senders linked list - Connection *next; - Connection **prev; -}; - -struct ConnectionList -{ - ConnectionList() : first(0), last(0) { } - int size() const + struct Connection { - int count = 0; - for (Connection *c = first; c != 0; c = c->nextConnectionList) - ++count; - return count; + QObject *receiver; + int method; + uint connectionType : 3; // 0 == auto, 1 == direct, 2 == queued, 4 == blocking + QBasicAtomicPointer argumentTypes; + int method_() const { return method; } + }; +#elif QT_VERSION < 0x040800 + struct Connection + { + QObject *sender; + QObject *receiver; + int method; + uint connectionType : 3; // 0 == auto, 1 == direct, 2 == queued, 4 == blocking + QBasicAtomicPointer argumentTypes; + Connection *nextConnectionList; + //senders linked list + Connection *next; + Connection **prev; + int method_() const { return method; } + }; +#else + typedef void (*StaticMetaCallFunction)(QObject *, QMetaObject::Call, int, void **); + struct Connection + { + QObject *sender; + QObject *receiver; + StaticMetaCallFunction callFunction; + // The next pointer for the singly-linked ConnectionList + Connection *nextConnectionList; + //senders linked list + Connection *next; + Connection **prev; + QBasicAtomicPointer argumentTypes; + ushort method_offset; + ushort method_relative; + ushort connectionType : 3; // 0 == auto, 1 == direct, 2 == queued, 4 == blocking + ~Connection(); + int method() const { return method_offset + method_relative; } + int method_() const { return method(); } + }; +#endif + +#if QT_VERSION < 0x040600 + typedef QList ConnectionList; + typedef QList SenderList; + + static inline const Connection &connectionAt(const ConnectionList &l, int i) + { + return l.at(i); } + static inline const QObject *senderAt(const SenderList &l, int i) + { + return l.at(i).sender; + } + static inline int signalAt(const SenderList &l, int i) + { + return l.at(i).signal; + } +//#elif QT_VERSION < 0x040800 +#else + struct ConnectionList + { + ConnectionList() : first(0), last(0) { } + int size() const + { + int count = 0; + for (Connection *c = first; c != 0; c = c->nextConnectionList) + ++count; + return count; + } - Connection *first; - Connection *last; -}; + Connection *first; + Connection *last; + }; -typedef Connection *SenderList; + typedef Connection *SenderList; -static inline const Connection &connectionAt(const ConnectionList &l, int i) -{ - Connection *conn = l.first; - for (int cnt = 0; cnt < i; ++cnt) - conn = conn->nextConnectionList; - return *conn; -} + static inline const Connection &connectionAt(const ConnectionList &l, int i) + { + Connection *conn = l.first; + for (int cnt = 0; cnt < i; ++cnt) + conn = conn->nextConnectionList; + return *conn; + } #endif class ObjectPrivate : public QObjectData @@ -124,15 +159,13 @@ public: void *currentSender; void *currentChildBeingDeleted; QList > eventFilters; - void *extraData; mutable quint32 connectedSignals; QString objectName; - void *connectionLists; SenderList senders; int *deleteWatch; -#else +#elif QT_VERSION < 0x040800 QString objectName; void *extraData; void *threadData; @@ -145,6 +178,24 @@ public: void *currentChildBeingDeleted; QAtomicPointer sharedRefcount; int *deleteWatch; +#else + QString objectName; + void *extraData; + void *threadData; + void *connectionLists; + Connection *senders; + Sender *currentSender; + mutable quint32 connectedSignals[2]; + void *unused; + QList > eventFilters; + union { + QObject *currentChildBeingDeleted; + void *declarativeData; + }; + QAtomicPointer sharedRefcount; + #ifdef QT_JAMBI_BUILD + int *deleteWatch; + #endif #endif };