diff options
author | hjk <qtc-committer@nokia.com> | 2011-05-23 18:54:12 +0200 |
---|---|---|
committer | hjk <hjk@codereview.qt.nokia.com> | 2011-05-24 11:47:13 +0200 |
commit | 4bd6bb4d55e6ab9bb2389dcbbd5ec6e96d2c0adc (patch) | |
tree | 8ebfd1b4f8ceabfdb0bafb7de7c04e718f8e3f6d /src | |
parent | 4dcb417c3298c1f3bedd6dc9588cf2af2561909e (diff) | |
download | qt-creator-4bd6bb4d55e6ab9bb2389dcbbd5ec6e96d2c0adc.tar.gz |
debugger: improve robustness of watchers
This solves one common case of adding the 'class' *(class X*)0xdeadbeef
"needed" by gdb in case a local variable at the same location is known.
Change-Id: I5b25530b00e512c6e9155fb111ff4dc916832074
Reviewed-on: http://codereview.qt.nokia.com/76
Reviewed-by: hjk
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/debugger/watchhandler.cpp | 20 | ||||
-rw-r--r-- | src/plugins/debugger/watchutils.cpp | 10 |
2 files changed, 18 insertions, 12 deletions
diff --git a/src/plugins/debugger/watchhandler.cpp b/src/plugins/debugger/watchhandler.cpp index 4702b6394a..9cd7dbd5e4 100644 --- a/src/plugins/debugger/watchhandler.cpp +++ b/src/plugins/debugger/watchhandler.cpp @@ -595,16 +595,16 @@ static inline QString expression(const WatchItem *item) { if (!item->exp.isEmpty()) return QString::fromAscii(item->exp); - if (item->address && !item->type.isEmpty()) { - return QString::fromAscii("*(%1*)%2"). - arg(QLatin1String(item->type), QLatin1String(item->hexAddress())); - } - if (const WatchItem *parent = item->parent) { - if (!parent->exp.isEmpty()) - return QString::fromAscii("(%1).%2") - .arg(QString::fromLatin1(parent->exp), item->name); - } - return QString(); + if (item->address && !item->type.isEmpty()) { + return QString::fromAscii("*(%1*)%2"). + arg(QLatin1String(item->type), QLatin1String(item->hexAddress())); + } + if (const WatchItem *parent = item->parent) { + if (!parent->exp.isEmpty()) + return QString::fromAscii("(%1).%2") + .arg(QString::fromLatin1(parent->exp), item->name); + } + return QString(); } QVariant WatchModel::data(const QModelIndex &idx, int role) const diff --git a/src/plugins/debugger/watchutils.cpp b/src/plugins/debugger/watchutils.cpp index ed59a6979e..f8bcb1c64a 100644 --- a/src/plugins/debugger/watchutils.cpp +++ b/src/plugins/debugger/watchutils.cpp @@ -739,8 +739,14 @@ static void setWatchDataAddress(WatchData &data, quint64 address , quint64 origA } else { data.address = address; } - if (data.exp.isEmpty() && !data.dumperFlags.startsWith('$')) - data.exp = "*(" + gdbQuoteTypes(data.type) + "*)" +data.hexAddress(); + if (data.exp.isEmpty() && !data.dumperFlags.startsWith('$')) { + if (data.iname.startsWith("local.") && data.iname.count('.') == 1) + // Solve one common case of adding 'class' in + // *(class X*)0xdeadbeef for gdb. + data.exp = data.name.toLatin1(); + else + data.exp = "*(" + gdbQuoteTypes(data.type) + "*)" +data.hexAddress(); + } } void setWatchDataAddress(WatchData &data, const GdbMi &addressMi, const GdbMi &origAddressMi) |