CDB: Pass referenced address in separate GDBMI field.

Use 'origaddr' as gdb does. Do not append address to watch value
if it is already contained in the value.
Fixes the currently grayed-out 'Open memory editor at referenced
address'.

Change-Id: I6f7cf5b7984f93606ad4bb0872348f51c73f9117
Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
Friedemann Kleint
2012-08-21 13:39:53 +02:00
committed by hjk
parent 128a3fb0b6
commit a31e8b446e
2 changed files with 26 additions and 5 deletions

View File

@@ -1066,8 +1066,25 @@ int SymbolGroupNode::dumpNode(std::ostream &str,
const std::string watchExp = t.empty() ? aName : watchExpression(addr, t, m_dumperType, m_module);
SymbolGroupNode::dumpBasicData(str, aName, aFullIName, t, watchExp);
if (addr)
str << ",addr=\"" << std::hex << std::showbase << addr << std::noshowbase << std::dec << '"';
std::wstring value = simpleDumpValue(ctx);
if (addr) {
ULONG64 referencedAddr = 0;
// Determine referenced address of pointers?
if (!value.compare(0, 2u, L"0x")) {
std::wistringstream str(value.substr(2u, value.size() - 2u));
str >> std::hex >> referencedAddr;
}
// Emulate gdb's behaviour of returning the referenced address
// for pointers.
str << std::hex << std::showbase;
if (referencedAddr) {
str << ",addr=\"" << referencedAddr << "\",origaddr=\"" << addr << '"';
} else {
str << ",addr=\"" << addr << '"';
}
str << std::noshowbase << std::dec;
}
const ULONG s = size();
if (s)
str << ",size=\"" << s << '"';
@@ -1076,7 +1093,6 @@ int SymbolGroupNode::dumpNode(std::ostream &str,
bool valueEnabled = !uninitialized;
// Shall it be recoded?
std::wstring value = simpleDumpValue(ctx);
int encoding = 0;
if (dumpParameters.recode(t, aFullIName, ctx, addr, &value, &encoding)) {
str << ",valueencoded=\"" << encoding

View File

@@ -955,10 +955,15 @@ QString WatchModel::display(const WatchItem *item, int col) const
case 1:
result = removeInitialNamespace(
truncateValue(formattedValue(*item)));
// Append referencing address unless the value contains it.
if (item->referencingAddress) {
if (result.startsWith(QLatin1String("0x"))) {
result.prepend(QLatin1Char('@'));
} else {
result += QLatin1String(" @");
result += QString::fromLatin1(item->hexReferencingAddress());
}
}
break;
case 2:
result = removeNamespaces(displayType(*item));