Commit 4bd6bb4d authored by hjk's avatar hjk Committed by hjk

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
parent 4dcb417c
......@@ -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
......
......@@ -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)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment