debugger: polish address display. also remove the mostly unused 'stored' address

This commit is contained in:
hjk
2010-03-23 14:48:07 +01:00
parent a080b8df66
commit 59af793953
8 changed files with 10 additions and 18 deletions

View File

@@ -1099,6 +1099,10 @@ class Dumper:
#for line in tb: #for line in tb:
# warn("%s" % line) # warn("%s" % line)
self.putName(item.name) self.putName(item.name)
try:
d.putAddress(item.value.address)
except:
pass
self.putValue("<invalid>") self.putValue("<invalid>")
self.putType(str(item.value.type)) self.putType(str(item.value.type))
self.putNumChild(0) self.putNumChild(0)
@@ -1252,14 +1256,13 @@ class Dumper:
self.putItemHelper( self.putItemHelper(
Item(item.value.dereference(), item.iname, None, None)) Item(item.value.dereference(), item.iname, None, None))
self.childTypes.pop() self.childTypes.pop()
self.putValue("@%s" % cleanAddress(value.address))
isHandled = True isHandled = True
# Fall back to plain pointer printing. # Fall back to plain pointer printing.
if not isHandled: if not isHandled:
#warn("GENERIC PLAIN POINTER: %s" % value.type) #warn("GENERIC PLAIN POINTER: %s" % value.type)
self.putType(item.value.type) self.putType(item.value.type)
#self.putValue(str(value))
self.putValue("")
self.putAddress(value.address) self.putAddress(value.address)
self.putNumChild(1) self.putNumChild(1)
if self.isExpanded(item): if self.isExpanded(item):
@@ -1267,6 +1270,7 @@ class Dumper:
self.putItem( self.putItem(
Item(item.value.dereference(), item.iname, "*", "*")) Item(item.value.dereference(), item.iname, "*", "*"))
self.endChildren() self.endChildren()
self.putValue(cleanAddress(value.address))
elif str(type).startswith("<anon"): elif str(type).startswith("<anon"):
# Anonymous union. We need a dummy name to distinguish # Anonymous union. We need a dummy name to distinguish
@@ -1289,6 +1293,10 @@ class Dumper:
fields = value.type.strip_typedefs().fields() fields = value.type.strip_typedefs().fields()
self.putType(item.value.type) self.putType(item.value.type)
try:
self.putAddress(item.value.address)
except:
pass
self.putValue("{...}") self.putValue("{...}")
if False: if False:

View File

