return m.data(LocalsSizeRole).toUInt();
}
-// Create a map of value->name for register markup
+// Create a map of value->name for register markup.
typedef QMap<quint64, QString> RegisterMap;
typedef RegisterMap::const_iterator RegisterMapConstIt;
// number and tooltip. Parts of it will be overwritten when recursing
// over the children.
-typedef QPair<int, QString> ColorNumberToolTipPair;
-typedef QVector<ColorNumberToolTipPair> ColorNumberToolTipVector;
+typedef QPair<int, QString> ColorNumberToolTip;
+typedef QVector<ColorNumberToolTip> ColorNumberToolTips;
-static inline QString variableToolTip(const QString &name,
- const QString &type,
- quint64 offset)
+static QString variableToolTip(const QString &name, const QString &type,
+ quint64 offset)
{
return offset ?
//: HTML tooltip of a variable in the memory editor
const QString &name,
quint64 start, quint64 end,
int *colorNumberIn,
- ColorNumberToolTipVector *cnmv)
+ ColorNumberToolTips *cnmv)
{
int childCount = 0;
// Recurse over top level items if modelIndex is invalid.
const bool isRoot = !modelIndex.isValid();
- const int rowCount = isRoot ? model->rowCount() : modelIndex.model()->rowCount(modelIndex);
+ const int rowCount = isRoot
+ ? model->rowCount() : modelIndex.model()->rowCount(modelIndex);
if (!rowCount)
return childCount;
const QString nameRoot = name.isEmpty() ? name : name + QLatin1Char('.');
for (int r = 0; r < rowCount; r++) {
- const QModelIndex childIndex = isRoot ? model->index(r, 0) : modelIndex.child(r, 0);
+ const QModelIndex childIndex = isRoot
+ ? model->index(r, 0) : modelIndex.child(r, 0);
const quint64 childAddress = addressOf(childIndex);
const uint childSize = sizeOf(childIndex);
if (childAddress && childAddress >= start
const quint64 childOffset = childAddress - start;
const QString toolTip
= variableToolTip(childName, typeOf(childIndex), childOffset);
- const ColorNumberToolTipPair colorNumberNamePair((*colorNumberIn)++, toolTip);
- const ColorNumberToolTipVector::iterator begin = cnmv->begin() + childOffset;
+ const ColorNumberToolTip colorNumberNamePair((*colorNumberIn)++, toolTip);
+ const ColorNumberToolTips::iterator begin = cnmv->begin() + childOffset;
qFill(begin, begin + childSize, colorNumberNamePair);
childCount++;
- childCount += memberVariableRecursion(model, childIndex, childName, start, end, colorNumberIn, cnmv);
+ childCount += memberVariableRecursion(model, childIndex,
+ childName, start, end, colorNumberIn, cnmv);
}
}
return childCount;
typedef QList<MemoryMarkup> MemoryMarkupList;
-static inline MemoryMarkupList
+static MemoryMarkupList
variableMemoryMarkup(const QAbstractItemModel *model,
const QModelIndex &modelIndex,
const QString &rootName,
// leaving the padding areas of the parent colored with the base color.
MemoryMarkupList result;
int colorNumber = 0;
- ColorNumberToolTipVector ranges(size, ColorNumberToolTipPair(colorNumber, rootToolTip));
+ ColorNumberToolTips ranges(size, ColorNumberToolTip(colorNumber, rootToolTip));
const int childCount = memberVariableRecursion(model, modelIndex,
rootName, address, address + size,
&colorNumber, &ranges);
if (it.key() >= address) {
const quint64 offset = it.key() - address;
if (offset < size) {
- ranges[offset] =
- ColorNumberToolTipPair(registerColorNumber,
- WatchWindow::tr("Register <i>%1</i>").arg(it.value()));
+ ranges[offset] = ColorNumberToolTip(registerColorNumber,
+ WatchWindow::tr("Register <i>%1</i>").arg(it.value()));
} else {
break; // Sorted.
}
QString name;
for (unsigned i = 0; i < size; ++i)
if (name != ranges.at(i).second) {
- dbg << ",[" << i << ' ' << ranges.at(i).first << ' ' << ranges.at(i).second << ']';
+ dbg << ",[" << i << ' ' << ranges.at(i).first << ' '
+ << ranges.at(i).second << ']';
name = ranges.at(i).second;
}
}
int lastColorNumber = 0;
int childNumber = 0;
for (unsigned i = 0; i < size; ++i) {
- const ColorNumberToolTipPair &range = ranges.at(i);
+ const ColorNumberToolTip &range = ranges.at(i);
if (result.isEmpty() || lastColorNumber != range.first) {
lastColorNumber = range.first;
// Base colors: Parent/register
QString name;
for (unsigned i = 0; i < size; ++i)
if (name != ranges.at(i).second) {
- dbg << ',' << i << ' ' << ranges.at(i).first << ' ' << ranges.at(i).second;
+ dbg << ',' << i << ' ' << ranges.at(i).first << ' '
+ << ranges.at(i).second;
name = ranges.at(i).second;
}
dbg << '\n';
}
// Convenience to create a memory view of a variable.
-static void addVariableMemoryView(DebuggerEngine *engine,
- bool separateView,
- const QModelIndex &m, bool deferencePointer,
- const QPoint &p,
- QWidget *parent)
+static void addVariableMemoryView(DebuggerEngine *engine, bool separateView,
+ const QModelIndex &m, bool deferencePointer,
+ const QPoint &p, QWidget *parent)
{
const QColor background = parent->palette().color(QPalette::Normal, QPalette::Base);
const quint64 address = deferencePointer ? pointerValueOf(m) : addressOf(m);
address, size,
registerMap(engine),
sizeIsEstimate, background);
- const unsigned flags = separateView ? (DebuggerEngine::MemoryView|DebuggerEngine::MemoryReadOnly) : 0;
- const QString title = deferencePointer ?
- WatchWindow::tr("Memory Referenced by Pointer '%1' (0x%2)").arg(nameOf(m)).arg(address, 0, 16) :
- WatchWindow::tr("Memory at Variable '%1' (0x%2)").arg(nameOf(m)).arg(address, 0, 16);
+ const unsigned flags = separateView
+ ? DebuggerEngine::MemoryView|DebuggerEngine::MemoryReadOnly : 0;
+ const QString title = deferencePointer
+ ? WatchWindow::tr("Memory Referenced by Pointer \"%1\" (0x%2)")
+ .arg(nameOf(m)).arg(address, 0, 16)
+ : WatchWindow::tr("Memory at Variable \"%1\" (0x%2)")
+ .arg(nameOf(m)).arg(address, 0, 16);
engine->openMemoryView(address, flags, markup, p, title, parent);
}
// Add a memory view of the stack layout showing local variables
// and registers.
-static inline void addStackLayoutMemoryView(DebuggerEngine *engine,
- bool separateView,
- const QAbstractItemModel *m, const QPoint &p,
- QWidget *parent)
+static void addStackLayoutMemoryView(DebuggerEngine *engine, bool separateView,
+ const QAbstractItemModel *m, const QPoint &p, QWidget *parent)
{
typedef QPair<quint64, QString> RegisterValueNamePair;
QTC_ASSERT(engine && m, return ;)
- // Determine suitable address range from locals
+ // Determine suitable address range from locals.
quint64 start = Q_UINT64_C(0xFFFFFFFFFFFFFFFF);
quint64 end = 0;
const int rootItemCount = m->rowCount();
}
// Anything found and everything in a sensible range (static data in-between)?
if (end <= start || end - start > 100 * 1024) {
- QMessageBox::information(parent, WatchWindow::tr("Cannot Display Stack Layout"),
+ QMessageBox::information(parent,
+ WatchWindow::tr("Cannot Display Stack Layout"),
WatchWindow::tr("Could not determine a suitable address range."));
return;
}
variableMemoryMarkup(m, QModelIndex(), QString(),
QString(), start, end - start,
regMap, true, background);
- const unsigned flags = separateView ? (DebuggerEngine::MemoryView|DebuggerEngine::MemoryReadOnly) : 0;
+ const unsigned flags = separateView
+ ? (DebuggerEngine::MemoryView|DebuggerEngine::MemoryReadOnly) : 0;
const QString title =
WatchWindow::tr("Memory Layout of Local Variables at 0x%1").arg(start, 0, 16);
engine->openMemoryView(start, flags, markup, p, title, parent);
QTreeView::mouseDoubleClickEvent(ev);
}
-// Text for add watch action with truncated expression
-static inline QString addWatchActionText(QString exp)
+// Text for add watch action with truncated expression.
+static QString addWatchActionText(QString exp)
{
if (exp.isEmpty())
return WatchWindow::tr("Evaluate Expression");
return WatchWindow::tr("Evaluate Expression \"%1\"").arg(exp);
}
-// Text for add watch action with truncated expression
-static inline QString removeWatchActionText(QString exp)
+// Text for add watch action with truncated expression.
+static QString removeWatchActionText(QString exp)
{
if (exp.isEmpty())
return WatchWindow::tr("Remove Evaluated Expression");
return WatchWindow::tr("Remove Evaluated Expression \"%1\"").arg(exp);
}
-static inline void copyToClipboard(const QString &clipboardText)
+static void copyToClipboard(const QString &clipboardText)
{
QClipboard *clipboard = QApplication::clipboard();
#ifdef Q_WS_X11