Merge branch '0.9.1-beta' of git@scm.dev.nokia.troll.no:creator/mainline into 0.9.1-beta

This commit is contained in:
mae
2008-12-12 14:10:34 +01:00
4 changed files with 101 additions and 61 deletions

View File

@@ -123,14 +123,13 @@ int qtGhVersion = QT_VERSION;
#endif #endif
#include <list> #include <list>
#include <map>
#include <string> #include <string>
#include <vector> #include <vector>
#include <ctype.h> #include <ctype.h>
#include <stdio.h> #include <stdio.h>
//#include <sys/types.h>
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
# include <windows.h> # include <windows.h>
#endif #endif
@@ -172,9 +171,6 @@ public:
// id of the thread that owns the object // id of the thread that owns the object
QThreadData *threadData; QThreadData *threadData;
void moveToThread_helper();
void setThreadData_helper(QThreadData *currentData, QThreadData *targetData);
void _q_reregisterTimers(void *pointer);
struct Sender struct Sender
{ {
@@ -188,20 +184,12 @@ public:
QList<QPointer<QObject> > eventFilters; QList<QPointer<QObject> > eventFilters;
struct ExtraData struct ExtraData;
{
#ifndef QT_NO_USERDATA
QVector<QObjectUserData *> userData;
#endif
QList<QByteArray> propertyNames;
QList<QVariant> propertyValues;
};
ExtraData *extraData; ExtraData *extraData;
mutable quint32 connectedSignals; mutable quint32 connectedSignals;
QString objectName; QString objectName;
// Note: you must hold the signalSlotLock() before accessing the lists below or calling the functions
struct Connection struct Connection
{ {
QObject *receiver; QObject *receiver;
@@ -214,8 +202,6 @@ public:
QObjectConnectionListVector *connectionLists; QObjectConnectionListVector *connectionLists;
QList<Sender> senders; QList<Sender> senders;
int *deleteWatch; int *deleteWatch;
static QObjectPrivate *get(QObject *o) { return o->d_func(); }
}; };
#if defined(QT_BEGIN_NAMESPACE) #if defined(QT_BEGIN_NAMESPACE)
@@ -291,7 +277,7 @@ static bool startsWith(const char *s, const char *t)
#define qCheckAccess(d) do { qProvokeSegFaultHelper = *(char*)d; } while (0) #define qCheckAccess(d) do { qProvokeSegFaultHelper = *(char*)d; } while (0)
#define qCheckPointer(d) do { if (d) qProvokeSegFaultHelper = *(char*)d; } while (0) #define qCheckPointer(d) do { if (d) qProvokeSegFaultHelper = *(char*)d; } while (0)
// provoke segfault unconditionally // provoke segfault unconditionally
#define qCheck(b) do { if (!b) qProvokeSegFaultHelper = *(char*)0; } while (0) #define qCheck(b) do { if (!(b)) qProvokeSegFaultHelper = *(char*)0; } while (0)
const char *stripNamespace(const char *type) const char *stripNamespace(const char *type)
{ {
@@ -2146,6 +2132,61 @@ static void qDumpStdList(QDumper &d)
d.disarm(); d.disarm();
} }
static void qDumpStdMap(QDumper &d)
{
typedef std::map<int, int> DummyType;
const DummyType &map = *reinterpret_cast<const DummyType*>(d.data);
const char *keyType = d.templateParameters[0];
const char *valueType = d.templateParameters[1];
const void *p = d.data;
qCheckAccess(p);
p = deref(p);
int nn = map.size();
qCheck(nn >= 0);
DummyType::const_iterator it = map.begin();
for (int i = 0; i < nn && i < 10 && it != map.end(); ++i, ++it)
qCheckAccess(it.operator->());
QByteArray strippedInnerType = stripPointerType(d.innertype);
P(d, "numchild", nn);
P(d, "value", "<" << nn << " items>");
P(d, "valuedisabled", "true");
P(d, "valueoffset", d.extraInt[2]);
if (d.dumpChildren) {
bool simpleKey = isSimpleType(keyType);
bool simpleValue = isShortKey(valueType);
int valueOffset = d.extraInt[2];
d << ",children=[";
it = map.begin();
for (int i = 0; i < 1000 && it != map.end(); ++i, ++it) {
const void *node = it.operator->();
if (simpleKey) {
d.beginHash();
P(d, "type", valueType);
qDumpInnerValueHelper(d, keyType, node, "name");
P(d, "nameisindex", "1");
if (simpleValue)
qDumpInnerValueHelper(d, valueType, addOffset(node, valueOffset));
P(d, "addr", addOffset(node, valueOffset));
d.endHash();
} else {
d.beginHash();
P(d, "name", "[" << i << "]");
P(d, "addr", it.operator->());
P(d, "type", "std::pair<const " << keyType << "," << valueType << " >");
d.endHash();
}
}
if (it != map.end())
d.putEllipsis();
d << "]";
}
d.disarm();
}
static void qDumpStdString(QDumper &d) static void qDumpStdString(QDumper &d)
{ {
const std::string &str = *reinterpret_cast<const std::string *>(d.data); const std::string &str = *reinterpret_cast<const std::string *>(d.data);
@@ -2356,9 +2397,9 @@ static void handleProtocolVersion2and3(QDumper & d)
qDumpStdVectorBool(d); qDumpStdVectorBool(d);
else if (isEqual(type, "std::list")) else if (isEqual(type, "std::list"))
qDumpStdList(d); qDumpStdList(d);
else if (isEqual(type, "string")) else if (isEqual(type, "std::map"))
qDumpStdString(d); qDumpStdMap(d);
else if (isEqual(type, "std::string")) else if (isEqual(type, "std::string") || isEqual(type, "string"))
qDumpStdString(d); qDumpStdString(d);
else if (isEqual(type, "std::wstring")) else if (isEqual(type, "std::wstring"))
qDumpStdWString(d); qDumpStdWString(d);
@@ -2383,34 +2424,7 @@ void qDumpObjectData440(
int extraInt2, int extraInt2,
int extraInt3) int extraInt3)
{ {
if (protocolVersion == -2) { if (protocolVersion == 1) {
// close socket
QDumper d;
d.protocolVersion = protocolVersion;
d.token = token;
d.flush();
d.disarm();
}
else if (protocolVersion == -1) {
// finalize Startup
QDumper d;
d.protocolVersion = protocolVersion;
d.token = token;
d.disarm();
}
else if (protocolVersion == 0) {
QDumper d;
d.protocolVersion = protocolVersion;
d.token = token;
// used to test whether error output gets through
//fprintf(stderr, "using stderr, qDebug follows: %d\n", token);
//qDebug() << "using qDebug, stderr already used: " << token;
d.disarm();
}
else if (protocolVersion == 1) {
QDumper d; QDumper d;
d.protocolVersion = protocolVersion; d.protocolVersion = protocolVersion;
d.token = token; d.token = token;

View File

@@ -54,7 +54,7 @@
\o \l{Debugging with Qt Creator} \o \l{Debugging with Qt Creator}
\o \l{Tips and Tricks} \o \l{Tips and Tricks}
\o \l{Glossary} \o \l{Glossary}
\o \l{Known Issues for Version 0.9 (Technical Preview)} \o \l{Known Issues of Version 0.9 (Technical Preview)}
\endlist \endlist
*/ */
@@ -577,7 +577,7 @@
\image qtcreator-navigate-customfilter.png \image qtcreator-navigate-customfilter.png
The following table gives an overview on the currently available filters: The following table lists the filters currently available:
\table \table
\header \header
@@ -1057,7 +1057,10 @@
\o Find Next \o Find Next
\o F3 \o F3
\row \row
\o Go back to Code Editor (May require more than one press) \o Go back to Code Editor (\gui Edit mode: The first press gives
the editor focus, without closing secondary windows; the second
press closes all secondary windows. \gui Debug mode or \gui Help
mode: Switch to \gui Edit mode.)
\o Esc \o Esc
\row \row
\o Go to a Line \o Go to a Line
@@ -1131,7 +1134,7 @@
The only solution for this problem is to boot another kernel. The only solution for this problem is to boot another kernel.
\o gdb sometimes takes very long to load debugging symbol, \o gdb sometimes takes very long to load debugging symbol,
especially from big libraries like libQtWebKit. Starting debugging especially from big libraries like \c libQtWebKit. Starting debugging
can take up to several minutes without visible progress. can take up to several minutes without visible progress.
\o Paths or file names containing spaces or special characters like colons, \o Paths or file names containing spaces or special characters like colons,

View File

@@ -2941,6 +2941,8 @@ bool GdbEngine::isCustomValueDumperAvailable(const QString &type) const
} }
if (tmplate == "std::list") if (tmplate == "std::list")
return true; return true;
if (tmplate == "std::map")
return true;
if (tmplate == "std::vector" && inner != "bool") if (tmplate == "std::vector" && inner != "bool")
return true; return true;
if (tmplate == "std::basic_string") { if (tmplate == "std::basic_string") {
@@ -2962,6 +2964,8 @@ void GdbEngine::runCustomDumper(const WatchData & data0, bool dumpChildren)
QStringList inners = inner.split('@'); QStringList inners = inner.split('@');
if (inners.at(0).isEmpty()) if (inners.at(0).isEmpty())
inners.clear(); inners.clear();
for (int i = 0; i != inners.size(); ++i)
inners[i] = inners[i].simplified();
QString outertype = isTemplate ? tmplate : data.type; QString outertype = isTemplate ? tmplate : data.type;
@@ -3015,6 +3019,12 @@ void GdbEngine::runCustomDumper(const WatchData & data0, bool dumpChildren)
//extraArgs[extraArgCount++] = sizeofTypeExpression(data.type); //extraArgs[extraArgCount++] = sizeofTypeExpression(data.type);
//extraArgs[extraArgCount++] = "(size_t)&(('" + data.type + "'*)0)->value"; //extraArgs[extraArgCount++] = "(size_t)&(('" + data.type + "'*)0)->value";
} }
} else if (outertype == "std::map") {
// We don't want the comparator and the allocator confuse gdb.
// But we need the offset of the second item in the value pair.
extraArgs[2] = "(size_t)&(('std::pair<const " + inners.at(0)
+ "," + inners.at(1) + ">'*)0)->second";
extraArgs[3] = "0";
} else if (outertype == "std::basic_string") { } else if (outertype == "std::basic_string") {
//qDebug() << "EXTRACT TEMPLATE: " << outertype << inners; //qDebug() << "EXTRACT TEMPLATE: " << outertype << inners;
if (inners.at(0) == "char") { if (inners.at(0) == "char") {
@@ -3064,6 +3074,8 @@ void GdbEngine::runCustomDumper(const WatchData & data0, bool dumpChildren)
+ ',' + extraArgs[2] + ',' + extraArgs[2]
+ ',' + extraArgs[3] + ')'; + ',' + extraArgs[3] + ')';
//qDebug() << "CMD: " << cmd;
sendSynchronizedCommand(cmd, WatchDumpCustomValue1, QVariant::fromValue(data)); sendSynchronizedCommand(cmd, WatchDumpCustomValue1, QVariant::fromValue(data));
q->showStatusMessage( q->showStatusMessage(

View File

@@ -267,7 +267,7 @@ void testQMap()
ggt[11] = QStringList() << "11"; ggt[11] = QStringList() << "11";
ggt[22] = QStringList() << "22"; ggt[22] = QStringList() << "22";
#if 0 #if 1
QMap<uint, float> gg0; QMap<uint, float> gg0;
gg0[11] = 11.0; gg0[11] = 11.0;
gg0[22] = 22.0; gg0[22] = 22.0;
@@ -413,16 +413,31 @@ void testStdList()
void testStdMap() void testStdMap()
{ {
std::map<QString, Foo> gg3;
gg3["22.0"] = Foo(22);
gg3["33.0"] = Foo(33);
gg3["44.0"] = Foo(44);
#if 1
std::map<uint, uint> gg;
gg[11] = 1;
gg[22] = 2;
gg[33] = 3;
gg[44] = 4;
gg[55] = 5;
std::map<uint, QStringList> ggl; std::map<uint, QStringList> ggl;
ggl[11] = QStringList() << "11"; ggl[11] = QStringList() << "11";
ggl[22] = QStringList() << "22"; ggl[22] = QStringList() << "22";
ggl[33] = QStringList() << "33";
ggl[44] = QStringList() << "44";
ggl[55] = QStringList() << "55";
typedef std::map<uint, QStringList> T; typedef std::map<uint, QStringList> T;
T ggt; T ggt;
ggt[11] = QStringList() << "11"; ggt[11] = QStringList() << "11";
ggt[22] = QStringList() << "22"; ggt[22] = QStringList() << "22";
#if 0
std::map<uint, float> gg0; std::map<uint, float> gg0;
gg0[11] = 11.0; gg0[11] = 11.0;
gg0[22] = 22.0; gg0[22] = 22.0;
@@ -434,15 +449,11 @@ void testStdMap()
std::map<int, QString> gg2; std::map<int, QString> gg2;
gg2[22] = "22.0"; gg2[22] = "22.0";
std::map<QString, Foo> gg3;
gg3["22.0"] = Foo(22);
gg3["33.0"] = Foo(33);
QObject ob; QObject ob;
std::map<QString, QPointer<QObject> > map; std::map<QString, QPointer<QObject> > map;
map.insert("Hallo", QPointer<QObject>(&ob)); map["Hallo"] = QPointer<QObject>(&ob);
map.insert("Welt", QPointer<QObject>(&ob)); map["Welt"] = QPointer<QObject>(&ob);
map.insert(".", QPointer<QObject>(&ob)); map["."] = QPointer<QObject>(&ob);
#endif #endif
} }