diff --git a/src/libs/qtcreatorcdbext/symbolgroupnode.cpp b/src/libs/qtcreatorcdbext/symbolgroupnode.cpp index 43f9a04b653b1355255756f15ccaa7693ee857c5..bb2e950fc5f24e0817fdef7b02eb5dd1a4b0a0e7 100644 --- a/src/libs/qtcreatorcdbext/symbolgroupnode.cpp +++ b/src/libs/qtcreatorcdbext/symbolgroupnode.cpp @@ -987,7 +987,8 @@ int SymbolGroupNode::dumpNode(std::ostream &str, if (addr) str << ",addr=\"" << std::hex << std::showbase << addr << std::noshowbase << std::dec << '"'; - + if (const ULONG s = size()) + str << ",size=\"" << s << '"'; const bool uninitialized = flags() & Uninitialized; bool valueEditable = !uninitialized; bool valueEnabled = !uninitialized; diff --git a/src/plugins/debugger/debuggerconstants.h b/src/plugins/debugger/debuggerconstants.h index c7ba8834b6dc076a4eb243e52290df5420653e2c..a91ea319a2da52babbc5ae42552fe1df533a2075 100644 --- a/src/plugins/debugger/debuggerconstants.h +++ b/src/plugins/debugger/debuggerconstants.h @@ -220,6 +220,7 @@ enum ModelRoles LocalsTypeFormatRole, // Used to communicate alternative formats to the view LocalsIndividualFormatRole, LocalsAddressRole, // Memory address of variable as quint64 + LocalsSizeRole, // Size of variable as quint LocalsRawValueRole, // Unformatted value as string LocalsPointerValueRole, // Pointer value (address) as quint64 LocalsIsWatchpointAtAddressRole, diff --git a/src/plugins/debugger/debuggerstreamops.cpp b/src/plugins/debugger/debuggerstreamops.cpp index 75cab5badff30e821cb8ce66e3f3dd4adf4d20fa..22b9cab355022ede9004b1272954b474ff1177b0 100644 --- a/src/plugins/debugger/debuggerstreamops.cpp +++ b/src/plugins/debugger/debuggerstreamops.cpp @@ -225,6 +225,7 @@ QDataStream &operator<<(QDataStream &stream, const WatchData &wd) stream << wd.displayedType; stream << wd.variable; stream << wd.address; + stream << wd.size; stream << wd.hasChildren; stream << wd.generation; stream << wd.valueEnabled; @@ -250,6 +251,7 @@ QDataStream &operator>>(QDataStream &stream, WatchData &wd) stream >> wd.displayedType; stream >> wd.variable; stream >> wd.address; + stream >> wd.size; stream >> wd.hasChildren; stream >> wd.generation; stream >> wd.valueEnabled; diff --git a/src/plugins/debugger/watchdata.cpp b/src/plugins/debugger/watchdata.cpp index 817d0fc2a1307279ffda0cbfc8e7b8dae4763a67..c807f86606bf854e0173b5819b8e73991601d84d 100644 --- a/src/plugins/debugger/watchdata.cpp +++ b/src/plugins/debugger/watchdata.cpp @@ -145,6 +145,7 @@ WatchData::WatchData() : state(InitialState), editformat(0), address(0), + size(0), bitpos(0), bitsize(0), generation(-1), @@ -170,6 +171,7 @@ bool WatchData::isEqual(const WatchData &other) const && displayedType == other.displayedType && variable == other.variable && address == other.address + && size == other.size && hasChildren == other.hasChildren && valueEnabled == other.valueEnabled && valueEditable == other.valueEditable @@ -370,6 +372,9 @@ QString WatchData::toToolTip() const formatToolTipRow(str, tr("Value"), val); formatToolTipRow(str, tr("Object Address"), QString::fromAscii(hexAddress())); + if (size) + formatToolTipRow(str, tr("Size"), + QString::number(size)); formatToolTipRow(str, tr("Internal ID"), iname); formatToolTipRow(str, tr("Generation"), QString::number(generation)); diff --git a/src/plugins/debugger/watchdata.h b/src/plugins/debugger/watchdata.h index e65b159cd36913d8c819f77ef561c374c07d06b0..f62d73c38268eacdf58d16383e46fa5b93411a3f 100644 --- a/src/plugins/debugger/watchdata.h +++ b/src/plugins/debugger/watchdata.h @@ -128,6 +128,7 @@ public: QByteArray type; // Type for further processing QString displayedType;// Displayed type (optional) quint64 address; // Displayed address + uint size; // Size uint bitpos; // Position within bit fields uint bitsize; // Size in case of bit fields qint32 generation; // When updated? diff --git a/src/plugins/debugger/watchhandler.cpp b/src/plugins/debugger/watchhandler.cpp index 776a82dfa5d0946f69af73a91beb3d873a37d781..a232b09843910b4b2a4ddcb3be11f5c818b0ca67 100644 --- a/src/plugins/debugger/watchhandler.cpp +++ b/src/plugins/debugger/watchhandler.cpp @@ -735,6 +735,8 @@ QVariant WatchModel::data(const QModelIndex &idx, int role) const case LocalsAddressRole: return data.coreAddress(); + case LocalsSizeRole: + return QVariant(data.size); case LocalsIsWatchpointAtPointerValueRole: if (isPointerType(data.type)) { diff --git a/src/plugins/debugger/watchutils.cpp b/src/plugins/debugger/watchutils.cpp index 7cd2a79ef5681edba9d588cd2cb33cecf744367e..0c784b0f082a3c691bb99929ec38ed4f3d250334 100644 --- a/src/plugins/debugger/watchutils.cpp +++ b/src/plugins/debugger/watchutils.cpp @@ -1349,6 +1349,16 @@ void setWatchDataAddress(WatchData &data, const GdbMi &mi) setWatchDataAddressHelper(data, mi.data()); } +void setWatchDataSize(WatchData &data, const GdbMi &mi) +{ + if (mi.isValid()) { + bool ok = false; + const unsigned size = mi.data().toUInt(&ok); + if (ok) + data.size = size; + } +} + void setWatchDataAddressHelper(WatchData &data, const QByteArray &addr) { if (addr.startsWith("0x")) { // Item model dumpers pull tricks @@ -1408,6 +1418,7 @@ void parseWatchData(const QSet<QByteArray> &expandedINames, setWatchDataValue(data, item); setWatchDataAddress(data, item.findChild("addr")); + setWatchDataSize(data, item.findChild("size")); setWatchDataExpression(data, item.findChild("exp")); setWatchDataValueEnabled(data, item.findChild("valueenabled")); setWatchDataValueEditable(data, item.findChild("valueeditable")); diff --git a/src/plugins/debugger/watchwindow.cpp b/src/plugins/debugger/watchwindow.cpp index d61dcd58b3e19e8f3a505e4d0d56914208b36023..9dea686ed1b47b82c5f869d4d68bbe3170d3b53c 100644 --- a/src/plugins/debugger/watchwindow.cpp +++ b/src/plugins/debugger/watchwindow.cpp @@ -279,6 +279,7 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev) const QModelIndex mi1 = idx.sibling(idx.row(), 1); const QModelIndex mi2 = idx.sibling(idx.row(), 2); const quint64 address = mi0.data(LocalsAddressRole).toULongLong(); + const uint size = mi0.data(LocalsSizeRole).toUInt(); const quint64 pointerValue = mi0.data(LocalsPointerValueRole).toULongLong(); const QString exp = mi0.data(LocalsExpressionRole).toString(); const QString type = mi2.data().toString(); @@ -513,9 +514,9 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev) if (dialog.exec() == QDialog::Accepted) currentEngine()->openMemoryView(dialog.address()); } else if (act == actSetWatchpointAtVariableAddress) { - setWatchpoint(address); + setWatchpoint(address, size); } else if (act == actSetWatchpointAtPointerValue) { - setWatchpoint(pointerValue); + setWatchpoint(pointerValue, 1); } else if (act == actSelectWidgetToWatch) { grabMouse(Qt::CrossCursor); m_grabbing = true; @@ -661,10 +662,11 @@ void WatchWindow::setModelData model()->setData(index, value, role); } -void WatchWindow::setWatchpoint(quint64 address) +void WatchWindow::setWatchpoint(quint64 address, unsigned size) { BreakpointParameters data(Watchpoint); data.address = address; + data.size = size; BreakpointId id = breakHandler()->findWatchpoint(data); if (id) { qDebug() << "WATCHPOINT EXISTS"; diff --git a/src/plugins/debugger/watchwindow.h b/src/plugins/debugger/watchwindow.h index 4f0059d8d253fbe7c7ce86fda85bcda877b20546..5b952e809e13a5905682f0112f87a53e04e8c1d9 100644 --- a/src/plugins/debugger/watchwindow.h +++ b/src/plugins/debugger/watchwindow.h @@ -79,7 +79,7 @@ private: void editItem(const QModelIndex &idx); void resetHelper(const QModelIndex &idx); - void setWatchpoint(quint64 address); + void setWatchpoint(quint64 address, unsigned size); void setModelData(int role, const QVariant &value = QVariant(), const QModelIndex &index = QModelIndex());