OSDN Git Service

debugger: adjust dummy test ObjectPrivate layout for Qt 4.8 changes
authorhjk <qtc-committer@nokia.com>
Tue, 7 Jun 2011 11:30:16 +0000 (13:30 +0200)
committerhjk <qthjk@ovi.com>
Tue, 7 Jun 2011 15:26:32 +0000 (17:26 +0200)
Change-Id: I35914e79dce4894a5ec7f0ee656b86e4ce13e2a9
Reviewed-on: http://codereview.qt.nokia.com/365
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: hjk <qthjk@ovi.com>
share/qtcreator/gdbmacros/gdbmacros.cpp
share/qtcreator/gdbmacros/gdbmacros_p.h

index e89d400..aff1119 100644 (file)
@@ -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", "<invalid receiver>");
                 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;
                     }
                 }
index 8aca8b0..35b24ed 100644 (file)
@@ -35,6 +35,7 @@
 
 #include <QtCore/QObject>
 #include <QtCore/QPointer>
+#include <QtCore/QSharedPointer>
 
 #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<int> argumentTypes;
-};
+    struct Connection
+    {
+        QObject *receiver;
+        int method;
+        uint connectionType : 3; // 0 == auto, 1 == direct, 2 == queued, 4 == blocking
+        QBasicAtomicPointer<int> 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<int> 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<int> 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
 
-typedef QList<Connection> ConnectionList;
-typedef QList<Sender> SenderList;
+#if QT_VERSION < 0x040600
+    typedef QList<Connection> ConnectionList;
+    typedef QList<Sender> 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; }
+    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 Connection
-{
-    QObject *sender;
-    QObject *receiver;
-    int method;
-    uint connectionType : 3; // 0 == auto, 1 == direct, 2 == queued, 4 == blocking
-    QBasicAtomicPointer<int> argumentTypes;
-    Connection *nextConnectionList;
-    //senders linked list
-    Connection *next;
-    Connection **prev;
-};
-
-struct ConnectionList
-{
-    ConnectionList() : first(0), last(0) { }
-    int size() const
+    struct ConnectionList
     {
-        int count = 0;
-        for (Connection *c = first; c != 0; c = c->nextConnectionList)
-            ++count;
-        return count;
+        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;
+    };
+
+    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;
     }
-
-    Connection *first;
-    Connection *last;
-};
-
-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;
-}
 #endif
 
 class ObjectPrivate : public QObjectData
@@ -124,15 +159,13 @@ public:
     void *currentSender;
     void *currentChildBeingDeleted;
     QList<QPointer<QObject> > 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<void> sharedRefcount;
     int *deleteWatch;
+#else
+    QString objectName;
+    void *extraData;
+    void *threadData;
+    void *connectionLists;
+    Connection *senders;
+    Sender *currentSender;
+    mutable quint32 connectedSignals[2];
+    void *unused;
+    QList<QPointer<QObject> > eventFilters;
+    union {
+        QObject *currentChildBeingDeleted;
+        void *declarativeData;
+    };
+    QAtomicPointer<void> sharedRefcount;
+    #ifdef QT_JAMBI_BUILD
+    int *deleteWatch;
+    #endif
 #endif
 };