forked from qt-creator/qt-creator
debugger: make alphabetic sorting of struct members optional.
Task-number: QTCREATORBUG-1608
This commit is contained in:
@@ -265,6 +265,14 @@ DebuggerSettings *DebuggerSettings::instance()
|
|||||||
item->setValue(true);
|
item->setValue(true);
|
||||||
instance->insertItem(ShowQtNamespace, item);
|
instance->insertItem(ShowQtNamespace, item);
|
||||||
|
|
||||||
|
item = new SavedAction(instance);
|
||||||
|
item->setSettingsKey(debugModeGroup, QLatin1String("SortStructMembers"));
|
||||||
|
item->setText(tr("Sort Members of Classes and Structs Alphabetically"));
|
||||||
|
item->setCheckable(true);
|
||||||
|
item->setDefaultValue(true);
|
||||||
|
item->setValue(true);
|
||||||
|
instance->insertItem(SortStructMembers, item);
|
||||||
|
|
||||||
//
|
//
|
||||||
// DebuggingHelper
|
// DebuggingHelper
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -125,6 +125,7 @@ enum DebuggerActionCode
|
|||||||
// Watchers & Locals
|
// Watchers & Locals
|
||||||
ShowStdNamespace,
|
ShowStdNamespace,
|
||||||
ShowQtNamespace,
|
ShowQtNamespace,
|
||||||
|
SortStructMembers,
|
||||||
|
|
||||||
// Source List
|
// Source List
|
||||||
ListSourceFiles,
|
ListSourceFiles,
|
||||||
|
|||||||
@@ -569,6 +569,7 @@ QWidget *CommonOptionsPage::createPage(QWidget *parent)
|
|||||||
m_ui.spinBoxMaximalStackDepth);
|
m_ui.spinBoxMaximalStackDepth);
|
||||||
m_group.insert(theDebuggerAction(ShowStdNamespace), 0);
|
m_group.insert(theDebuggerAction(ShowStdNamespace), 0);
|
||||||
m_group.insert(theDebuggerAction(ShowQtNamespace), 0);
|
m_group.insert(theDebuggerAction(ShowQtNamespace), 0);
|
||||||
|
m_group.insert(theDebuggerAction(SortStructMembers), 0);
|
||||||
m_group.insert(theDebuggerAction(LogTimeStamps), 0);
|
m_group.insert(theDebuggerAction(LogTimeStamps), 0);
|
||||||
m_group.insert(theDebuggerAction(VerboseLog), 0);
|
m_group.insert(theDebuggerAction(VerboseLog), 0);
|
||||||
m_group.insert(theDebuggerAction(UsePreciseBreakpoints), 0);
|
m_group.insert(theDebuggerAction(UsePreciseBreakpoints), 0);
|
||||||
@@ -2347,6 +2348,7 @@ void DebuggerPluginPrivate::updateState(DebuggerEngine *engine)
|
|||||||
const bool canDeref = actionsEnabled
|
const bool canDeref = actionsEnabled
|
||||||
&& (m_capabilities & AutoDerefPointersCapability);
|
&& (m_capabilities & AutoDerefPointersCapability);
|
||||||
theDebuggerAction(AutoDerefPointers)->setEnabled(canDeref);
|
theDebuggerAction(AutoDerefPointers)->setEnabled(canDeref);
|
||||||
|
theDebuggerAction(AutoDerefPointers)->setEnabled(true);
|
||||||
theDebuggerAction(ExpandStack)->setEnabled(actionsEnabled);
|
theDebuggerAction(ExpandStack)->setEnabled(actionsEnabled);
|
||||||
theDebuggerAction(ExecuteCommand)->setEnabled(m_state == InferiorStopOk);
|
theDebuggerAction(ExecuteCommand)->setEnabled(m_state == InferiorStopOk);
|
||||||
|
|
||||||
|
|||||||
@@ -426,7 +426,9 @@ void GdbEngine::handleDebuggingHelperValue2Classic(const GdbResponse &response)
|
|||||||
setWatchDataDisplayedType(data, response.data.findChild("displaytype"));
|
setWatchDataDisplayedType(data, response.data.findChild("displaytype"));
|
||||||
QList<WatchData> list;
|
QList<WatchData> list;
|
||||||
parseWatchData(watchHandler()->expandedINames(),
|
parseWatchData(watchHandler()->expandedINames(),
|
||||||
data, contents, &list);
|
data, contents,
|
||||||
|
theDebuggerBoolSetting(SortStructMembers),
|
||||||
|
&list);
|
||||||
//for (int i = 0; i != list.size(); ++i)
|
//for (int i = 0; i != list.size(); ++i)
|
||||||
// qDebug() << "READ: " << list.at(i).toString();
|
// qDebug() << "READ: " << list.at(i).toString();
|
||||||
watchHandler()->insertBulkData(list);
|
watchHandler()->insertBulkData(list);
|
||||||
|
|||||||
@@ -191,9 +191,11 @@ GdbEngine::GdbEngine(const DebuggerStartParameters &startParameters)
|
|||||||
m_gdbAdapter = createAdapter();
|
m_gdbAdapter = createAdapter();
|
||||||
|
|
||||||
connect(theDebuggerAction(AutoDerefPointers), SIGNAL(valueChanged(QVariant)),
|
connect(theDebuggerAction(AutoDerefPointers), SIGNAL(valueChanged(QVariant)),
|
||||||
this, SLOT(setAutoDerefPointers(QVariant)));
|
SLOT(reloadLocals()));
|
||||||
|
connect(theDebuggerAction(SortStructMembers), SIGNAL(valueChanged(QVariant)),
|
||||||
|
SLOT(reloadLocals()));
|
||||||
connect(theDebuggerAction(CreateFullBacktrace), SIGNAL(triggered()),
|
connect(theDebuggerAction(CreateFullBacktrace), SIGNAL(triggered()),
|
||||||
this, SLOT(createFullBacktrace()));
|
SLOT(createFullBacktrace()));
|
||||||
}
|
}
|
||||||
|
|
||||||
DebuggerStartMode GdbEngine::startMode() const
|
DebuggerStartMode GdbEngine::startMode() const
|
||||||
@@ -3342,9 +3344,8 @@ void GdbEngine::setToolTipExpression(const QPoint &mousePos,
|
|||||||
//
|
//
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void GdbEngine::setAutoDerefPointers(const QVariant &on)
|
void GdbEngine::reloadLocals()
|
||||||
{
|
{
|
||||||
Q_UNUSED(on)
|
|
||||||
setTokenBarrier();
|
setTokenBarrier();
|
||||||
updateLocals();
|
updateLocals();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ private: ////////// General State //////////
|
|||||||
|
|
||||||
void initializeVariables();
|
void initializeVariables();
|
||||||
DebuggerStartMode startMode() const;
|
DebuggerStartMode startMode() const;
|
||||||
Q_SLOT void setAutoDerefPointers(const QVariant &on);
|
Q_SLOT void reloadLocals();
|
||||||
|
|
||||||
bool m_registerNamesListed;
|
bool m_registerNamesListed;
|
||||||
|
|
||||||
|
|||||||
@@ -133,12 +133,14 @@ void GdbEngine::handleStackFramePython(const GdbResponse &response)
|
|||||||
|
|
||||||
GdbMi data = all.findChild("data");
|
GdbMi data = all.findChild("data");
|
||||||
QList<WatchData> list;
|
QList<WatchData> list;
|
||||||
|
const bool sortMembers = theDebuggerBoolSetting(SortStructMembers);
|
||||||
foreach (const GdbMi &child, data.children()) {
|
foreach (const GdbMi &child, data.children()) {
|
||||||
WatchData dummy;
|
WatchData dummy;
|
||||||
dummy.iname = child.findChild("iname").data();
|
dummy.iname = child.findChild("iname").data();
|
||||||
dummy.name = _(child.findChild("name").data());
|
dummy.name = _(child.findChild("name").data());
|
||||||
//qDebug() << "CHILD: " << child.toString();
|
//qDebug() << "CHILD: " << child.toString();
|
||||||
parseWatchData(watchHandler()->expandedINames(), dummy, child, &list);
|
parseWatchData(watchHandler()->expandedINames(), dummy, child,
|
||||||
|
sortMembers, &list);
|
||||||
}
|
}
|
||||||
watchHandler()->insertBulkData(list);
|
watchHandler()->insertBulkData(list);
|
||||||
//for (int i = 0; i != list.size(); ++i)
|
//for (int i = 0; i != list.size(); ++i)
|
||||||
|
|||||||
@@ -827,12 +827,13 @@ void PdbEngine::handleListLocals(const PdbResponse &response)
|
|||||||
//GdbMi data = all.findChild("data");
|
//GdbMi data = all.findChild("data");
|
||||||
QList<WatchData> list;
|
QList<WatchData> list;
|
||||||
WatchHandler *handler = watchHandler();
|
WatchHandler *handler = watchHandler();
|
||||||
|
bool sortMembers = theDebuggerBoolSetting(SortStructMembers);
|
||||||
foreach (const GdbMi &child, all.children()) {
|
foreach (const GdbMi &child, all.children()) {
|
||||||
WatchData dummy;
|
WatchData dummy;
|
||||||
dummy.iname = child.findChild("iname").data();
|
dummy.iname = child.findChild("iname").data();
|
||||||
dummy.name = _(child.findChild("name").data());
|
dummy.name = _(child.findChild("name").data());
|
||||||
//qDebug() << "CHILD: " << child.toString();
|
//qDebug() << "CHILD: " << child.toString();
|
||||||
parseWatchData(handler->expandedINames(), dummy, child, &list);
|
parseWatchData(handler->expandedINames(), dummy, child, sortMembers, &list);
|
||||||
}
|
}
|
||||||
handler->insertBulkData(list);
|
handler->insertBulkData(list);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1206,6 +1206,8 @@ WatchHandler::WatchHandler(DebuggerEngine *engine)
|
|||||||
SIGNAL(triggered()), this, SLOT(emitAllChanged()));
|
SIGNAL(triggered()), this, SLOT(emitAllChanged()));
|
||||||
connect(theDebuggerAction(ShowQtNamespace),
|
connect(theDebuggerAction(ShowQtNamespace),
|
||||||
SIGNAL(triggered()), this, SLOT(emitAllChanged()));
|
SIGNAL(triggered()), this, SLOT(emitAllChanged()));
|
||||||
|
connect(theDebuggerAction(SortStructMembers),
|
||||||
|
SIGNAL(triggered()), this, SLOT(emitAllChanged()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void WatchHandler::beginCycle(bool fullCycle)
|
void WatchHandler::beginCycle(bool fullCycle)
|
||||||
|
|||||||
@@ -1498,7 +1498,9 @@ static void gbdMiToWatchData(const GdbMi &root,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (w.name.isEmpty()) {
|
if (w.name.isEmpty()) {
|
||||||
const QString msg = QString::fromLatin1("Internal error: Unable to determine name at level %1/%2 for %3").arg(ctx.recursionLevel).arg(w.iname, QLatin1String(root.toString(true, 2)));
|
const QString msg = QString::fromLatin1(
|
||||||
|
"Internal error: Unable to determine name at level %1/%2 for %3")
|
||||||
|
.arg(ctx.recursionLevel).arg(w.iname, QLatin1String(root.toString(true, 2)));
|
||||||
qWarning("%s\n", qPrintable(msg));
|
qWarning("%s\n", qPrintable(msg));
|
||||||
}
|
}
|
||||||
gdbMiGetStringValue(&w.displayedType, root, "displayedtype");
|
gdbMiGetStringValue(&w.displayedType, root, "displayedtype");
|
||||||
@@ -1551,14 +1553,13 @@ static void gbdMiToWatchData(const GdbMi &root,
|
|||||||
gdbMiGetStringValue(&nextLevelContext.childType, root, "childtype");
|
gdbMiGetStringValue(&nextLevelContext.childType, root, "childtype");
|
||||||
if (!gdbMiGetIntValue(&nextLevelContext.childNumChild, root, "childnumchild"))
|
if (!gdbMiGetIntValue(&nextLevelContext.childNumChild, root, "childnumchild"))
|
||||||
nextLevelContext.childNumChild = -1;
|
nextLevelContext.childNumChild = -1;
|
||||||
foreach(const GdbMi &child, children) {
|
foreach (const GdbMi &child, children) {
|
||||||
gbdMiToWatchData(child, nextLevelContext, wl);
|
gbdMiToWatchData(child, nextLevelContext, wl);
|
||||||
nextLevelContext.childIndex++;
|
nextLevelContext.childIndex++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QtDumperHelper::parseValue(const char *data,
|
bool QtDumperHelper::parseValue(const char *data, QList<WatchData> *l)
|
||||||
QList<WatchData> *l)
|
|
||||||
{
|
{
|
||||||
l->clear();
|
l->clear();
|
||||||
GdbMi root;
|
GdbMi root;
|
||||||
@@ -1664,7 +1665,8 @@ void setWatchDataDisplayedType(WatchData &data, const GdbMi &item)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void parseWatchData(const QSet<QByteArray> &expandedINames,
|
void parseWatchData(const QSet<QByteArray> &expandedINames,
|
||||||
const WatchData &data0, const GdbMi &item, QList<WatchData> *list)
|
const WatchData &data0, const GdbMi &item,
|
||||||
|
bool sortMembers, QList<WatchData> *list)
|
||||||
{
|
{
|
||||||
//qDebug() << "HANDLE CHILDREN: " << data0.toString() << item.toString();
|
//qDebug() << "HANDLE CHILDREN: " << data0.toString() << item.toString();
|
||||||
WatchData data = data0;
|
WatchData data = data0;
|
||||||
@@ -1715,10 +1717,18 @@ void parseWatchData(const QSet<QByteArray> &expandedINames,
|
|||||||
else
|
else
|
||||||
data1.name = QString::number(i);
|
data1.name = QString::number(i);
|
||||||
GdbMi iname = child.findChild("iname");
|
GdbMi iname = child.findChild("iname");
|
||||||
if (iname.isValid())
|
if (iname.isValid()) {
|
||||||
data1.iname = iname.data();
|
data1.iname = iname.data();
|
||||||
else
|
} else {
|
||||||
data1.iname = data.iname + '.' + data1.name.toLatin1();
|
data1.iname = data.iname;
|
||||||
|
data1.iname += '.';
|
||||||
|
if (!sortMembers) {
|
||||||
|
char buf[10];
|
||||||
|
qsnprintf(buf, sizeof(buf) - 1, "%04d", i);
|
||||||
|
data1.iname += buf;
|
||||||
|
}
|
||||||
|
data1.iname += data1.name.toLatin1();
|
||||||
|
}
|
||||||
if (!data1.name.isEmpty() && data1.name.at(0).isDigit())
|
if (!data1.name.isEmpty() && data1.name.at(0).isDigit())
|
||||||
data1.name = _c('[') + data1.name + _c(']');
|
data1.name = _c('[') + data1.name + _c(']');
|
||||||
if (addressStep) {
|
if (addressStep) {
|
||||||
@@ -1737,7 +1747,7 @@ void parseWatchData(const QSet<QByteArray> &expandedINames,
|
|||||||
//data1.name += " (" + skey + ")";
|
//data1.name += " (" + skey + ")";
|
||||||
data1.name = skey;
|
data1.name = skey;
|
||||||
}
|
}
|
||||||
parseWatchData(expandedINames, data1, child, list);
|
parseWatchData(expandedINames, data1, child, sortMembers, list);
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -257,7 +257,7 @@ void setWatchDataType(WatchData &data, const GdbMi &mi);
|
|||||||
void setWatchDataDisplayedType(WatchData &data, const GdbMi &mi);
|
void setWatchDataDisplayedType(WatchData &data, const GdbMi &mi);
|
||||||
|
|
||||||
void parseWatchData(const QSet<QByteArray> &expandedINames,
|
void parseWatchData(const QSet<QByteArray> &expandedINames,
|
||||||
const WatchData &parent, const GdbMi &child,
|
const WatchData &parent, const GdbMi &child, bool sortMembers,
|
||||||
QList<WatchData> *insertions);
|
QList<WatchData> *insertions);
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
@@ -415,6 +415,7 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev)
|
|||||||
menu.addAction(theDebuggerAction(AutoDerefPointers));
|
menu.addAction(theDebuggerAction(AutoDerefPointers));
|
||||||
menu.addAction(theDebuggerAction(ShowStdNamespace));
|
menu.addAction(theDebuggerAction(ShowStdNamespace));
|
||||||
menu.addAction(theDebuggerAction(ShowQtNamespace));
|
menu.addAction(theDebuggerAction(ShowQtNamespace));
|
||||||
|
menu.addAction(theDebuggerAction(SortStructMembers));
|
||||||
|
|
||||||
QAction *actAdjustColumnWidths =
|
QAction *actAdjustColumnWidths =
|
||||||
menu.addAction(tr("Adjust Column Widths to Contents"));
|
menu.addAction(tr("Adjust Column Widths to Contents"));
|
||||||
|
|||||||
Reference in New Issue
Block a user