diff --git a/src/plugins/debugger/debuggerconstants.h b/src/plugins/debugger/debuggerconstants.h index 6291b6869b0..311e27a3260 100644 --- a/src/plugins/debugger/debuggerconstants.h +++ b/src/plugins/debugger/debuggerconstants.h @@ -217,6 +217,7 @@ enum ModelRoles LocalsTypeFormatRole, // Used to communicate alternative formats to the view LocalsIndividualFormatRole, LocalsAddressRole, // Memory address of variable as quint64 + LocalsReferencingAddressRole, // Address referencing for 'Automatically dereferenced pointer' LocalsSizeRole, // Size of variable as quint LocalsRawValueRole, // Unformatted value as string LocalsPointerValueRole, // Pointer value (address) as quint64 diff --git a/src/plugins/debugger/watchhandler.cpp b/src/plugins/debugger/watchhandler.cpp index b46e7b7b356..f472ba0a3f5 100644 --- a/src/plugins/debugger/watchhandler.cpp +++ b/src/plugins/debugger/watchhandler.cpp @@ -748,6 +748,8 @@ QVariant WatchModel::data(const QModelIndex &idx, int role) const case LocalsAddressRole: return data.coreAddress(); + case LocalsReferencingAddressRole: + return QVariant(data.referencingAddress); case LocalsSizeRole: return QVariant(data.size); diff --git a/src/plugins/debugger/watchwindow.cpp b/src/plugins/debugger/watchwindow.cpp index 290627c931d..ef2f39554c9 100644 --- a/src/plugins/debugger/watchwindow.cpp +++ b/src/plugins/debugger/watchwindow.cpp @@ -406,23 +406,25 @@ static inline void addStackLayoutMemoryView(DebuggerEngine *engine, quint64 start = 0xFFFFFFFFFFFFFFFF; quint64 end = 0; const int rootItemCount = m->rowCount(); - for (int r = 0; r < rootItemCount; r++) { // Note: Unsorted by default + // Note: Unsorted by default. Exclude 'Automatically dereferenced + // pointer' items as they are outside the address range. + for (int r = 0; r < rootItemCount; r++) { const QModelIndex idx = m->index(r, 0); - const quint64 address = addressOf(idx); - if (address) { - if (address < start) - start = address; - if (const uint size = sizeOf(idx)) - if (address + size > end) - end = address + size; + if (idx.data(LocalsReferencingAddressRole).toULongLong() == 0) { + const quint64 address = addressOf(idx); + if (address) { + if (address < start) + start = address; + if (const uint size = sizeOf(idx)) + if (address + size > end) + end = address + size; + } } } // 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"), - WatchWindow::tr("Could not determine a suitable address range. " - "Unchecking the option 'Automatically Dereference Pointers' " - "might help.")); + WatchWindow::tr("Could not determine a suitable address range.")); return; } // Take a look at the register values. Extend the range a bit if suitable