diff options
author | Friedemann Kleint <Friedemann.Kleint@nokia.com> | 2010-01-13 10:36:37 +0100 |
---|---|---|
committer | con <qtc-committer@nokia.com> | 2010-01-13 11:51:19 +0100 |
commit | 4be033ae40b277240332ff55a0667c9be7883326 (patch) | |
tree | b73a7237910a0b3081dab442a93975efa396ce87 /src/plugins | |
parent | 5813394b17fb330b4c3fd3e2debaaeb36e877832 (diff) | |
download | qt-creator-4be033ae40b277240332ff55a0667c9be7883326.tar.gz |
Debugger/CDB: Increase limits on string size in watch data.
Introduce truncation in item view instead (full value visible in
ToolTip).
Reviewed-by: hjk
Task-number: QTCREATORBUG-305
(cherry picked from commit 55b4e6d383d7d88ce32cf19ec87d85864ddb15fd)
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/debugger/cdb/cdbsymbolgroupcontext.cpp | 12 | ||||
-rw-r--r-- | src/plugins/debugger/watchhandler.cpp | 16 |
2 files changed, 20 insertions, 8 deletions
diff --git a/src/plugins/debugger/cdb/cdbsymbolgroupcontext.cpp b/src/plugins/debugger/cdb/cdbsymbolgroupcontext.cpp index b37c821889..72f7a59e84 100644 --- a/src/plugins/debugger/cdb/cdbsymbolgroupcontext.cpp +++ b/src/plugins/debugger/cdb/cdbsymbolgroupcontext.cpp @@ -750,9 +750,10 @@ static inline bool getUnsignedHexValue(CIDebugSymbolGroup *sg, int index, quint6 return getUnsignedHexValue(stringValue, value); } +enum { maxStringLength = 4096 }; + int CdbSymbolGroupContext::dumpQString(CIDebugDataSpaces *ds, WatchData *wd) { - const int maxLength = 40; QString errorMessage; unsigned long stringIndex; if (!lookupPrefix(wd->iname, &stringIndex)) @@ -774,9 +775,9 @@ int CdbSymbolGroupContext::dumpQString(CIDebugDataSpaces *ds, WatchData *wd) if (!getUnsignedHexValue(m_symbolGroup, arrayIndex, &array)) return 5; // Fetch - const bool truncated = size > maxLength; + const bool truncated = size > maxStringLength; if (truncated) - size = maxLength; + size = maxStringLength; const QChar doubleQuote = QLatin1Char('"'); QString value; if (size > 0) { @@ -808,7 +809,6 @@ int CdbSymbolGroupContext::dumpQString(CIDebugDataSpaces *ds, WatchData *wd) int CdbSymbolGroupContext::dumpStdString(WatchData *wd) { - const int maxLength = 40; QString errorMessage; unsigned long stringIndex; if (!lookupPrefix(wd->iname, &stringIndex)) @@ -835,8 +835,8 @@ int CdbSymbolGroupContext::dumpStdString(WatchData *wd) if (quotePos == -1) return 1; bufValue.remove(0, quotePos); - if (bufValue.size() > maxLength) { - bufValue.truncate(maxLength); + if (bufValue.size() > maxStringLength) { + bufValue.truncate(maxStringLength); bufValue += QLatin1String("...\""); } wd->setValue(bufValue); diff --git a/src/plugins/debugger/watchhandler.cpp b/src/plugins/debugger/watchhandler.cpp index 3723d5b627..661df2cc8a 100644 --- a/src/plugins/debugger/watchhandler.cpp +++ b/src/plugins/debugger/watchhandler.cpp @@ -727,6 +727,18 @@ void WatchModel::emitDataChanged(int column, const QModelIndex &parentIndex) emitDataChanged(column, index(i, 0, parentIndex)); } +// Truncate value for item view, maintaining quotes +static inline QString truncateValue(QString v) +{ + enum { maxLength = 512 }; + if (v.size() < maxLength) + return v; + const bool isQuoted = v.endsWith(QLatin1Char('"')); // check for 'char* "Hallo"' + v.truncate(maxLength); + v += isQuoted ? QLatin1String("...\"") : QLatin1String("..."); + return v; +} + QVariant WatchModel::data(const QModelIndex &idx, int role) const { const WatchItem &data = *watchItem(idx); @@ -735,9 +747,9 @@ QVariant WatchModel::data(const QModelIndex &idx, int role) const case Qt::DisplayRole: { switch (idx.column()) { case 0: return data.name; - case 1: return formattedValue(data, + case 1: return truncateValue(formattedValue(data, m_handler->m_individualFormats.value(data.iname, -1), - m_handler->m_typeFormats.value(data.type, -1)); + m_handler->m_typeFormats.value(data.type, -1))); case 2: if (!data.displayedType.isEmpty()) return data.displayedType; |