@@ -1051,7 +1051,6 @@ static void qDumpInnerValueOrPointer(QDumper &d,
if (strippedtype) { if (strippedtype) {
if (deref(addr)) { if (deref(addr)) {
d.putItem("addr", deref(addr)); d.putItem("addr", deref(addr));
d.putItem("saddr", deref(addr));
d.putItem("type", strippedtype, d.currentChildType); d.putItem("type", strippedtype, d.currentChildType);
qDumpInnerValueHelper(d, strippedtype, deref(addr)); qDumpInnerValueHelper(d, strippedtype, deref(addr));
} else { } else {
@@ -1668,7 +1667,6 @@ static void qDumpQList(QDumper &d)
d.beginHash(); d.beginHash();
if (innerTypeIsPointer) { if (innerTypeIsPointer) {
void *p = pdata.d->array + i + pdata.d->begin; void *p = pdata.d->array + i + pdata.d->begin;
d.putItem("saddr", p);
if (*(void**)p) { if (*(void**)p) {
//d.putItem("value","@").put(p); //d.putItem("value","@").put(p);
qDumpInnerValue(d, strippedInnerType.data(), deref(p)); qDumpInnerValue(d, strippedInnerType.data(), deref(p));

View File

@@ -756,7 +756,6 @@ void GdbEngine::handleVarListChildrenHelperClassic(const GdbMi &item,
setWatchDataType(data, item.findChild("type")); setWatchDataType(data, item.findChild("type"));
setWatchDataValue(data, item.findChild("value")); setWatchDataValue(data, item.findChild("value"));
setWatchDataAddress(data, item.findChild("addr")); setWatchDataAddress(data, item.findChild("addr"));
setWatchDataSAddress(data, item.findChild("saddr"));
data.setHasChildren(false); data.setHasChildren(false);
insertData(data); insertData(data);
} else if (parent.iname.endsWith('.')) { } else if (parent.iname.endsWith('.')) {
@@ -780,7 +779,6 @@ void GdbEngine::handleVarListChildrenHelperClassic(const GdbMi &item,
setWatchDataType(data, item.findChild("type")); setWatchDataType(data, item.findChild("type"));
setWatchDataValue(data, item.findChild("value")); setWatchDataValue(data, item.findChild("value"));
setWatchDataAddress(data, item.findChild("addr")); setWatchDataAddress(data, item.findChild("addr"));
setWatchDataSAddress(data, item.findChild("saddr"));
setWatchDataChildCount(data, item.findChild("numchild")); setWatchDataChildCount(data, item.findChild("numchild"));
if (!manager()->watchHandler()->isExpandedIName(data.iname)) if (!manager()->watchHandler()->isExpandedIName(data.iname))
data.setChildrenUnneeded(); data.setChildrenUnneeded();

View File

@@ -3184,12 +3184,6 @@ void GdbEngine::setWatchDataAddressHelper(WatchData &data, const QByteArray &add
data.exp = "*(" + gdbQuoteTypes(data.type).toLatin1() + "*)" + data.addr; data.exp = "*(" + gdbQuoteTypes(data.type).toLatin1() + "*)" + data.addr;
} }
void GdbEngine::setWatchDataSAddress(WatchData &data, const GdbMi &mi)
{
if (mi.isValid())
data.saddr = mi.data();
}
void GdbEngine::setAutoDerefPointers(const QVariant &on) void GdbEngine::setAutoDerefPointers(const QVariant &on)
{ {
Q_UNUSED(on) Q_UNUSED(on)
@@ -3424,7 +3418,6 @@ void GdbEngine::handleChildren(const WatchData &data0, const GdbMi &item,
item.findChild("valueencoded").data().toInt()); item.findChild("valueencoded").data().toInt());
setWatchDataAddress(data, item.findChild("addr")); setWatchDataAddress(data, item.findChild("addr"));
setWatchDataExpression(data, item.findChild("exp")); setWatchDataExpression(data, item.findChild("exp"));
setWatchDataSAddress(data, item.findChild("saddr"));
setWatchDataValueEnabled(data, item.findChild("valueenabled")); setWatchDataValueEnabled(data, item.findChild("valueenabled"));
setWatchDataValueEditable(data, item.findChild("valueeditable")); setWatchDataValueEditable(data, item.findChild("valueeditable"));
setWatchDataChildCount(data, item.findChild("numchild")); setWatchDataChildCount(data, item.findChild("numchild"));

View File

@@ -534,7 +534,6 @@ private: ////////// Convenience Functions //////////
static void setWatchDataExpression(WatchData &data, const GdbMi &mi); static void setWatchDataExpression(WatchData &data, const GdbMi &mi);
static void setWatchDataAddress(WatchData &data, const GdbMi &mi); static void setWatchDataAddress(WatchData &data, const GdbMi &mi);
static void setWatchDataAddressHelper(WatchData &data, const QByteArray &addr); static void setWatchDataAddressHelper(WatchData &data, const QByteArray &addr);
static void setWatchDataSAddress(WatchData &data, const GdbMi &mi);
}; };
} // namespace Internal } // namespace Internal

View File

@@ -134,7 +134,6 @@ bool WatchData::isEqual(const WatchData &other) const
&& displayedType == other.displayedType && displayedType == other.displayedType
&& variable == other.variable && variable == other.variable
&& addr == other.addr && addr == other.addr
&& saddr == other.saddr
&& framekey == other.framekey && framekey == other.framekey
&& hasChildren == other.hasChildren && hasChildren == other.hasChildren
&& valueEnabled == other.valueEnabled && valueEnabled == other.valueEnabled
@@ -321,7 +320,6 @@ QString WatchData::toToolTip() const
} }
formatToolTipRow(str, WatchHandler::tr("Value"), val); formatToolTipRow(str, WatchHandler::tr("Value"), val);
formatToolTipRow(str, WatchHandler::tr("Object Address"), addr); formatToolTipRow(str, WatchHandler::tr("Object Address"), addr);
formatToolTipRow(str, WatchHandler::tr("Stored Address"), saddr);
formatToolTipRow(str, WatchHandler::tr("Internal ID"), iname); formatToolTipRow(str, WatchHandler::tr("Internal ID"), iname);
formatToolTipRow(str, WatchHandler::tr("Generation"), formatToolTipRow(str, WatchHandler::tr("Generation"),
QString::number(generation)); QString::number(generation));

View File

@@ -132,7 +132,6 @@ public:
QString displayedType;// Displayed type (optional) QString displayedType;// Displayed type (optional)
QByteArray variable; // Name of internal Gdb variable if created QByteArray variable; // Name of internal Gdb variable if created
QByteArray addr; // Displayed address QByteArray addr; // Displayed address
QByteArray saddr; // Stored address (pointer in container)
QString framekey; // Key for type cache QString framekey; // Key for type cache
QScriptValue scriptValue; // If needed... QScriptValue scriptValue; // If needed...
bool hasChildren; bool hasChildren;

View File

@@ -1478,7 +1478,6 @@ static void gbdMiToWatchData(const GdbMi &root,
if (gdbMiGetByteArrayValue(&b, root, "exp")) if (gdbMiGetByteArrayValue(&b, root, "exp"))
w.exp = b; w.exp = b;
gdbMiGetByteArrayValue(&w.addr, root, "addr"); gdbMiGetByteArrayValue(&w.addr, root, "addr");
gdbMiGetByteArrayValue(&w.saddr, root, "saddr");
gdbMiGetBoolValue(&w.valueEnabled, root, "valueenabled"); gdbMiGetBoolValue(&w.valueEnabled, root, "valueenabled");
gdbMiGetBoolValue(&w.valueEditable, root, "valueeditable"); gdbMiGetBoolValue(&w.valueEditable, root, "valueeditable");
if (gdbMiGetStringValue(&v, root, "valuetooltip", "valuetooltipencoded")) if (gdbMiGetStringValue(&v, root, "valuetooltip", "valuetooltipencoded"))