aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormae <qtc-committer@nokia.com>2008-12-12 14:10:34 +0100
committermae <qtc-committer@nokia.com>2008-12-12 14:10:34 +0100
commit2741bd7dadb7f9e23c5b7e3d56898725fcbb824c (patch)
treeec365756f9024459b79c376dd32fd6a35fbd3cd6
parentd937ee5570c83afda61969042e293eca12f41b90 (diff)
parent1b325ce72176a7494f20a379bb60045a4c1dc349 (diff)
Merge branch '0.9.1-beta' of git@scm.dev.nokia.troll.no:creator/mainline into 0.9.1-beta
-rw-r--r--bin/gdbmacros/gdbmacros.cpp110
-rw-r--r--doc/qtcreator.qdoc11
-rw-r--r--src/plugins/debugger/gdbengine.cpp12
-rw-r--r--tests/manual/gdbdebugger/simple/app.cpp29
4 files changed, 101 insertions, 61 deletions
diff --git a/bin/gdbmacros/gdbmacros.cpp b/bin/gdbmacros/gdbmacros.cpp
index 9ea2a9aff56..775819934bc 100644
--- a/bin/gdbmacros/gdbmacros.cpp
+++ b/bin/gdbmacros/gdbmacros.cpp
@@ -123,14 +123,13 @@ int qtGhVersion = QT_VERSION;
#endif
#include <list>
+#include <map>
#include <string>
#include <vector>
#include <ctype.h>
#include <stdio.h>
-//#include <sys/types.h>
-
#ifdef Q_OS_WIN
# include <windows.h>
#endif
@@ -172,9 +171,6 @@ public:
// id of the thread that owns the object
QThreadData *threadData;
- void moveToThread_helper();
- void setThreadData_helper(QThreadData *currentData, QThreadData *targetData);
- void _q_reregisterTimers(void *pointer);
struct Sender
{
@@ -188,20 +184,12 @@ public:
QList<QPointer<QObject> > eventFilters;
- struct ExtraData
- {
-#ifndef QT_NO_USERDATA
- QVector<QObjectUserData *> userData;
-#endif
- QList<QByteArray> propertyNames;
- QList<QVariant> propertyValues;
- };
+ struct ExtraData;
ExtraData *extraData;
mutable quint32 connectedSignals;
QString objectName;
- // Note: you must hold the signalSlotLock() before accessing the lists below or calling the functions
struct Connection
{
QObject *receiver;
@@ -214,8 +202,6 @@ public:
QObjectConnectionListVector *connectionLists;
QList<Sender> senders;
int *deleteWatch;
-
- static QObjectPrivate *get(QObject *o) { return o->d_func(); }
};
#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 qCheckPointer(d) do { if (d) qProvokeSegFaultHelper = *(char*)d; } while (0)
// 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)
{
@@ -2146,6 +2132,61 @@ static void qDumpStdList(QDumper &d)
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)
{
const std::string &str = *reinterpret_cast<const std::string *>(d.data);
@@ -2356,9 +2397,9 @@ static void handleProtocolVersion2and3(QDumper & d)
qDumpStdVectorBool(d);
else if (isEqual(type, "std::list"))
qDumpStdList(d);
- else if (isEqual(type, "string"))
- qDumpStdString(d);
- else if (isEqual(type, "std::string"))
+ else if (isEqual(type, "std::map"))
+ qDumpStdMap(d);
+ else if (isEqual(type, "std::string") || isEqual(type, "string"))
qDumpStdString(d);
else if (isEqual(type, "std::wstring"))
qDumpStdWString(d);
@@ -2383,34 +2424,7 @@ void qDumpObjectData440(
int extraInt2,
int extraInt3)
{
- if (protocolVersion == -2) {
- // 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) {
+ if (protocolVersion == 1) {
QDumper d;
d.protocolVersion = protocolVersion;
d.token = token;
diff --git a/doc/qtcreator.qdoc b/doc/qtcreator.qdoc
index b8d38a60c9a..47022bb02d0 100644
--- a/doc/qtcreator.qdoc
+++ b/doc/qtcreator.qdoc
@@ -54,7 +54,7 @@
\o \l{Debugging with Qt Creator}
\o \l{Tips and Tricks}
\o \l{Glossary}
- \o \l{Known Issues for Version 0.9 (Technical Preview)}
+ \o \l{Known Issues of Version 0.9 (Technical Preview)}
\endlist
*/
@@ -577,7 +577,7 @@
\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
\header
@@ -1057,7 +1057,10 @@
\o Find Next
\o F3
\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
\row
\o Go to a Line
@@ -1131,7 +1134,7 @@
The only solution for this problem is to boot another kernel.
\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.
\o Paths or file names containing spaces or special characters like colons,
diff --git a/src/plugins/debugger/gdbengine.cpp b/src/plugins/debugger/gdbengine.cpp
index 83473674782..5f7367b2e4c 100644
--- a/src/plugins/debugger/gdbengine.cpp
+++ b/src/plugins/debugger/gdbengine.cpp
@@ -2941,6 +2941,8 @@ bool GdbEngine::isCustomValueDumperAvailable(const QString &type) const
}
if (tmplate == "std::list")
return true;
+ if (tmplate == "std::map")
+ return true;
if (tmplate == "std::vector" && inner != "bool")
return true;
if (tmplate == "std::basic_string") {
@@ -2962,6 +2964,8 @@ void GdbEngine::runCustomDumper(const WatchData & data0, bool dumpChildren)
QStringList inners = inner.split('@');
if (inners.at(0).isEmpty())
inners.clear();
+ for (int i = 0; i != inners.size(); ++i)
+ inners[i] = inners[i].simplified();
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++] = "(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") {
//qDebug() << "EXTRACT TEMPLATE: " << outertype << inners;
if (inners.at(0) == "char") {
@@ -3064,6 +3074,8 @@ void GdbEngine::runCustomDumper(const WatchData & data0, bool dumpChildren)
+ ',' + extraArgs[2]
+ ',' + extraArgs[3] + ')';
+ //qDebug() << "CMD: " << cmd;
+
sendSynchronizedCommand(cmd, WatchDumpCustomValue1, QVariant::fromValue(data));
q->showStatusMessage(
diff --git a/tests/manual/gdbdebugger/simple/app.cpp b/tests/manual/gdbdebugger/simple/app.cpp
index ab5ee635b5a..1eea659625d 100644
--- a/tests/manual/gdbdebugger/simple/app.cpp
+++ b/tests/manual/gdbdebugger/simple/app.cpp
@@ -267,7 +267,7 @@ void testQMap()
ggt[11] = QStringList() << "11";
ggt[22] = QStringList() << "22";
-#if 0
+#if 1
QMap<uint, float> gg0;
gg0[11] = 11.0;
gg0[22] = 22.0;
@@ -413,16 +413,31 @@ void testStdList()
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;
ggl[11] = QStringList() << "11";
ggl[22] = QStringList() << "22";
+ ggl[33] = QStringList() << "33";
+ ggl[44] = QStringList() << "44";
+ ggl[55] = QStringList() << "55";
typedef std::map<uint, QStringList> T;
T ggt;
ggt[11] = QStringList() << "11";
ggt[22] = QStringList() << "22";
-#if 0
std::map<uint, float> gg0;
gg0[11] = 11.0;
gg0[22] = 22.0;
@@ -434,15 +449,11 @@ void testStdMap()
std::map<int, QString> gg2;
gg2[22] = "22.0";
- std::map<QString, Foo> gg3;
- gg3["22.0"] = Foo(22);
- gg3["33.0"] = Foo(33);
-
QObject ob;
std::map<QString, QPointer<QObject> > map;
- map.insert("Hallo", QPointer<QObject>(&ob));
- map.insert("Welt", QPointer<QObject>(&ob));
- map.insert(".", QPointer<QObject>(&ob));
+ map["Hallo"] = QPointer<QObject>(&ob);
+ map["Welt"] = QPointer<QObject>(&ob);
+ map["."] = QPointer<QObject>(&ob);
#endif
}