forked from qt-creator/qt-creator
Debugger: Rework display length limitation systems
There are two values now, one to limit an entry in the L&E view (default 100) and a hard upper limit (at 1 mio). If displayed values are elided, the true length is shown in addition. Change-Id: I180b70446c18e258c164e5af75b88d4c8b6c53f2 Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
@@ -121,6 +121,14 @@ CommonOptionsPageWidget::CommonOptionsPageWidget
|
||||
spinBoxMaximalStringLength->setSingleStep(1000);
|
||||
spinBoxMaximalStringLength->setValue(10000);
|
||||
|
||||
labelDisplayStringLimit = new QLabel(tr("Display string limit:"), behaviorBox);
|
||||
|
||||
spinBoxDisplayStringLimit = new QSpinBox(behaviorBox);
|
||||
spinBoxDisplayStringLimit->setSpecialValueText(tr("<unlimited>"));
|
||||
spinBoxDisplayStringLimit->setMaximum(10000);
|
||||
spinBoxDisplayStringLimit->setSingleStep(10);
|
||||
spinBoxDisplayStringLimit->setValue(100);
|
||||
|
||||
sourcesMappingWidget = new DebuggerSourcePathMappingWidget(this);
|
||||
|
||||
QHBoxLayout *horizontalLayout = new QHBoxLayout();
|
||||
@@ -128,6 +136,11 @@ CommonOptionsPageWidget::CommonOptionsPageWidget
|
||||
horizontalLayout->addWidget(spinBoxMaximalStackDepth);
|
||||
horizontalLayout->addStretch();
|
||||
|
||||
QHBoxLayout *horizontalLayout1 = new QHBoxLayout();
|
||||
horizontalLayout1->addWidget(labelDisplayStringLimit);
|
||||
horizontalLayout1->addWidget(spinBoxDisplayStringLimit);
|
||||
horizontalLayout1->addStretch();
|
||||
|
||||
QHBoxLayout *horizontalLayout2 = new QHBoxLayout();
|
||||
horizontalLayout2->addWidget(labelMaximalStringLength);
|
||||
horizontalLayout2->addWidget(spinBoxMaximalStringLength);
|
||||
@@ -148,7 +161,8 @@ CommonOptionsPageWidget::CommonOptionsPageWidget
|
||||
gridLayout->addWidget(checkBoxShowQmlObjectTree, 3, 1, 1, 1);
|
||||
gridLayout->addWidget(checkBoxKeepEditorStationaryWhileStepping, 4, 1, 1, 1);
|
||||
gridLayout->addWidget(checkBoxRegisterForPostMortem, 5, 1, 1, 1);
|
||||
gridLayout->addLayout(horizontalLayout2, 6, 1, 1, 2);
|
||||
gridLayout->addLayout(horizontalLayout1, 6, 1, 1, 2);
|
||||
gridLayout->addLayout(horizontalLayout2, 7, 1, 1, 2);
|
||||
|
||||
QVBoxLayout *verticalLayout = new QVBoxLayout(this);
|
||||
verticalLayout->addWidget(behaviorBox);
|
||||
@@ -193,6 +207,7 @@ CommonOptionsPageWidget::CommonOptionsPageWidget
|
||||
m_group->insert(dc->action(UseAddressInStackView), 0);
|
||||
m_group->insert(dc->action(AlwaysAdjustStackColumnWidths), 0);
|
||||
m_group->insert(dc->action(MaximalStackDepth), spinBoxMaximalStackDepth);
|
||||
m_group->insert(dc->action(DisplayStringLimit), spinBoxDisplayStringLimit);
|
||||
m_group->insert(dc->action(MaximalStringLength), spinBoxMaximalStringLength);
|
||||
m_group->insert(dc->action(ShowStdNamespace), 0);
|
||||
m_group->insert(dc->action(ShowQtNamespace), 0);
|
||||
|
||||
@@ -77,9 +77,11 @@ private:
|
||||
QCheckBox *checkBoxWarnOnReleaseBuilds;
|
||||
QCheckBox *checkBoxKeepEditorStationaryWhileStepping;
|
||||
QLabel *labelMaximalStackDepth;
|
||||
QLabel *labelDisplayStringLimit;
|
||||
QLabel *labelMaximalStringLength;
|
||||
QSpinBox *spinBoxMaximalStackDepth;
|
||||
QSpinBox *spinBoxMaximalStringLength;
|
||||
QSpinBox *spinBoxDisplayStringLimit;
|
||||
|
||||
DebuggerSourcePathMappingWidget *sourcesMappingWidget;
|
||||
const QSharedPointer<Utils::SavedActionSet> m_group;
|
||||
|
||||
@@ -631,8 +631,18 @@ DebuggerSettings::DebuggerSettings()
|
||||
item->setDefaultValue(20);
|
||||
insertItem(MaximalStackDepth, item);
|
||||
|
||||
item = new SavedAction(this);
|
||||
item->setSettingsKey(debugModeGroup, QLatin1String("DisplayStringLimit"));
|
||||
item->setToolTip(tr("The maximal length of string entries in the "
|
||||
"Locals and Expressions pane. Longer than that are cut off "
|
||||
"and displayed with an ellipsis attached."));
|
||||
item->setDefaultValue(100);
|
||||
insertItem(DisplayStringLimit, item);
|
||||
|
||||
item = new SavedAction(this);
|
||||
item->setSettingsKey(debugModeGroup, QLatin1String("MaximalStringLength"));
|
||||
item->setToolTip(tr("The maximal length for strings in separated windows. "
|
||||
"Longer strings are cut off and displayed with an ellipsis attached."));
|
||||
item->setDefaultValue(10000);
|
||||
insertItem(MaximalStringLength, item);
|
||||
|
||||
|
||||
@@ -148,6 +148,7 @@ enum DebuggerActionCode
|
||||
AutoDerefPointers,
|
||||
AlwaysAdjustLocalsColumnWidths,
|
||||
MaximalStringLength,
|
||||
DisplayStringLimit,
|
||||
|
||||
// Source List
|
||||
ListSourceFiles,
|
||||
|
||||
@@ -219,7 +219,6 @@ QDataStream &operator<<(QDataStream &stream, const WatchData &wd)
|
||||
stream << wd.value;
|
||||
stream << wd.editvalue;
|
||||
stream << wd.editformat;
|
||||
stream << wd.valuetooltip;
|
||||
stream << wd.typeFormats;
|
||||
stream << wd.type;
|
||||
stream << wd.displayedType;
|
||||
@@ -243,7 +242,6 @@ QDataStream &operator>>(QDataStream &stream, WatchData &wd)
|
||||
stream >> wd.value;
|
||||
stream >> wd.editvalue;
|
||||
stream >> wd.editformat;
|
||||
stream >> wd.valuetooltip;
|
||||
stream >> wd.typeFormats;
|
||||
stream >> wd.type;
|
||||
stream >> wd.displayedType;
|
||||
|
||||
@@ -4841,7 +4841,10 @@ void GdbEngine::updateLocalsPython(const UpdateParameters ¶ms)
|
||||
expanded += "formats:" + handler->individualFormatRequests();
|
||||
|
||||
QByteArray cutOff = " stringcutoff:"
|
||||
+ debuggerCore()->action(MaximalStringLength)->value().toByteArray();
|
||||
+ debuggerCore()->action(MaximalStringLength)->value().toByteArray()
|
||||
+ " displaystringlimit:"
|
||||
+ debuggerCore()->action(DisplayStringLimit)->value().toByteArray();
|
||||
|
||||
|
||||
QByteArray watchers;
|
||||
const QString fileName = stackHandler()->currentFrame().file;
|
||||
|
||||
@@ -126,6 +126,7 @@ WatchData::WatchData() :
|
||||
size(0),
|
||||
bitpos(0),
|
||||
bitsize(0),
|
||||
elided(0),
|
||||
hasChildren(false),
|
||||
valueEnabled(true),
|
||||
valueEditable(true),
|
||||
@@ -142,12 +143,12 @@ bool WatchData::isEqual(const WatchData &other) const
|
||||
&& name == other.name
|
||||
&& value == other.value
|
||||
&& editvalue == other.editvalue
|
||||
&& valuetooltip == other.valuetooltip
|
||||
&& type == other.type
|
||||
&& displayedType == other.displayedType
|
||||
&& variable == other.variable
|
||||
&& address == other.address
|
||||
&& size == other.size
|
||||
&& elided == other.elided
|
||||
&& hasChildren == other.hasChildren
|
||||
&& valueEnabled == other.valueEnabled
|
||||
&& valueEditable == other.valueEditable
|
||||
@@ -312,6 +313,9 @@ QString WatchData::toString() const
|
||||
if (isValueKnown() && !value.isEmpty())
|
||||
str << "value=\"" << value << doubleQuoteComma;
|
||||
|
||||
if (elided)
|
||||
str << "valueelided=\"" << elided << doubleQuoteComma;
|
||||
|
||||
if (!editvalue.isEmpty())
|
||||
str << "editvalue=\"<...>\",";
|
||||
// str << "editvalue=\"" << editvalue << doubleQuoteComma;
|
||||
@@ -382,7 +386,7 @@ QString WatchData::toToolTip() const
|
||||
formatToolTipRow(str, tr("Internal Type"), QLatin1String(type));
|
||||
if (!displayedType.isEmpty())
|
||||
formatToolTipRow(str, tr("Displayed Type"), displayedType);
|
||||
QString val = valuetooltip.isEmpty() ? value : valuetooltip;
|
||||
QString val = value;
|
||||
// Automatically display hex value for unsigned integers.
|
||||
if (!val.isEmpty() && val.at(0).isDigit() && isIntType(type)) {
|
||||
bool ok;
|
||||
@@ -458,13 +462,6 @@ void WatchData::updateValue(const GdbMi &item)
|
||||
}
|
||||
}
|
||||
|
||||
void setWatchDataValueToolTip(WatchData &data, const GdbMi &mi,
|
||||
int encoding)
|
||||
{
|
||||
if (mi.isValid())
|
||||
data.valuetooltip = decodeData(mi.data(), encoding);
|
||||
}
|
||||
|
||||
void WatchData::updateChildCount(const GdbMi &mi)
|
||||
{
|
||||
if (mi.isValid())
|
||||
@@ -629,6 +626,10 @@ void parseWatchData(const QSet<QByteArray> &expandedINames,
|
||||
if (mi.isValid())
|
||||
data.typeFormats = QString::fromUtf8(mi.data());
|
||||
|
||||
mi = item["valueelided"];
|
||||
if (mi.isValid())
|
||||
data.elided = mi.toInt();
|
||||
|
||||
mi = item["bitpos"];
|
||||
if (mi.isValid())
|
||||
data.bitpos = mi.toInt();
|
||||
|
||||
@@ -126,7 +126,6 @@ public:
|
||||
QString value; // Displayed value
|
||||
QByteArray editvalue; // Displayed value
|
||||
qint32 editformat; // Format of displayed value
|
||||
QString valuetooltip; // Tooltip in value column
|
||||
QString typeFormats; // Selection of formats of displayed value
|
||||
QByteArray type; // Type for further processing
|
||||
QString displayedType;// Displayed type (optional)
|
||||
@@ -135,6 +134,7 @@ public:
|
||||
uint size; // Size
|
||||
uint bitpos; // Position within bit fields
|
||||
uint bitsize; // Size in case of bit fields
|
||||
int elided; // Full size if value was cut off, -1 if cut on unknown size, 0 otherwise
|
||||
bool hasChildren;
|
||||
bool valueEnabled; // Value will be enabled or not
|
||||
bool valueEditable; // Value will be editable
|
||||
|
||||
@@ -695,6 +695,14 @@ QString WatchModel::formattedValue(const WatchData &data) const
|
||||
}
|
||||
}
|
||||
|
||||
if (data.elided) {
|
||||
QString v = value;
|
||||
v.chop(1);
|
||||
QString len = data.elided > 0 ? QString::number(data.elided)
|
||||
: QLatin1String("unknown length");
|
||||
return v + QLatin1String("\"... (") + len + QLatin1Char(')');
|
||||
}
|
||||
|
||||
return translate(value);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user